au-s Posted October 7, 2010 Posted October 7, 2010 Hi, I have this part of the lisp that makes a leader. I use ACAD 2008/2010. it works for me but when I execute it at another desktop here in the office, it doesn't work. It behaves like, it asks for the three points as in the lisp but then stops when the text is about to be entered. Why is it working for me but not for him. We use the same desktops, same ACADs. Really strange. Is there some option in the settings that prevent that leader to be succesfully executed? here is the codE: (defun leader(/ p1 p2 p3) (setq p1 (getpoint "\nstart point: ") p2 (getpoint p1 "\nsecond point: ") ) (grdraw p1 p2 1 1) (setq p3 (getpoint p2 "\ntext: ")) (command "_leader" p1 p2 p3 "" "" "" "") (redraw) ) Quote
Michaels Posted October 7, 2010 Posted October 7, 2010 You'd better change the setting of the leader to 2points or much better to include that among your codes to let it run normally in all other Cad leader settings. Good luck. Quote
BlackBox Posted October 7, 2010 Posted October 7, 2010 (edited) According to the code you've posted, this *should* be all you need: (defun c:FOO (/ p1 p2) (if (setq p1 (getpoint "\n >> Specify Start Point: ")) (progn (setq p2 (getpoint p1 "\n >> Specify End Point: ")) (command "._leader" p1 p2 "" pause))) (princ)) Edited October 7, 2010 by BlackBox Quote
Michaels Posted October 7, 2010 Posted October 7, 2010 Nice work Renderman. But the name of the routine is one of cad's standard commnands.and when loading the routine, cad would start with cad's command and according to what I have mentioned earlier, the routine would also consider Cad's commands settings first, so if number of points for Qleader is toggled to no limits so the qleader won't stop for inserting texts at all. here is mine if you would like to use . (defun c:LEAD (/ p1 p2) (if (and (setq p1 (getpoint "\n Specify Start Point: ")) (setq p2 (getpoint p1 "\n Specify End Point: ")) ) (command "._leader" p1 p2 "" pause)) (princ) ) Thanks Quote
BlackBox Posted October 7, 2010 Posted October 7, 2010 the name of the routine is one of cad's standard commnands. Thanks for pointing that out, it was an oversight on my part. The code has been corrected in my earlier post. Quote
Lee Mac Posted October 7, 2010 Posted October 7, 2010 Not sure if you need text or not, but my entry: (defun c:test ( / p1 p2 ) (vl-load-com) (if (and (setq p1 (getpoint "\nPick First Point: ")) (setq p2 (getpoint "\nPick Next Point: " p1)) ) (vlax-invoke (vlax-get (vla-get-ActiveDocument (vlax-get-acad-object)) (if (= 1 (getvar 'CVPORT)) 'PaperSpace 'ModelSpace) ) 'AddMLeader (append p1 p2) 0 ) ) (princ) ) Quote
stevesfr Posted October 7, 2010 Posted October 7, 2010 Not sure if you need text or not, but my entry: (defun c:test ( / p1 p2 ) (vl-load-com) (if (and (setq p1 (getpoint "\nPick First Point: ")) (setq p2 (getpoint "\nPick Next Point: " p1)) ) (vlax-invoke (vlax-get (vla-get-ActiveDocument (vlax-get-acad-object)) (if (= 1 (getvar 'CVPORT)) 'PaperSpace 'ModelSpace) ) 'AddMLeader (append p1 p2) 0 ) ) (princ) ) Lee, here the "tail" of the leader always goes to the left, even when the slope of the leader is to the right. I assume I have something screwed up, or is there a bug in the prog ? Steve Quote
Lee Mac Posted October 7, 2010 Posted October 7, 2010 Lee, here the "tail" of the leader always goes to the left, even when the slope of the leader is to the right.I assume I have something screwed up, or is there a bug in the prog ? Steve Its very simple code Steve - just coded to create the leader object. If the user were to pursue this route, they would have to modify the leader to add text/change dogleg direction etc. I could add some more code to it, but I'll see which way the OP wants to proceed first. Quote
irneb Posted October 7, 2010 Posted October 7, 2010 Uhmm Lee ... that creates an MLeader. The OP wanted an old type QLeader. Not that I don't like MLeaders, but some want the older type due to some features not being easy with MLeaders. If you want to create the Leader entity through vla-AddLeader, you'd first need to create the MText entity then use that as an argument to the AddLeader method. Or add it to the leader's Annotation property afterward. Quote
alanjt Posted October 7, 2010 Posted October 7, 2010 Two or three leader points with MText annotation prompt: (defun c:Test (/ p1 p2 p3) (if (and (setq p1 (getpoint "\nSpecify leader starting point: ")) (setq p2 (getpoint p1 "\nSpecify next point: ")) ) (progn (grdraw p1 p2 7 1) (setq p3 (getpoint p2 "\nSpecify next point <Annotation>: ")) (redraw) (initdia) (if p3 (command "_.leader" "_non" p1 "_non" p2 "_non" p3 "_A" "" "_M" "") (command "_.leader" "_non" p1 "_non" p2 "_A" "" "_M" "") ) ) ) (princ) ) 1 Quote
Michaels Posted October 7, 2010 Posted October 7, 2010 Mr. Alan. Could you please tell why did you use the (initdia) since won't be any dialog to show with the leader command ? Thanks Quote
alanjt Posted October 7, 2010 Posted October 7, 2010 Mr. Alan. Could you please tell why did you use the (initdia) since won't be any dialog to show with the leader command ? Thanks It's to initiate the MText editor (dialog). Part of the Leader command. eg. Command: leader Specify leader start point: Specify next point: Specify next point or [Annotation/Format/Undo] <Annotation>: a Enter first line of annotation text or <options>: Enter an annotation option [Tolerance/Copy/Block/None/[color=red]Mtext] <Mtext>: [/color]m Quote
Michaels Posted October 7, 2010 Posted October 7, 2010 That's really nice, I've forgotten about that Mtext dialog . Thank you so much. Quote
alanjt Posted October 7, 2010 Posted October 7, 2010 That's really nice, I've forgotten about that Mtext dialog . Thank you so much. I've never actually used Leader; QLeader was around in r14 (when I started) and I just used that (much better) and the newly introduced (as of 2008) MLeader. Quote
Akashak Posted September 1, 2023 Posted September 1, 2023 Can anyone give me a example for a leader lisp expression that has two points to draw and change the arrow head type as dot blank Quote
ronjonp Posted September 1, 2023 Posted September 1, 2023 10 hours ago, Akashak said: Can anyone give me a example for a leader lisp expression that has two points to draw and change the arrow head type as dot blank Create an mleader style with dot blank as the arrow type then set it current like so: (setvar 'cmleaderstyle "YourStyleName") Quote
catoscuro Posted September 4, 2023 Posted September 4, 2023 (defun c:FA ;| FlipArrows |; (/ Ent VlaObj ) (vl-load-com) (while (setq Ent (entsel "Select leader: " ) ) (progn (vl-load-com ) (setq VlaObj (vlax-ename->vla-object (car Ent )) ) (if (= (vla-get-objectName VlaObj ) "AcDbLeader") (cond ((= (vla-get-ArrowheadBlock VlaObj ) "" ) (vla-put-ArrowheadBlock VlaObj "Integral" ) ) ((= (vla-get-ArrowheadBlock VlaObj ) "Integral" ) (vla-put-ArrowheadBlock VlaObj "DotBlank" ) ) ((= (vla-get-ArrowheadBlock VlaObj ) "DotBlank" ) (vla-put-ArrowheadBlock VlaObj "_Dot" ) ) ((= (vla-get-ArrowheadBlock VlaObj ) "Dot" ) (vla-put-ArrowheadBlock VlaObj "DotSmall" ) ) ((= (vla-get-ArrowheadBlock VlaObj ) "DotSmall" ) (vla-put-ArrowheadBlock VlaObj "BoxBlank" ) ) ((= (vla-get-ArrowheadBlock VlaObj ) "BoxBlank" ) (vla-put-ArrowheadBlock VlaObj "ArchTick" ) ) ((= (vla-get-ArrowheadBlock VlaObj ) "ArchTick" ) (vla-put-ArrowheadBlock VlaObj "" ) ) ((= (vla-get-ArrowheadBlock VlaObj ) "" ) (vla-put-ArrowheadBlock VlaObj "" ) ) ((= (vla-get-ArrowheadBlock VlaObj ) "" ) (vla-put-ArrowheadBlock VlaObj "" ) ) ;; ((= (vla-get-ArrowheadBlock VlaObj ) "DotSmall" ) (vla-put-ArrowheadBlock VlaObj "" ) ) (t nil) ) (princ "..wrong object type ! " ) ) (if (not (vlax-object-released-p VlaObj )) (vlax-release-object VlaObj ) ( ) ) ) ) (princ) ) FA.LSP 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.