Hi Scott,
Very nice program, works well. I was trying to adapt it a little to draw a spline and the leader in one step, so I won't have to draw the spline and then to run the program to select the spline to turn it into a leader. Unfortunately, I wasn't able to do that. Do you think you could help? I appreciate it.
@Anonymous wrote:
Very nice program, works well. I was trying to adapt it a little to draw a spline and the leader in one step, so I won't have to draw the spline and then to run the program to select the spline to turn it into a leader. Unfortunately, I wasn't able to do that. Do you think you could help? I appreciate it.
What version do you have? Does it not have the Spline option in the Leader or Qleader command? In the Leader command, for some unknown reason it's after you've given it the second point that you get the Format option, within which is the Spline option. In Qleader, call for Settings. There may be other possible ways to get at it, depending on version.
I have AutoCAD 2011. I don't use Leader command at all and I didn't want to change the Settings in QLeader because I'm using Qleader (LE) for straight leaders more often than spline leaders. I was looking for a separate LISP program for spline leaders and I like Jim Claypool's, but works in two steps, one to draw the spline and second to run the program to add the arrow to it. It's not bad but I think it can be improved, adding some code to draw the spline inside the program and then to be selected automatically and turned into a leader. My LISP skills are pretty poor and I couldn't make it but I don't think it would be difficult for someone with good LISP skills to edit the program. I spent lots of time and I just couldn;t make it work.
Thank you for your reply.
How about something as simple as this:
(defun C:SLDR (); = Spline LeaDeR
(command "_.leader" pause pause "_format" "_spline")
)
It works nicely but I avoid using leaders because they prompt for adding text at the end of the command and it's "difficult" to exit the command without adding text. I move text around and I draw leaders after the text. I get more flexibility this way. That's why I prefer QLeaders over Leaders.
This is Jim Claypool's program in an easier legible form. I added a line to delete the last object, it drew a pline over the original spline. If you could take a quick look and see a way of adding code for drawing a spline inside the program would be nice.
Thank you for your help anyway, Master Cooper!
(defun c:sple () ;;SPlineLEader
(setq ename (car (entsel "\nSelect spline: ")))
(setq ptlist nil)
(setq ecnt 0 elen (length (entget ename)))
(while (< ecnt elen) (setq element (nth ecnt (entget ename)))
(if (equal (car element) 10) (setq ptlist (cons (cdr element) ptlist)) );end setq
(setq ecnt (1+ ecnt)) );end while
(setq ptlist (reverse ptlist))
(command ".leader")
(foreach x ptlist (command x) )
(command "" "o" ""
".erase" (entlast) ""
".explode" (entlast)
".pedit" (entlast) "spline" "" )
(command "erase" "L" "") ;added
(princ)
)
@Anonymous wrote:.... I avoid using leaders because they prompt for adding text at the end of the command and it's "difficult" to exit the command without adding text. ....
That's not what's difficult, in my opinion. This will do that part quite handily:
(defun C:test (/ pt)
(command "_.leader" pause pause "_format" "_spline")
(while (setq pt (getpoint (getvar 'lastpoint) "\nSpecify next point: "))
(command pt); feed out to Leader command
); end while [loop ended by Enter/space instead of picking point]
(command "" "" "_none")
)
The difficult [maybe impossible?] part, in my trials, is to get it to show you the Leader under construction along the way. The above collects points, and afterwards builds a spline-format Leader, with no text, based on them. I tried various things in an attempt to see it in progress, but so far without success.
It works fine, you made it look easy. It's an ingenious solution. This comes very close to what I am looking for. Of course, in theory it would be better to see the leader under construction along the way but that's not really an issue. Practically, it works fine, it's easy to predict what it would look like, it's usually made of 3-4 points. I'll start using it today.
I appreciate it, thank you Master Cooper.
@Anonymous wrote:It works fine, you made it look easy. It's an ingenious solution. This comes very close to what I am looking for. Of course, in theory it would be better to see the leader under construction along the way but that's not really an issue. Practically, it works fine, it's easy to predict what it would look like, it's usually made of 3-4 points. I'll start using it today.
I appreciate it, thank you Master Cooper.
You're welcome. If, like me, you draw with Blipmode on, you can at least see the points you've picked, and get a pretty good feel for what the Leader is going to look like, as you go.
I don't draw with BLIPMODE on, but you gave me the idea to turn it on for this program only and then go back to BLIPMODE off.
(defun C:Test (/ pt)
(setq blipmode (getVAR "BLIPMODE"));; this is 0 usually
(defun *error* (msg)
(princ msg)
(setvar "BLIPMODE" blipmode)
;(setvar "BLIPMODE" 0)
(princ))
(setvar "BLIPMODE" 1)
(command "_.leader" pause pause "_format" "_spline")
(while (setq pt (getpoint (getvar 'lastpoint) "\nSpecify next point: "))
(command pt); feed out to Leader command
); end while [loop ended by Enter/space instead of picking point]
(command "" "" "_none")
;; (setvar "BLIPMODE" 0) ;reset BLIPMODE
(setvar "BLIPMODE" blipmode) ;reset BLIPMODE- this should be 0
)
The thing is if I hit ESC repetitively after I pick a few points BLIPMODE doesn't reset to 0 (which I expect) but stays on. I guess it's not an error so the error code doesn't run and the last line of code that resets the BLIPMODE to initail value (which is 0) doesn't run either. Would you know how to fix that?
Hi,
you could try something like:
(defun c:test ()
(setvar "cmdecho" 1) (setvar "nomutt" 0)
(command "_.leader" pause pause "_format" "_spline" pause) (terpri)
(while
(and
(/= (getvar "cmdactive") 0)
(/= (getvar "LASTPROMPT") "Enter first line of annotation text or <options>:")
)
(command pause) (terpri)
)
(command "" "_none")
(princ)
)
Ian
Can't find what you're looking for? Ask the community or share your knowledge.