TheNewGuy Posted May 22, 2009 Posted May 22, 2009 I have been working with Lee Mac who has done an AMAZING:D job creating a lisp for me that will fill a circle with a series of arrayed circles, and place 6 points into each of these arrayed circles. I now need to create a lisp(or modify the existing one) that will create a table for me (either in Excel or in Acad) That displays the distances to these points. I have created an example of what I picture the table looking like, and what distances are needed. I realize this is a big job and I would be eternally grateful to anyone who can help me(us) finish this project. I have attached everything I have so far. Thank you in advance for your time. edm help v2.lsp Table Help Example.dwg SAMPLE TABLE.zip Quote
Lee Mac Posted May 22, 2009 Posted May 22, 2009 NewGuy, Just looking at your requirements, would you like the circles to be arrayed from 0 degrees or 90 degrees as the base point. At the moment, you will notice that all the circles are aligned at 0 degrees, and evenly spaced around the circle from there. Would you like this allignment at 90 degrees? Lee Quote
TheNewGuy Posted May 22, 2009 Author Posted May 22, 2009 I am not sure what you mean, I do know that what you have done so far is perfect. All I am looking for now is a table to generate and help organize the distances. Could you post a pic? Quote
Lee Mac Posted May 22, 2009 Posted May 22, 2009 Give this a shot for the table, I shall post a pic of what I mean (defun c:cCut (/ doc spc ofile cCnt tNum col row tmp1 tmp2 tmp3 tmp4 bsRad cCen cNum cAng i cPt AbcPt theta cPtlst AbRefpt InRefpt) (vl-load-com) (setq doc (vla-get-ActiveDocument (vlax-get-Acad-Object)) spc (if (zerop (vla-get-activespace doc)) (if (= (vla-get-mspace doc) :vlax-true) (vla-get-modelspace doc) (vla-get-paperspace doc)) (vla-get-modelspace doc))) (setvar "PDMODE" 3) ; Point Style (setvar "PDSIZE" 0.01) ; Point Size ;; Default Retrieval (or cut:out (setq cut:out 0.05)) (or cut:spc (setq cut:spc 0.007)) (or cut:row (setq cut:row 0.02)) (or cut:cir (setq cut:cir 0.125)) ;; Circle Selection (if (and (setq cEnt (car (entsel "\nSelect Base Circle: "))) (eq "CIRCLE" (cdr (assoc 0 (entget cEnt))))) (progn (setq ofile (open (strcat (getvar "DWGPREFIX") (substr (getvar "DWGNAME") 1 (- (strlen (getvar "DWGNAME")) 4)) ".csv") "w") cCnt 0. tNum 0. col 1 row 1) ;; User Input (initget 4) (setq tmp1 (getreal (strcat "\nSpecify Spacing from Edge <" (rtos cut:out) "> : "))) (or (not tmp1) (setq cut:out tmp1)) (initget 4) (setq tmp2 (getreal (strcat "\nSpecify Circle Spacing <" (rtos cut:spc) "> : "))) (or (not tmp2) (setq cut:spc tmp2)) (initget 4) (setq tmp3 (getreal (strcat "\nSpecify Row Spacing <" (rtos cut:row) "> : "))) (or (not tmp3) (setq cut:row tmp3)) (initget 6) (setq tmp4 (getreal (strcat "\nSpecify Inner Circle Radius <" (rtos cut:cir) "> : "))) (or (not tmp4) (setq cut:cir tmp4)) (setq bsRad (- (cdr (assoc 40 (entget cEnt))) cut:out cut:cir) cCen (cdr (assoc 10 (entget cEnt)))) ;; Main Loop (while (and (not (minusp bsRad)) (< cut:cir bsRad)) (setq cNum (fix (/ (* 2 pi bsRad) (+ (* 2 cut:cir) cut:spc))) cAng (/ (* 2 pi) cNum) i 0) ;; Secondary Loop (while (< i cNum) (write-line "CIRCLE,X ABS,Y ABS" ofile) (vla-put-color (vla-addCircle spc (vlax-3D-point (setq cPt (polar cCen (* i cAng) bsRad))) cut:cir) col) (setq tNum (1+ tNum) cCnt (1+ cCnt) AbcPt (mapcar '- cPt cCen)) (write-line (strcat (itoa row) "--" (rtos cCnt 2 0) (chr 44) (rtos (car AbcPt)) (chr 44) (rtos (cadr AbcPt))) ofile) (write-line "POINTS,X ABS,Y ABS,X INC,Y INC" ofile) (setq theta (atan (/ (/ 0.025 cut:cir) (sqrt (- 1. (expt (/ 0.025 cut:cir) 2)))))) (foreach x (setq cPtlst (list (cons "A" (polar cPt (* i cAng) cut:cir)) (cons "B" (polar cPt (- (* i cAng) (/ (+ pi cAng) 2.)) cut:cir)) (cons "C" (polar cPt (+ (* i cAng) pi theta) cut:cir)) (cons "D" (polar cPt (- (+ (* i cAng) pi) theta) cut:cir)) (cons "E" (polar cPt (+ (* i cAng) (/ (+ pi cAng) 2.)) cut:cir)))) (vla-addPoint spc (vlax-3D-point (cdr x))) (setq AbRefpt (mapcar '- (cdr x) cCen) InRefpt (mapcar '- (cdr x) cPt)) (write-line (strcat (car x) (chr 44) (rtos (car AbRefpt)) (chr 44) (rtos (cadr AbRefpt)) (chr 44) (rtos (car InRefpt)) (chr 44) (rtos (cadr InRefpt))) ofile)) (setq i (1+ i))) (setq bsRad (- bsRad (* 2 cut:cir) cut:row) col (abs (- col 3)) row (1+ row) cCnt 0.)) (princ (strcat "\n<< Number of Circles: " (rtos tNum 2 0) " >>")) (close ofile)) (princ "\n<!> Incorrect Selection <!>")) (princ)) File is saved in same place as drawing. Quote
Lee Mac Posted May 22, 2009 Posted May 22, 2009 Currently we have: Would you like the circles arrayed such that: Quote
TheNewGuy Posted May 22, 2009 Author Posted May 22, 2009 Oh, yes 90 degrees would be better. Thank you I did not catch that. It is at the 90 degree point that he usually enters the part. Good eye on that one. Quote
TheNewGuy Posted May 22, 2009 Author Posted May 22, 2009 YESSSSS! :lol:that is awesome! The table looks perfect! The EDM operator is excited. He says you have saved at least 1 whole day of work each time this type of job comes through. which is quite a few times a year. Are you still going to rotate it 90 degrees? Also I did notice that the center point of the arrayed circles are no longer displayed in the drawing. This is not a big deal at all as we can use the table to extract any distances we may need, but if it is not difficult, and only if it is not difficult, could you add the points back to the center of the arrayed circles? That way if I need to measure from one center to another i can simply use the DISTANCE command instead of doing some trig with the data from the table. Again that is not a big deal at all so don't put yourself out you have done GREAT!!!:D Quote
Lee Mac Posted May 22, 2009 Posted May 22, 2009 YESSSSS! :lol:that is awesome! The table looks perfect! The EDM operator is excited. He says you have saved at least 1 whole day of work each time this type of job comes through. which is quite a few times a year. Are you still going to rotate it 90 degrees? Also I did notice that the center point of the arrayed circles are no longer displayed in the drawing. This is not a big deal at all as we can use the table to extract any distances we may need, but if it is not difficult, and only if it is not difficult, could you add the points back to the center of the arrayed circles? That way if I need to measure from one center to another i can simply use the DISTANCE command instead of doing some trig with the data from the table. Again that is not a big deal at all so don't put yourself out you have done GREAT!!!:D Excellent - I'm glad its how you want it I shall see if I can rotate the base "vector" by 90 degrees for you, and adding the centre point is no trouble at all (about 1/2 a line of code, if that). Cheers Lee Quote
Lee Mac Posted May 22, 2009 Posted May 22, 2009 This should include the Rotation and Point adding: (defun c:cCut (/ doc spc ofile cCnt tNum col row tmp1 tmp2 tmp3 tmp4 bsRad cCen cNum cAng i cPt AbcPt theta cPtlst AbRefpt InRefpt) (vl-load-com) (setq doc (vla-get-ActiveDocument (vlax-get-Acad-Object)) spc (if (zerop (vla-get-activespace doc)) (if (= (vla-get-mspace doc) :vlax-true) (vla-get-modelspace doc) (vla-get-paperspace doc)) (vla-get-modelspace doc))) (setvar "PDMODE" 3) ; Point Style (setvar "PDSIZE" 0.01) ; Point Size ;; Default Retrieval (or cut:out (setq cut:out 0.05)) (or cut:spc (setq cut:spc 0.007)) (or cut:row (setq cut:row 0.02)) (or cut:cir (setq cut:cir 0.125)) ;; Circle Selection (if (and (setq cEnt (car (entsel "\nSelect Base Circle: "))) (eq "CIRCLE" (cdr (assoc 0 (entget cEnt))))) (progn (setq ofile (open (strcat (getvar "DWGPREFIX") (substr (getvar "DWGNAME") 1 (- (strlen (getvar "DWGNAME")) 4)) ".csv") "w") cCnt 0. tNum 0. col 1 row 1) ;; User Input (initget 4) (setq tmp1 (getreal (strcat "\nSpecify Spacing from Edge <" (rtos cut:out) "> : "))) (or (not tmp1) (setq cut:out tmp1)) (initget 4) (setq tmp2 (getreal (strcat "\nSpecify Circle Spacing <" (rtos cut:spc) "> : "))) (or (not tmp2) (setq cut:spc tmp2)) (initget 4) (setq tmp3 (getreal (strcat "\nSpecify Row Spacing <" (rtos cut:row) "> : "))) (or (not tmp3) (setq cut:row tmp3)) (initget 6) (setq tmp4 (getreal (strcat "\nSpecify Inner Circle Radius <" (rtos cut:cir) "> : "))) (or (not tmp4) (setq cut:cir tmp4)) (setq bsRad (- (cdr (assoc 40 (entget cEnt))) cut:out cut:cir) cCen (cdr (assoc 10 (entget cEnt)))) ;; Main Loop (while (and (not (minusp bsRad)) (< cut:cir bsRad)) (setq cNum (fix (/ (* 2 pi bsRad) (+ (* 2 cut:cir) cut:spc))) cAng (/ (* 2 pi) cNum) i 0) ;; Secondary Loop (while (< i cNum) (write-line "CIRCLE,X ABS,Y ABS" ofile) (vla-put-color (vla-addCircle spc (vlax-3D-point (setq cPt (polar cCen (+ (/ pi 2.) (* i cAng)) bsRad))) cut:cir) col) (vla-addPoint spc (vlax-3D-point cPt)) (setq tNum (1+ tNum) cCnt (1+ cCnt) AbcPt (mapcar '- cPt cCen)) (write-line (strcat (itoa row) "--" (rtos cCnt 2 0) (chr 44) (rtos (car AbcPt)) (chr 44) (rtos (cadr AbcPt))) ofile) (write-line "POINTS,X ABS,Y ABS,X INC,Y INC" ofile) (setq theta (atan (/ (/ 0.025 cut:cir) (sqrt (- 1. (expt (/ 0.025 cut:cir) 2)))))) (foreach x (setq cPtlst (list (cons "A" (polar cPt (+ (/ pi 2) (* i cAng)) cut:cir)) (cons "B" (polar cPt (+ (/ pi 2) (- (* i cAng) (/ (+ pi cAng) 2.))) cut:cir)) (cons "C" (polar cPt (+ (/ pi 2) (* i cAng) pi theta) cut:cir)) (cons "D" (polar cPt (+ (/ pi 2) (- (+ (* i cAng) pi) theta)) cut:cir)) (cons "E" (polar cPt (+ (/ pi 2) (* i cAng) (/ (+ pi cAng) 2.)) cut:cir)))) (vla-addPoint spc (vlax-3D-point (cdr x))) (setq AbRefpt (mapcar '- (cdr x) cCen) InRefpt (mapcar '- (cdr x) cPt)) (write-line (strcat (car x) (chr 44) (rtos (car AbRefpt)) (chr 44) (rtos (cadr AbRefpt)) (chr 44) (rtos (car InRefpt)) (chr 44) (rtos (cadr InRefpt))) ofile)) (setq i (1+ i))) (setq bsRad (- bsRad (* 2 cut:cir) cut:row) col (abs (- col 3)) row (1+ row) cCnt 0.)) (princ (strcat "\n<< Number of Circles: " (rtos tNum 2 0) " >>")) (close ofile)) (princ "\n<!> Incorrect Selection <!>")) (princ)) Quote
TheNewGuy Posted May 22, 2009 Author Posted May 22, 2009 That's it! You are AMAZING:D You should change your name to "the Amazing Lee Mac"! At the beginning of all this I really did not think we could get this done. But I shall never doubt your powers again. I hope some day I've got half your skills. How long have you been doing this? Any way, thank you so much for your time and all your hard work. Today is the beginning of memorial day weekend for us on this side of the pond, so if you have an extended weekend too be sure to enjoy it! You have earned it! If anyone asks I'll be sure to tell them Lee Mac is the MAN! Thanks again, have a good weekend. And next week I plan to start learning lisp programing, I am sure I'll need your help. Quote
Lee Mac Posted May 22, 2009 Posted May 22, 2009 That's it! You are AMAZING:D You should change your name to "the Amazing Lee Mac"! At the beginning of all this I really did not think we could get this done. But I shall never doubt your powers again. I hope some day I've got half your skills. How long have you been doing this? Any way, thank you so much for your time and all your hard work. Today is the beginning of memorial day weekend for us on this side of the pond, so if you have an extended weekend too be sure to enjoy it! You have earned it! If anyone asks I'll be sure to tell them Lee Mac is the MAN! Thanks again, have a good weekend. And next week I plan to start learning lisp programing, I am sure I'll need your help. Many thanks for your kind words NewGuy Its always great to hear that a LISP you wrote is going to be put to good use, it offers a sense of pride; and its great when the user is so appreciative of the time and effort thats gone into making it I have been learning LISP (and yes, I still have a LOT to learn!), for around 9 months or so now, on and off, I write more now than I did 9 months ago, and the learning curve just gets steeper and steeper If you want to learn LISP yourself, its very accessible to learn, although there is quite a lot of info to take in when you first get started. As a bit of advice to you, if you are seriously thinking about delving into the world of programming (it gets very addictive, very quickly...), then I would start by visiting a few of the tutorial sites referenced on this site - my favourite would be "JefferySanders" (as this is where I first learnt). I used to write my LISPs in Notepad, but I would now recommend using the Visual LISP Editor as provided with AutoCAD (type VLIDE at the command line, go to File > New File, and you're off!). The help files provided in the VLIDE are indispensible when you are learning, and there is a wealth of information at your fingertips. But, by far the best way to learn LISP would be to dissect and analyse the code posted by others on this site, or any other site that offers AutoLISP programming. But, as a word of warning, be aware of which user's code you are learning from, as there will be some that don't follow "good programming practice" and may lead you into bad habits - but most on here are pretty good at it. And, of course, if you have any queries whatsoever, (which I am sure you will), just either post a thread on here, or PM me if you like with a quick question and I'd be happy to answer it for you (if I can!). Anyway, thank you for your praise and kind words, and no doubt our paths will cross again in the near future. Cheers Lee Quote
TheNewGuy Posted May 27, 2009 Author Posted May 27, 2009 Hello Lee Mac, I may have a request for a possible modification to our program. I have been reading some programing tutorials and I noticed that there might be a way to make the table record up to 5 decimal places instead of 4.(The EDM machine actually uses 5 places) I did not think this was possible so I did not ask for it before. Is this possible? Is it difficult? Did you use (getvar "LUPREC")? if so I could create a user template that is set for 5 decimal places in auto cad and use that template when I use your program. Please let me know what you think when you get a chance. Thank you for your time. Quote
Lee Mac Posted May 27, 2009 Posted May 27, 2009 Hello Lee Mac, I may have a request for a possible modification to our program. I have been reading some programing tutorials and I noticed that there might be a way to make the table record up to 5 decimal places instead of 4.(The EDM machine actually uses 5 places) I did not think this was possible so I did not ask for it before. Is this possible? Is it difficult? Did you use (getvar "LUPREC")? if so I could create a user template that is set for 5 decimal places in auto cad and use that template when I use your program. Please let me know what you think when you get a chance. Thank you for your time. This is very simple and easy to do - you can make it display up to 15 decimal places in fact. I shall take a look at it, and highlight what I have changed. Quote
Lee Mac Posted May 27, 2009 Posted May 27, 2009 Give this a shot (untested): (defun c:cCut (/ dp doc spc ofile cCnt tNum col row tmp1 tmp2 tmp3 tmp4 bsRad cCen cNum cAng i cPt AbcPt theta cPtlst AbRefpt InRefpt) (vl-load-com) [b][color=Red] (setq dp 15) ;; <<-- Decimal Precision[/color][/b] (setq doc (vla-get-ActiveDocument (vlax-get-Acad-Object)) spc (if (zerop (vla-get-activespace doc)) (if (= (vla-get-mspace doc) :vlax-true) (vla-get-modelspace doc) (vla-get-paperspace doc)) (vla-get-modelspace doc))) (setvar "PDMODE" 3) ; Point Style (setvar "PDSIZE" 0.01) ; Point Size ;; Default Retrieval (or cut:out (setq cut:out 0.05)) (or cut:spc (setq cut:spc 0.007)) (or cut:row (setq cut:row 0.02)) (or cut:cir (setq cut:cir 0.125)) [b][color=Red] (or (not (and (<= 0 dp 15) (eq 'INT (type dp)))) (setq dp 4))[/color][/b] ;; Circle Selection (if (and (setq cEnt (car (entsel "\nSelect Base Circle: "))) (eq "CIRCLE" (cdr (assoc 0 (entget cEnt))))) (progn (setq ofile (open (strcat (getvar "DWGPREFIX") (substr (getvar "DWGNAME") 1 (- (strlen (getvar "DWGNAME")) 4)) ".csv") "w") cCnt 0. tNum 0. col 1 row 1) ;; User Input (initget 4) (setq tmp1 (getreal (strcat "\nSpecify Spacing from Edge <" (rtos cut:out) "> : "))) (or (not tmp1) (setq cut:out tmp1)) (initget 4) (setq tmp2 (getreal (strcat "\nSpecify Circle Spacing <" (rtos cut:spc) "> : "))) (or (not tmp2) (setq cut:spc tmp2)) (initget 4) (setq tmp3 (getreal (strcat "\nSpecify Row Spacing <" (rtos cut:row) "> : "))) (or (not tmp3) (setq cut:row tmp3)) (initget 6) (setq tmp4 (getreal (strcat "\nSpecify Inner Circle Radius <" (rtos cut:cir) "> : "))) (or (not tmp4) (setq cut:cir tmp4)) (setq bsRad (- (cdr (assoc 40 (entget cEnt))) cut:out cut:cir) cCen (cdr (assoc 10 (entget cEnt)))) ;; Main Loop (while (and (not (minusp bsRad)) (< cut:cir bsRad)) (setq cNum (fix (/ (* 2 pi bsRad) (+ (* 2 cut:cir) cut:spc))) cAng (/ (* 2 pi) cNum) i 0) ;; Secondary Loop (while (< i cNum) (write-line "CIRCLE,X ABS,Y ABS" ofile) (vla-put-color (vla-addCircle spc (vlax-3D-point (setq cPt (polar cCen (+ (/ pi 2.) (* i cAng)) bsRad))) cut:cir) col) (vla-addPoint spc (vlax-3D-point cPt)) (setq tNum (1+ tNum) cCnt (1+ cCnt) AbcPt (mapcar '- cPt cCen)) (write-line (strcat (itoa row) "--" (rtos cCnt 2 0) (chr 44) ([color=Red]rtos (car AbcPt) 2 dp[/color]) (chr 44) ([color=Red]rtos (cadr AbcPt) 2 dp[/color])) ofile) (write-line "POINTS,X ABS,Y ABS,X INC,Y INC" ofile) (setq theta (atan (/ (/ 0.025 cut:cir) (sqrt (- 1. (expt (/ 0.025 cut:cir) 2)))))) (foreach x (setq cPtlst (list (cons "A" (polar cPt (+ (/ pi 2) (* i cAng)) cut:cir)) (cons "B" (polar cPt (+ (/ pi 2) (- (* i cAng) (/ (+ pi cAng) 2.))) cut:cir)) (cons "C" (polar cPt (+ (/ pi 2) (* i cAng) pi theta) cut:cir)) (cons "D" (polar cPt (+ (/ pi 2) (- (+ (* i cAng) pi) theta)) cut:cir)) (cons "E" (polar cPt (+ (/ pi 2) (* i cAng) (/ (+ pi cAng) 2.)) cut:cir)))) (vla-addPoint spc (vlax-3D-point (cdr x))) (setq AbRefpt (mapcar '- (cdr x) cCen) InRefpt (mapcar '- (cdr x) cPt)) (write-line (strcat (car x) (chr 44) ([color=Red]rtos (car AbRefpt) 2 dp[/color]) (chr 44) ([color=Red]rtos (cadr AbRefpt) 2 dp[/color]) (chr 44) ([color=Red]rtos (car InRefpt) 2 dp[/color]) (chr 44) ([color=Red]rtos (cadr InRefpt) 2 dp[/color])) ofile)) (setq i (1+ i))) (setq bsRad (- bsRad (* 2 cut:cir) cut:row) col (abs (- col 3)) row (1+ row) cCnt 0.)) (princ (strcat "\n<< Number of Circles: " (rtos tNum 2 0) " >>")) (close ofile)) (princ "\n<!> Incorrect Selection <!>")) (princ)) Quote
TheNewGuy Posted May 27, 2009 Author Posted May 27, 2009 I believe it is still giving 4 places after the decimal. Unless I am doing something wrong....Do I need to change my settings for precision, like I mentioned above? --edit-- I tried increasing the units precision to 5 places and that did not change anything either. Quote
Lee Mac Posted May 27, 2009 Posted May 27, 2009 I believe it is still giving 4 places after the decimal. Unless I am doing something wrong....Do I need to change my settings for precision, like I mentioned above? --edit-- I tried increasing the units precision to 5 places and that did not change anything either. Oops, my logic gone wrong: (defun c:cCut (/ dp doc spc ofile cCnt tNum col row tmp1 tmp2 tmp3 tmp4 bsRad cCen cNum cAng i cPt AbcPt theta cPtlst AbRefpt InRefpt) (vl-load-com) (setq dp 15) ;; <<-- Decimal Precision (setq doc (vla-get-ActiveDocument (vlax-get-Acad-Object)) spc (if (zerop (vla-get-activespace doc)) (if (= (vla-get-mspace doc) :vlax-true) (vla-get-modelspace doc) (vla-get-paperspace doc)) (vla-get-modelspace doc))) (setvar "PDMODE" 3) ; Point Style (setvar "PDSIZE" 0.01) ; Point Size ;; Default Retrieval (or cut:out (setq cut:out 0.05)) (or cut:spc (setq cut:spc 0.007)) (or cut:row (setq cut:row 0.02)) (or cut:cir (setq cut:cir 0.125)) [b][color=Red] (or (and (<= 0 dp 15) (eq 'INT (type dp))) (setq dp 4))[/color][/b] ;; Circle Selection (if (and (setq cEnt (car (entsel "\nSelect Base Circle: "))) (eq "CIRCLE" (cdr (assoc 0 (entget cEnt))))) (progn (setq ofile (open (strcat (getvar "DWGPREFIX") (substr (getvar "DWGNAME") 1 (- (strlen (getvar "DWGNAME")) 4)) ".csv") "w") cCnt 0. tNum 0. col 1 row 1) ;; User Input (initget 4) (setq tmp1 (getreal (strcat "\nSpecify Spacing from Edge <" (rtos cut:out) "> : "))) (or (not tmp1) (setq cut:out tmp1)) (initget 4) (setq tmp2 (getreal (strcat "\nSpecify Circle Spacing <" (rtos cut:spc) "> : "))) (or (not tmp2) (setq cut:spc tmp2)) (initget 4) (setq tmp3 (getreal (strcat "\nSpecify Row Spacing <" (rtos cut:row) "> : "))) (or (not tmp3) (setq cut:row tmp3)) (initget 6) (setq tmp4 (getreal (strcat "\nSpecify Inner Circle Radius <" (rtos cut:cir) "> : "))) (or (not tmp4) (setq cut:cir tmp4)) (setq bsRad (- (cdr (assoc 40 (entget cEnt))) cut:out cut:cir) cCen (cdr (assoc 10 (entget cEnt)))) ;; Main Loop (while (and (not (minusp bsRad)) (< cut:cir bsRad)) (setq cNum (fix (/ (* 2 pi bsRad) (+ (* 2 cut:cir) cut:spc))) cAng (/ (* 2 pi) cNum) i 0) ;; Secondary Loop (while (< i cNum) (write-line "CIRCLE,X ABS,Y ABS" ofile) (vla-put-color (vla-addCircle spc (vlax-3D-point (setq cPt (polar cCen (+ (/ pi 2.) (* i cAng)) bsRad))) cut:cir) col) (vla-addPoint spc (vlax-3D-point cPt)) (setq tNum (1+ tNum) cCnt (1+ cCnt) AbcPt (mapcar '- cPt cCen)) (write-line (strcat (itoa row) "--" (rtos cCnt 2 0) (chr 44) (rtos (car AbcPt) 2 dp) (chr 44) (rtos (cadr AbcPt) 2 dp)) ofile) (write-line "POINTS,X ABS,Y ABS,X INC,Y INC" ofile) (setq theta (atan (/ (/ 0.025 cut:cir) (sqrt (- 1. (expt (/ 0.025 cut:cir) 2)))))) (foreach x (setq cPtlst (list (cons "A" (polar cPt (+ (/ pi 2) (* i cAng)) cut:cir)) (cons "B" (polar cPt (+ (/ pi 2) (- (* i cAng) (/ (+ pi cAng) 2.))) cut:cir)) (cons "C" (polar cPt (+ (/ pi 2) (* i cAng) pi theta) cut:cir)) (cons "D" (polar cPt (+ (/ pi 2) (- (+ (* i cAng) pi) theta)) cut:cir)) (cons "E" (polar cPt (+ (/ pi 2) (* i cAng) (/ (+ pi cAng) 2.)) cut:cir)))) (vla-addPoint spc (vlax-3D-point (cdr x))) (setq AbRefpt (mapcar '- (cdr x) cCen) InRefpt (mapcar '- (cdr x) cPt)) (write-line (strcat (car x) (chr 44) (rtos (car AbRefpt) 2 dp) (chr 44) (rtos (cadr AbRefpt) 2 dp) (chr 44) (rtos (car InRefpt) 2 dp) (chr 44) (rtos (cadr InRefpt) 2 dp)) ofile)) (setq i (1+ i))) (setq bsRad (- bsRad (* 2 cut:cir) cut:row) col (abs (- col 3)) row (1+ row) cCnt 0.)) (princ (strcat "\n<< Number of Circles: " (rtos tNum 2 0) " >>")) (close ofile)) (princ "\n<!> Incorrect Selection <!>")) (princ)) Quote
TheNewGuy Posted May 27, 2009 Author Posted May 27, 2009 That did it! So it looks like I could change (setq dp 15) ;; To whatever precision I would like. Is that correct? Quote
Lee Mac Posted May 27, 2009 Posted May 27, 2009 That did it! So it looks like I could change To whatever precision I would like. Is that correct? yes, I thought it best to keep it all to one place - so that you didn't have to go digging around the code to change it Quote
TheNewGuy Posted May 27, 2009 Author Posted May 27, 2009 Great! thank you! The EDM operator should be real happy now! Thanks again for all your help. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.