Michaels Posted August 28, 2010 Posted August 28, 2010 Hello. I know how to make normal arrow, but the main problem is that I do not know how to specify angles' degrees and lengths as well. So the main issue is the oblique angle and the length of the diagonal lines with its angles ? Thanks. (setq srartPT (getpoint "\nSpecify Start point of Arrow:") endPT (getpoint srartPT "\nSpecify End point of Arrow:") dist (distance srartPT endPT) wid (/ dist 3) Ang (angle srartPT endPT) p2 (polar endPT (+ Ang (/ pi 2)) wid) p3 (polar endPT (- Ang (/ pi 2)) wid) ) Quote
Lee Mac Posted August 29, 2010 Posted August 29, 2010 Perhaps this will give you a nudge in the right direction: (defun arrow ( p1 p2 norm / a d ) (setq a (angle p2 p1) d (distance p1 p2)) (entmakex (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 90 4) (cons 70 1) (cons 10 p1) (cons 10 (polar p2 (- a (/ (* 2 pi) 3)) d)) (cons 10 p2) (cons 10 (polar p2 (+ a (/ (* 2 pi) 3)) d)) (cons 210 norm) ) ) ) (defun c:test ( / a b norm ) (if (and (setq a (getpoint "\nPick First Point: ")) (setq b (getpoint "\nPick Second Point: " a))) (progn (setq norm (trans '(0. 0. 1.) 1 0 t) a (trans a 1 norm) b (trans b 1 norm) ) (arrow a b norm) ) ) (princ) ) Quote
Michaels Posted August 29, 2010 Author Posted August 29, 2010 Really Great. And a little bit complicated to me . May I ask you the meaning or the explaination of this part of yours please ? (setq norm (trans '(0. 0. 1.) 1 0 t) a (trans a 1 norm) b (trans b 1 norm) ) Thank you so much . Michaels. Quote
Lee Mac Posted August 29, 2010 Posted August 29, 2010 May I ask you the meaning or the explaination of this part of yours please ? (setq norm (trans '(0. 0. 1.) 1 0 t) a (trans a 1 norm) b (trans b 1 norm) ) This is to account for all UCS's and Views. The vertices of the LWPolyline are relative to its OCS, defined by its normal vector (dxf 210) which is defined in WCS. Hence we retrieve the normal vector of the current UCS: (trans '(0. 0. 1.) 1 0 t) i.e. What does the UCS vector '(0. 0. 1.) look like in WCS? Then we must transform the picked points from UCS to OCS: (trans a 1 norm) Lee Quote
Michaels Posted August 29, 2010 Author Posted August 29, 2010 Very nice . Why did you retrieve the ucs since that we could use the normal WCS ( I mean the Autocad default ucs) ? Like ; (trans a 1 0) What's the use of letter (t) at the end ? And number (1) instead of zero (0) ? (trans '(0. 0. 1.) 1 0 t) last question please. Why should we transform the picked points from UCS to OCS: (trans a 1 norm) Many Thanks Mr.Lee Quote
Lee Mac Posted August 29, 2010 Posted August 29, 2010 Why did you retrieve the ucs since that we could use the normal WCS ( I mean the Autocad default ucs) ? (trans a 1 0) Because this assumes that the UCS normal = WCS normal. What's the use of letter (t) at the end ? Read the help file on the 'trans' function, the 't' is the displacement flag indicating we are dealing with a vector argument. And number (1) instead of zero (0) ? (trans '(0. 0. 1.) 1 0 t) As from my last post: we are transforming the UCS normal vector to WCS, as the LWPolyline normal (dxf 210) is defined in WCS. Why should we transform the picked points from UCS to OCS: (trans a 1 norm) As from my last post: the LWPolyline vertices are defined in OCS not WCS. Quote
Michaels Posted August 29, 2010 Author Posted August 29, 2010 Thank you so much. I think I have to go back a little and read more weldly about trans function. Greatly appreciated. Regards. Quote
Lee Mac Posted August 29, 2010 Posted August 29, 2010 You're very welcome Michaels. The trans function aside (it is a big topic), do you now understand how to construct your arrow? Lee 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.