• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Visual LISP, AutoLISP and General Customization

    Reply
    *Expert Elite*
    Posts: 2,136
    Registered: ‎11-24-2009

    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

     

    Please use plain text.
    Distinguished Contributor lai
    Distinguished Contributor
    lai
    Posts: 123
    Registered: ‎08-15-2011

    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.

    Please use plain text.
    *Expert Elite*
    Posts: 2,136
    Registered: ‎11-24-2009

    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

     

     

    Please use plain text.
    Distinguished Contributor lai
    Distinguished Contributor
    lai
    Posts: 123
    Registered: ‎08-15-2011

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

    Please use plain text.
    *Expert Elite*
    Posts: 2,136
    Registered: ‎11-24-2009

    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

     

    Please use plain text.