Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Autodimension Max Height and Width

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
Anonymous
937 Views, 4 Replies

Autodimension Max Height and Width

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.

 

4 REPLIES 4
Message 2 of 5
ВeekeeCZ
in reply to: Anonymous

Hi, try this routine:

 

Spoiler
;; 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... 

Message 3 of 5
Anonymous
in reply to: ВeekeeCZ

BeekeeCZ

The Lisp works Great. 

Using Polyline and Units are inches and it also adapts the standard dimension style. 

Thanks a ton.

 

Message 4 of 5
danglar
in reply to: Anonymous

Is it possible to save values of these dimmensions in output file?

Message 5 of 5
danglar
in reply to: danglar

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.

Post to forums  

Forma Design Contest


AutoCAD Beta