SSGET return a SELECTION SET, this is not a LIST , you have to build a list of all entyname.
A question , what kind of solid are you handling.??
(defun C:SolxT ( /
3D-OBJ
3DSS
ADOC
BOX
CNT
LENTH
MAXPOINT
MINPOINT
;;SUM
)
(vl-load-com)
(setq adoc
(vla-get-activedocument
(vlax-get-acad-object)
)
);_ adoc is the current DWG
(setq 3dss (ssget "X" '((0 . "3DSOLID") ;|(cons 8 "layer1,layer2,layer3")|; ))); it will get all 3d on all layers whatsever it´s state,
;;(ssget "X") creates a selection set of all entities in the drawing including those on layers that are frozen or off.
;; you can filter to get the 3d on the selected layers too
;//(setq 3dss(ssget )); if you want to select by user
;; see more info here , about ssget
http://ronleigh.info/autolisp/afude18.htm (setq sum 0)
(setq cnt 0)
(setq 3d-obj ( vla-get-activeselectionset adoc ));_ all the solids at the dwg as OBJECTS
;;;(while
;;;(< cnt )
;;; (if
;;; 3dss
;;; (progn
;;; (setq sobj (vlax-ename->vla-object (car 3dss)))
;;; (if
;;; (= (vla-get-objectName sobj) "AcDb3dSolid")
(vlax-for 3d 3d-obj;_ same as foreach but for OBJ
; you do not need to check for a solid as the ssget"X" get 3dsolids only
;;; (progn ;// progn3
;;(setq 3d (vla-item 3d-obj 0)); used to get the first obj , just to test de following part
(vla-getboundingbox 3d 'minpoint 'maxpoint)
(setq box (mapcar '- (vlax-safearray->list maxpoint)
(vlax-safearray->list minpoint)))
(setq lenth (apply 'max box))
;;; ) ;// prg
;;; ) ;// if
;;; ) ;// prg
;;; ) ;// if
(setq sum(+ sum lenth))
(setq cnt(+ cnt 1))
;;
;// if
;;
;// prg
;;
;// whl
sum
);_ vlax-for
;;(alert (strcat " Total Length of Solid = " (rtos lenth))); you have to show the sum not the Length
(alert (strcat " Total Length of Solid = " (rtos sum)))
(princ)
(princ)
);// defun
;;(C:SolxT)
;|«Visual LISP© Format Options»
(120 2 40 0 nil "end of " 100 20 1 2 0 T nil nil T)
;*** DO NOT add text below the comment! ***|;