Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
*Scott Mcfarren
Message 1 of 16 (358 Views)

How convert a Spline to a curved leader

358 Views, 15 Replies
09-21-2004 01:51 PM
Does anybody have code to convert a spline or read its points so I can create a curved leader (with arrowhead) reasonably close ??? Thanks, Scott McFarren
*Jim Claypool
Message 2 of 16 (358 Views)

Re: How convert a Spline to a curved leader

09-21-2004 04:07 PM in reply to: *Scott Mcfarren
You can export it to an R12 dxf, open the dxf and save it as a drawing, then insert it into you original drawing exploded. "Scott Mcfarren" wrote in message news:415093f2$1_3@newsprd01... > Does anybody have code to convert a spline or read its points so I can > create > a curved leader (with arrowhead) reasonably close ??? > > Thanks, > > Scott McFarren > >
*Jim Claypool
Message 3 of 16 (358 Views)

Re: How convert a Spline to a curved leader

09-21-2004 04:34 PM in reply to: *Scott Mcfarren
This will get fairly close. There is no error checking and the arrowhead is separated from the leader when finished. (defun c:mkleader () (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" "" ) (princ) ) "Scott Mcfarren" wrote in message news:415093f2$1_3@newsprd01... > Does anybody have code to convert a spline or read its points so I can > create > a curved leader (with arrowhead) reasonably close ??? > > Thanks, > > Scott McFarren > >
*Scott Mcfarren
Message 4 of 16 (358 Views)

Re: How convert a Spline to a curved leader

09-22-2004 06:46 AM in reply to: *Scott Mcfarren
Thanks Jim. I'll give it a try. Scott "Jim Claypool" wrote in message news:4150ba6b$1_3@newsprd01... > This will get fairly close. > There is no error checking and > the arrowhead is separated from the leader when finished. > > (defun c:mkleader () > (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" "" > ) > (princ) > ) > > "Scott Mcfarren" wrote in message > news:415093f2$1_3@newsprd01... > > Does anybody have code to convert a spline or read its points so I can > > create > > a curved leader (with arrowhead) reasonably close ??? > > > > Thanks, > > > > Scott McFarren > > > > > >
Distinguished Contributor
Charliep
Posts: 163
Registered: ‎01-07-2004
Message 5 of 16 (358 Views)

Re: How convert a Spline to a curved leader

09-24-2004 02:16 PM in reply to: *Scott Mcfarren
Scott:

A2K4 does have an option under the Leader Line & Arrow TAB/ Leader Line, for a Spline Leader. Is this not what you want to be able to do?
Contributor
HS20EXR
Posts: 21
Registered: ‎06-12-2012
Message 6 of 16 (288 Views)

Re: How convert a Spline to a curved leader

06-12-2012 02:47 PM in reply to: *Scott Mcfarren

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.

*Expert Elite*
Kent1Cooper
Posts: 5,388
Registered: ‎09-13-2004
Message 7 of 16 (274 Views)

Re: How convert a Spline to a curved leader

06-12-2012 04:44 PM in reply to: *Jim Claypool

HS20EXR 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.

Kent Cooper
Contributor
HS20EXR
Posts: 21
Registered: ‎06-12-2012
Message 8 of 16 (269 Views)

Re: How convert a Spline to a curved leader

06-12-2012 06:39 PM in reply to: Kent1Cooper

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.

*Expert Elite*
Kent1Cooper
Posts: 5,388
Registered: ‎09-13-2004
Message 9 of 16 (264 Views)

Re: How convert a Spline to a curved leader

06-12-2012 07:30 PM in reply to: HS20EXR

How about something as simple as this:

 

(defun C:smileyfrustrated:LDR (); = Spline LeaDeR

  (command "_.leader" pause pause "_format" "_spline")

)

Kent Cooper
Contributor
HS20EXR
Posts: 21
Registered: ‎06-12-2012
Message 10 of 16 (262 Views)

Re: How convert a Spline to a curved leader

06-13-2012 09:53 AM in reply to: Kent1Cooper

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)
)

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.