TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: SPDCad on January 28, 2005, 09:01:18 AM
-
I am looking for a quick way to extract the properties of a solid.
More particular the length, width and height.
I have done this once before in VLisp, but my code is at home. :(
Propbably buried within one of my many lisp backup CD's.
Any help would be appreciated. I got to do some major solid editing and
I have a tight deadline.
-
Not tested but, Is this what you are looking for?
(vlax-invoke-method (objsel "\nSelect Solid: ") 'getboundingbox 'pt1 'pt2)
(setq tem(mapcar '- (vlax-safearray->list pt1) (vlax-safearray->list pt2)))
(princ (strcat "\nLength " (rtos (abs(car tem)))))
(princ (strcat "\nWidth " (rtos (abs(cadr tem)))))
(princ (strcat "\nHeight " (rtos (abs(caddr tem)))))
;The following gets and returns a selected object in activex format
;******************************************************************
(defun objsel ($prompt / ent obj) ;usage = (setq obj(objsel "Select Object: "))
(setq ent (car (entsel $prompt)))
(if (/= ent nil)
(setq obj (vlax-ename->vla-object ent))
(princ "No Object Selected")
)
obj ;returns result for use in calling program
)
-
I think you'll find that a 3d solids properties are encoded and not available through either Lisp or VBA
that's not taking into account "properties" like Centroid, radii of gyration etc which can be accessed.
The other stuff like whether it's a cylinder or box or cone aren't available, neither are props like height, length, width. You have to use bounding boxes, and ucs's and a lot of match to calculate the size of a solid
-
Thank you Dannd for the code.
It was what I was looking for.