Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
*Expert Elite*
Kent1Cooper
Posts: 5,368
Registered: ‎09-13-2004
Message 11 of 16 (523 Views)

Re: How convert a Spline to a curved leader

06-13-2012 12:09 PM in reply to: HS20EXR

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

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

Re: How convert a Spline to a curved leader

06-13-2012 01:22 PM in reply to: Kent1Cooper

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.

 

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

Re: How convert a Spline to a curved leader

06-13-2012 02:41 PM in reply to: HS20EXR

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

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

Re: How convert a Spline to a curved leader

06-13-2012 04:24 PM in reply to: Kent1Cooper

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?

 

 

Valued Mentor
Ian_Bryant
Posts: 362
Registered: ‎06-02-2005
Message 15 of 16 (488 Views)

Re: How convert a Spline to a curved leader

06-13-2012 08:25 PM in reply to: HS20EXR

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

Contributor
HS20EXR
Posts: 21
Registered: ‎06-12-2012
Message 16 of 16 (465 Views)

Re: How convert a Spline to a curved leader

06-14-2012 09:06 AM in reply to: Ian_Bryant

This works perfectly. Many thanks!

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.