datalife Posted January 30, 2013 Posted January 30, 2013 Hello all, I have a lisp that draw arrow head. I find that is troublesome as I need to click at the head and tail of the arrow to form it. Is there any simple way to just click at the end of the line and form the arrow instantly; by modify the lisp or click a new lisp. Thanks arrow.lsp arrow.dwg Quote
Dadgad Posted January 30, 2013 Posted January 30, 2013 Is there a reason why you don't want to use a QLEADER for this, which includes the definition of an ARROWHEAD? In that way you just specify where you want the tip of your arrow to be, and then define where you want the other end of the line to be. Why use a lisp? Any arrow is going to define a vector of some sort, so I would expect to have to specify a second point in order to establish that rotation, at the least, if not length as well. Quote
datalife Posted January 30, 2013 Author Posted January 30, 2013 Hello Dadgad.....thanks for the reply But, my problems is.... I had thousands of pipe line that need to draw the gravity flow direction. Therefore, I need a lisp for this case. Thanks Quote
Dadgad Posted January 30, 2013 Posted January 30, 2013 Okay, fair enough. Perhaps you may find Lee Mac's LABEL lisp to be helpful. http://www.lee-mac.com/label.html As the arrows in your drawing are polylines, it looks like you will be just fine, with Lee's help. For those who are not familiar with Lee's site, check it out, there is an absolute gold mine of great lisps very generously made available by Lee to all. Thanks Lee! Quote
Tharwat Posted January 30, 2013 Posted January 30, 2013 Try this ..... (defun c:LWarrow (/ p1 p2) ;;; Tharwat 30. Jan. 2013 ;;; (if (and (setq p1 (getpoint "\n Specify first point :")) (setq p2 (getpoint "\n Specify next point :" p1)) ) (entmakex (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(90 . 3) '(70 . 0) (cons 10 p1) '(40 . 0.) (cons 41 (/ (distance p1 p2) 4.2)) '(42 . 0.) (cons 10 (polar p1 (angle p1 p2) (/ (distance p1 p2) 3.))) '(40 . 0.) '(41 . 0.) '(42 . 0.) (cons 10 p2) (cons 40 0.) (cons 41 (/ (distance p1 p2) 4.2)) '(42 . 0.) ) ) ) (princ) ) Quote
MSasu Posted January 30, 2013 Posted January 30, 2013 Alternatively may create the said arrow head as a block and insert it by your routine; this have the advantage that will allow you to modify at once the style (size, shape) if desired. Quote
Tharwat Posted January 30, 2013 Posted January 30, 2013 Alternatively may create the said arrow head as a block and insert it by your routine; this have the advantage that will allow you to modify at once the style (size, shape) if desired. Agreed . Quote
BIGAL Posted January 31, 2013 Posted January 31, 2013 Here is a start for a lips this adds circles to end of lines needs a couple of extra lines to get line angle using Assoc 11 for other end point, just change the command from circle to insert a block at end pt with a rotaion and scale. Only bug is will draw arrow in direction line is drawn in. Good time to learn lisp ? ; add a circle to end of lines for import into the DRAINS software (setq oldsnap (getvar "osmode")) (setvar "osmode" 0) (command "layer" "n" "PITS" "Color" 1 "PITS" "s" "PITS" "") (setq ent (car (entsel "\nSelect drain layer: "))) (setq l_name (cdr (assoc 8 (entget ent)))) (setq listlines (ssget "X" (list (cons 0 "line")(cons 8 l_name)))) (setq listlinesno (sslength listlines)) (setq y 0) (repeat listlinesno (setq pt1 (cdr (assoc 10 (entget (ssname listlines y))))) [color=red]; add pt2 here assoc 11 and angle pt1 pt2 [/color] (command "circle" pt1 1.0) [color=red]; change this to be insert arrowblock [/color] (setq y (+ y 1)) ) ;end repeat listlineno (setvar "osmode" oldsnap) Quote
datalife Posted February 1, 2013 Author Posted February 1, 2013 Hello again:) Oh ya....I search through previous thread and finally got what what i want on the arrow head by just simple click at the end of line. Only setback is sometimes it looks small .... can the lisp instruct user to input or change the scale. Someone please share Thanks guy.... ah.lsp Quote
MSasu Posted February 1, 2013 Posted February 1, 2013 The size of the arrow is controlled by the SC variable - you may add a scale factor to it: (setq SC [color=magenta](* 1.5 [/color](getvar "dimscale")[color=magenta])[/color]) ... (setq PT2 (polar EPT ANG1 (* SC 0.20))) ;set arrowhead length, based on current dimscale (setq PW (* SC 0.08)) ;set arrowhead width Quote
datalife Posted February 4, 2013 Author Posted February 4, 2013 Noted Msasu with thanks , I think I also can manually change using the DIMSCALE command. On second thought;is it possible to place the arrow head at the middle of the line instead of end by changing the lisp I have. Ha...ha newbie question?? Thanks Quote
MSasu Posted February 4, 2013 Posted February 4, 2013 I think I also can manually change using the DIMSCALE command. That' true, but please don't forget that by adjusting the said system variable you will influence more that just the routine. Quote
MSasu Posted February 4, 2013 Posted February 4, 2013 On second thought;is it possible to place the arrow head at the middle of theline instead of end by changing the lisp I have. Please adjust this part: ... ;if not - line angle in other direction ) ;_ end of if [color=magenta] (setvar "osmode" 0) (setq PL (* SC 0.20) PW (* SC 0.08)) ;set arrowhead width (setq PT1 (polar EPT ANG1 (/ (- (distance EPT1 EPT2) PL) 2.0))) (setq PT2 (polar PT1 ANG1 PL)) ;set arrowhead length, based on current dimscale (setvar "osmode" 0) (command "PLINE" PT1 "W" "0" PW PT2 "") ;draw arrowhead [/color] (setvar "OSMODE" XOSMODE) ... 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.