Titus25 Posted March 7 Posted March 7 (edited) Hello, I'm very new to using LISP functions on Autocad/Civil 3D. I need to create minimum bounding boxes around polylines. I've loaded the LISP function created by Lee mac for this, via the loadapp command. The function is loaded (Minimum Bounding Box.lsp successfully loaded). My problem is simply how to call this function correctly? When I type the command: (LM:minboundingbox sel 0.001) I get nil. Do I need to install anything else first ? (it seems to be a subfunction) What am I doing wrong? Thanks for your answers. Edited March 7 by Titus25 Quote
CyberAngel Posted March 8 Posted March 8 If you look at the bottom of the page you linked to, there's some code that calls minboundingbox. The word sel refers to a variable that's defined earlier in the function, and that comes from a selection made by the user. So you can either create a function that calls minboundingbox, which you'll be able to use whenever you need it, or rewrite the freestanding command to call ssget as shown in Lee Mac's example. If you need more help, ask away. Welcome to the forum! 1 Quote
Titus25 Posted March 8 Author Posted March 8 Thanks a lots for your explanation! It works fine now! Quote
BIGAL Posted March 10 Posted March 10 (edited) 2 questions "minimum bounding boxes around polylines." Boxes implies a plural so multiple boxes required, polylines implies plural so do many. Confirm 1 box of all polylines or a single box around 1 pline but repeated for all plines. Edited March 10 by BIGAL Quote
Titus25 Posted March 10 Author Posted March 10 My aim is to draw one single box around 1 pline but for all plines. The above mentionned LISP function works well for 1 pline, but I have to call it once for each pline. Is there a way to automate the function to all selected plines ? Quote
BIGAL Posted March 10 Posted March 10 (edited) Try this, can add ssget by layer, make on another layer etc. (defun c:wow ( / ss obj pointmin pointmax) (setq ss (ssget '((0 . "LWPOLYLINE")))) (if (= ss nil) (alert "No plines selected ") (repeat (setq x (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq x (1- x))))) (vla-GetBoundingBox obj 'minpoint 'maxpoint) (setq pointmin (vlax-safearray->list minpoint)) (setq pointmax (vlax-safearray->list maxpoint)) (command "rectang" pointmin pointmax) ) ) (princ) ) (c:wow) Edited March 10 by BIGAL Quote
Titus25 Posted March 11 Author Posted March 11 Thanks for this code! It works well for many plines, but the bounding boxes are not oriented to the shape and thus not the real "minimum" bounding boxes. Quote
SLW210 Posted March 11 Posted March 11 I have moved your thread to the AutoLISP, Visual LISP & DCL Forum. Please post in the most appropriate forum. Quote
BIGAL Posted March 11 Posted March 11 The bounding box function always provides a zero 90 orientation. Ok a solution I am pretty sure was done by Lee-mac using a rotate box function. Your lucky I found it Minimum Bounding Box | Lee Mac Programming (lee-mac.com) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.