3d bounding box
Comments
-
If its a 3d solid use massprop.
If its objects would have to sort X Y Z and find min max. No idea what you have explain more.
0 -
Get extents in XYZ directions
(setq ext (vle-getgeomextents (ssget "_X" '((410 . "Model")))) minpt (car ext) maxpt (cadr ext) xl (- (car maxpt) (car minpt)) yl (- (cadr maxpt) (cadr minpt)) zl (- (caddr maxpt) (caddr minpt)))
(vl-cmdf "Box" minpt maxpt)
This should give you what you want. The maxpt, minpt, extent in X direction, extent in Y direction and extent in Z direction are also shown as xl, yl and zl. You can change the ssget to suit your needs.
0 -
or just vla-getboundingbox?
0 -
vla-getboundingbox supports single object only. Lee-mac has a multi object version but I think its only 2D.
0 -
vle-getgeomextents works with ename, selection set, or a list of enames.
0 -
Thanks for the responses. To be clear, I don't know lisp so was looking for a ready made solution like Bbox by Arkance Systems. I need the bounding box to be a 3d solid, tightly enclosing multiple other solids. Rhino has this feature built in so I thought there might be a third party solution for BC / AC as well. Will keep looking.
thank you0 -
Hi ScottC,
You posted in the LISP section so I assumed you understood LISP. I just completed the above code for you. Copy the code in notepad, then save the file as BBox.lsp
(defun C:BBox(/ os ext minpt maxpt)
(setq os (getvar 'osmode))
(setvar 'osmode 0)
(prompt "\nSelect entities to enclose in a bounding box")
(setq ext (vle-getgeomextents (ssget '((410 . "Model")))) minpt (car ext) maxpt (cadr ext))
(vl-cmdf "Box" minpt maxpt)
(setvar 'osmode os)
(princ)
)Hope this helps
0 -
Ah - that works exactly as I need. Thank you so much!
0