...eccolo questo è il lisp, che ho travato!!!
il mio scopo è quello di portare il risultato ottenuto (volume) in
un txt nel disegno!! help
(defun c:ale_getweight ( / entobj volval wspval)
(vl-load-com)
(if (setq entobj (ale_entselfilter "seleziona un solido" '((0 .
"3dsolid"))))
(progn
(setq
entobj (ale_vlax-ename>vla-object entobj)
volval (vla-get-volume entobj)
wspval (getreal "\npeso specifico: ")
)
(if wspval
(princ
(strcat
"\nvolume: " (rtos volval 2 1)
" - peso: " (rtos (* volval wspval) 2 1)
)
)
)
)
)
(princ)
)
;
; copyright ©2005 - marc'antonio alessi, italy - all rights reserved
;
http://xoomer.virgilio.it/alessi
;
; function: ale_entselfilter
;
; version 1.00 - 22/02/2005
;
; description:
; ssget for one entity with filter list
;
; arguments:
; prmstr = user prompt [STR]
; fltlst = ssget filter list
;
; example:
; (ale_entselfilter "select attibuted block" '((0 . "insert") (66 . 1)))
;
; return values:
; [ENAME] entity name
; nil if user press 'return' or 'space'
;
(defun ale_entselfilter (prmstr fltlst / flgslt entnam)
(princ "\n_ ")
(prompt (setq prmstr (strcat "\n" prmstr ": ")))
(if
(while (not flgslt)
(if (setq entnam (ssget "_:e:s" fltlst))
(not (setq flgslt t))
(if (= 52 (getvar "errno"))
(setq flgslt t)
(prompt (strcat "\nnessun oggetto selezionato o valido,
riprova!" prmstr))
)
)
)
(not (princ "\ncomando annullato. "))
(ssname entnam 0)
)
)
;
; function: ale_vlax-ename>vla-object
;
; version 1.00 - 22/02/2005
;
; description:
; validate input object
;
; arguments:
; entobj = [VLA-OBJECT] or [ENAME]
;
; return values:
; [VLA-OBJECT] if valid input object
; nil otherwise
;
(defun ale_vlax-ename>vla-object (entobj)
(cond
( (= (type entobj) 'vla-object) entobj )
( (= (type entobj) 'ename) (setq entobj (vlax-ename->vla-object
entobj)) )
(t (prompt "\ntipo di oggetto non valido! ") )
)
)
;
(princ)