Visual LISP, AutoLISP and General Customization

Reply
*Expert Elite*
Posts: 2,370
Registered: ‎11-24-2009
Message 11 of 15 (99 Views)

Re: Additional counter for layer dimension

03-20-2012 03:22 AM in reply to: lai

lai wrote:

hi, recently i notice that the below lisp somehow it show me some error as below :-

 

Command: acdl

Enter Distance from Leader Line <1.00>:

; error: bad SSGET list

 

I not sure what happen...sometimes it works find..but sometime not...i try to do testing too..Copy all the entities in the drawing,copy to a new drawing, then run the lisp again and it work fine but yet, sometimes not...Any idea?


I see,  my guess is there area objects included in the selection outside of the current tab

so try changing this

(setq ss   (ssget "_X"
                            '((0 . "DIMENSION,LEADER,MULTILEADER")
                              (8 . "~Dimension"))))

to this

(setq ss   (ssget "_X"
                            (list '(0 . "DIMENSION,LEADER,MULTILEADER")
                                   '(8 . "~Dimension")(cons 410  (getvar 'Ctab)))))

That will avoid selecting the objects not on the current viewport

 

Also you may need to add this
      (setvar 'Osmode 0) to avoid snapping ot objects while inside (ssget "_C")

 

Remember this lisp code were writen wihtout r error trapping subs.

 

 

 

HTH

 

Distinguished Contributor lai
Distinguished Contributor
lai
Posts: 123
Registered: ‎08-15-2011
Message 12 of 15 (81 Views)

Re: Additional counter for layer dimension

03-20-2012 06:32 PM in reply to: pbejse

Hi pbejse,

Thanks for the feedback..Anyway, i just give it a try as what you given,but still got the error..I have attach along the sample drawing for you to test and my newly modify lisp according to your advise.

*Expert Elite*
Posts: 2,370
Registered: ‎11-24-2009
Message 13 of 15 (70 Views)

Re: Additional counter for layer dimension

03-20-2012 11:47 PM in reply to: lai

lai wrote:

Hi pbejse,

Thanks for the feedback..Anyway, i just give it a try as what you given,but still got the error..I have attach along the sample drawing for you to test and my newly modify lisp according to your advise.


There lies the problem.... :smileywink:

 

'((0 . "MTEXT")(8."~Dimension"));<---- no space between 8."

to

'((0 . "MTEXT")(8 . "~Dimension"))

 

so....

(setq subsel (ssget "_C"
     (trans  (toler (* tolr -1) (vlax-safearray->list ll)) 0 1)
     (trans  (toler tolr (vlax-safearray->list ur)) 0 1)
     '((0 . "MTEXT")(8 . "~Dimension"))))

 

and put the osmode outside of the sget

 

(Defun c:tot  (/ toler tolr ss lst i nme var ll ur)

(setq om (getvar 'Osmode))(setvar 'Osmode 0) 

.......

......

  (princ "\nNone Found:"))
      (setvar 'Osmode om)
      (princ)
      ) 

 

HTH

 

 

Distinguished Contributor lai
Distinguished Contributor
lai
Posts: 123
Registered: ‎08-15-2011
Message 14 of 15 (64 Views)

Re: Additional counter for layer dimension

03-21-2012 02:31 AM in reply to: pbejse

hi, thanks for the advise....I have attach here the final lisp for future user ease to get it....

*Expert Elite*
Posts: 2,370
Registered: ‎11-24-2009
Message 15 of 15 (59 Views)

Re: Additional counter for layer dimension

03-21-2012 03:27 AM in reply to: lai

lai wrote:

hi, thanks for the advise....I have attach here the final lisp for future user ease to get it....


Great.

Cheers Lai

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you interested in helping shape the Autodesk Community?
We’re looking at a few different ways to improve the “All Forums” landing page and need your feedback! If interested, please take a few minutes to fill out the following Usability Study. Thank you for your time!

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community