Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
*Expert Elite*
pbejse
Posts: 2,500
Registered: ‎11-24-2009
Message 11 of 15 (110 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 (92 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,500
Registered: ‎11-24-2009
Message 13 of 15 (81 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 (75 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,500
Registered: ‎11-24-2009
Message 15 of 15 (70 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

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!