Hi all,
I am looking for a lisp to autodimension the maximum height and width of a sheet metal flat patern polyline. It is hard for me to code from scratch but i am posting this thinking someone may have encountered the same problem and lisp is hidden somewhere.
See attached image showing what i am trying to achive.
Solved! Go to Solution.
Solved by ВeekeeCZ. Go to Solution.
Hi, try this routine:
;; Selection Set Bounding Box - Lee Mac ;; Returns a list of the lower-left and upper-right WCS coordinates of a ;; rectangular frame bounding all objects in a supplied selection set. ;; s - [sel] Selection set for which to return bounding box (defun LM:ssboundingbox ( s / a b i m n o ) (repeat (setq i (sslength s)) (if (and (setq o (vlax-ename->vla-object (ssname s (setq i (1- i))))) (vlax-method-applicable-p o 'getboundingbox) (not (vl-catch-all-error-p (vl-catch-all-apply 'vla-getboundingbox (list o 'a 'b)))) ) (setq m (cons (vlax-safearray->list a) m) n (cons (vlax-safearray->list b) n) ) ) ) (if (and m n) (mapcar '(lambda ( a b ) (apply 'mapcar (cons a b))) '(min max) (list m n)) ) ) (defun c:DimMax ( / b s ) (if (and (setq s (ssget)) (setq b (LM:ssboundingbox s)) ) (command "_.DIMLINEAR" "_none" (car b) "_none" (list (caadr b) (cadar b)) "_none" "@0,-2" "_.DIMLINEAR" "_none" (list (caadr b) (cadar b)) "_none" (cadr b) "_none" "@2,0" )) (princ) ) (vl-load-com)
...where were used Lee Mac's Selection Set Bounding Box funtion
Next time pls post the DWG sample! We don't know if you used polyline, or lines, what units you're using...
I tried to solve a problem of publishing a real paper sizes of layouts using dimensions of MIN MAX boundary points of selected objects in each layout by combining some functions founded here. Now I have a routine can do it (see attached Real Paper Size For All Layouts - REA.lsp) but I want to publish it in a table form
Is it possible to do it in this way?
Any help or suggestions will be very appreciated
Can't find what you're looking for? Ask the community or share your knowledge.