Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
*Expert Elite*
pbejse
Posts: 2,467
Registered: ‎11-24-2009
Message 11 of 15 (108 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 (90 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*
pbejse
Posts: 2,467
Registered: ‎11-24-2009
Message 13 of 15 (79 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 (73 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*
pbejse
Posts: 2,467
Registered: ‎11-24-2009
Message 15 of 15 (68 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

 

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.