Lee Mac Posted November 24, 2010 Posted November 24, 2010 Simple example, uses the information I posted in post#2. (defun c:lazy nil (entmakex (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 90 2) (cons 70 0) (list 10 1 0) (cons 42 (/ (sin (/ pi 16.)) (cos (/ pi 16.)))) (list 10 (/ (sqrt 2) 2.) (/ (sqrt 2) 2.)) ) ) ) Quote
Michaels Posted November 27, 2010 Author Posted November 27, 2010 (edited) How did you get on Michaels? Thanks Lee . It's very kind of you to follow up with me to get my codes running well , and to be able to understand the procedures of functions. I have changed the way of my routine structure , since that Polyline entmakex is difficult to understan and to deal with. ** edit ** codes removed because it's not useful at the moment . Many thanks. Michaels Edited November 28, 2010 by Michaels Quote
Lee Mac Posted November 27, 2010 Posted November 27, 2010 (defun c:elb ( / UCSZ pt di r c b ) (setq UCSZ (trans '(0. 0. 1.) 1 0 t)) (if (and (setq pt (getpoint "\nInsertion: ")) (setq di (getdist "\nElbow Diameter: ")) ) (progn (setq r (/ di 2.) c (polar pt pi (* 1.5 di)) b (/ (sin (/ pi 16.)) (cos (/ pi 16.)))) (entmakex (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 90 4) (cons 70 1) (cons 10 (trans (polar pt pi r) 1 UCSZ)) (cons 10 (trans (polar pt 0 r) 1 UCSZ)) (cons 42 b) (cons 10 (trans (polar c (/ pi 4.) (* 2. di)) 1 UCSZ)) (cons 10 (trans (polar c (/ pi 4.) di) 1 UCSZ)) (cons 42 (- b)) (cons 210 UCSZ) ) ) ) ) (princ) ) Quote
The Buzzard Posted November 27, 2010 Posted November 27, 2010 (defun c:elb ( / UCSZ pt di r c b ) (setq UCSZ (trans '(0. 0. 1.) 1 0 t)) (if (and (setq pt (getpoint "\nInsertion: ")) (setq di (getdist "\nElbow Diameter: ")) ) (progn (setq r (/ di 2.) c (polar pt pi (* 1.5 di)) b (/ (sin (/ pi 16.)) (cos (/ pi 16.)))) (entmakex (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 90 4) (cons 70 1) (cons 10 (trans (polar pt pi r) 1 UCSZ)) (cons 10 (trans (polar pt 0 r) 1 UCSZ)) (cons 42 b) (cons 10 (trans (polar c (/ pi 4.) (* 2. di)) 1 UCSZ)) (cons 10 (trans (polar c (/ pi 4.) di) 1 UCSZ)) (cons 42 (- b)) (cons 210 UCSZ) ) ) ) ) (princ) ) Wow! That was easy! Quote
Michaels Posted November 28, 2010 Author Posted November 28, 2010 (defun c:elb ( / UCSZ pt di r c b ) (setq UCSZ (trans '(0. 0. 1.) 1 0 t)) (if (and (setq pt (getpoint "\nInsertion: ")) (setq di (getdist "\nElbow Diameter: ")) ) (progn (setq r (/ di 2.) c (polar pt pi (* 1.5 di)) b (/ (sin (/ pi 16.)) (cos (/ pi 16.)))) (entmakex (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 90 4) (cons 70 1) (cons 10 (trans (polar pt pi r) 1 UCSZ)) (cons 10 (trans (polar pt 0 r) 1 UCSZ)) (cons 42 b) (cons 10 (trans (polar c (/ pi 4.) (* 2. di)) 1 UCSZ)) (cons 10 (trans (polar c (/ pi 4.) di) 1 UCSZ)) (cons 42 (- b)) (cons 210 UCSZ) )))) (princ) ) I hope that one day I could handle things like that in the near future . Many thanks. Michaels Quote
Lee Mac Posted November 28, 2010 Posted November 28, 2010 (edited) You're very welcome Michaels Disregarding the elements coded for UCS compatibility, (i.e. the appearance of the trans function), the calculation of the vertex positions is perhaps the only other slightly difficult part of the code. I therefore hope this diagram clears things in your mind: The vertices in the diagram are numbered in the same order as they are specified in the program, and the same variable names are used in the dimensions. If you have any further questions about the diagram or code, just ask and I'll be happy to help clarify some more. Lee Edited November 28, 2010 by Lee Mac Quote
Michaels Posted November 28, 2010 Author Posted November 28, 2010 That's really great and wonderful. Now the idea is very clear to me , and all the favour back to your generous hard work for me. I did not image that I could understand these kinds of complicated series of actions one day , but all because of your great favour to me. Thanks Gentleman Lee . you're amazing. Appreciated. Michaels Quote
The Buzzard Posted November 28, 2010 Posted November 28, 2010 You're very welcome Michaels Disregarding the elements coded for UCS compatibility, (i.e. the appearance of the trans function), the calculation of the vertex positions is perhaps the only other slightly difficult part of the code. I therefore hope this diagram clears things in your mind: [ATTACH]24841[/ATTACH] The vertices in the diagram are numbered in the same order as they are specified in the program, and the same variable names are used in the dimensions. If you have any further questions about the diagram or code, just ask and I'll be happy to help clarify some more. Lee That is a very detailed explaination Lee, Great job. Quote
Lee Mac Posted November 28, 2010 Posted November 28, 2010 That is a very detailed explaination Lee, Great job. Thanks Buzzard Quote
The Buzzard Posted November 28, 2010 Posted November 28, 2010 Thanks Buzzard I remember about 3 years ago at another forum, I was writting command call programs and someone did not understand it. I did the same thing you did and it went off like a light in his head. I guess it true that a picture speaks a thousand words. Quote
Lee Mac Posted November 28, 2010 Posted November 28, 2010 I guess it true that a picture speaks a thousand words. Definitely - and it's independent of language barriers 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.