@drakejest wrote:
....Would there be a way to convert an extruded object to a box given that the extruded object is just a simple box?
Try this [minimally tested]:
(defun C:BOXIFY (/ ss n oldbox minpt maxpt LL UR delta)
(prompt "\nTo convert orthogonal box-shaped 3D Solid(s) to actual \"BOX\" objects,")
(if (setq ss (ssget "_:L" '((0 . "3DSOLID"))))
(repeat (setq n (sslength ss)); then
(setq oldbox (ssname ss (setq n (1- n))))
(vla-getboundingbox (vlax-ename->vla-object oldbox) 'minpt 'maxpt)
(setq
LL (vlax-safearray->list minpt)
UR (vlax-safearray->list maxpt)
delta (mapcar '- UR LL)
); setq
(command
"_.box" "_none" LL "_length" (car delta) (cadr delta) (caddr delta)
"_.chprop" "_last" "" "_layer" (cdr (assoc 8 (entget oldbox))) ""
"_.erase" oldbox ""
); command
); repeat
); if
(princ)
); defun
It's up to you to select only orthogonally-oriented box-shaped Solids -- it doesn't verify that's what you picked. I think it would be hugely complicated, if even possible, to do that by any kind of calculation, given the inscrutability of 3DSolid entity data. The one way that may work would be to build the new Box, SUBTRACT the original from the new one, and if nothing is left, the original was the right kind of shape and orientation. Then it would Undo the Subtraction, and delete the original. Otherwise it would Undo the Subtraction and the building of the new Box, and leave the original.
Kent Cooper, AIA