Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Routine to sum multiples dimensions

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
FilRib
2337 Views, 5 Replies

Routine to sum multiples dimensions

Hi,

 

What is my goal: to select multiple dimensions entities and obtain the sum os all of them. In the image below i should be albe to select the 2 dimensions and the result of the command/routines should respond me "5".

 

 

Someone know a routine/command for that?

 

Thanks in advance!

5 REPLIES 5
Message 2 of 6
_Tharwat
in reply to: FilRib

Try ...

 

(defun c:Test (/ i ss )
  (if (setq i 0. ss (ssget '((0 . "*DIMENSION"))))
      ((lambda (% / sn)
         (while (setq sn (ssname ss (setq % (1+ %))))
           (setq i (+ (vla-get-measurement (vlax-ename->vla-object sn)) i))
           ))
        -1)
    )
  (if (> i 0.)
    (princ (strcat "\nTotal measuremnts : < " (rtos i 2 4) " > ."))
    )
  (princ)
  )(vl-load-com)

 

Message 3 of 6
FilRib
in reply to: _Tharwat

Perfect! 

 

Thank you very much!

Message 4 of 6
_Tharwat
in reply to: FilRib


@FilRib wrote:

Perfect! 

 

Thank you very much!


You are welcome .

Message 5 of 6
oelgam23
in reply to: _Tharwat

how to use the code?thank you

Message 6 of 6
_Tharwat
in reply to: oelgam23

Hi,

Copy the codes and save them in a txt file with the extension .lsp then READ THIS to know how to load the program.

After you load the codes then just call the command name which is TEST

Good luck.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost