Over the last few months I've been developing LISP code to automate some assembly drawings. The process is carried out completely without user intervention. And that is the key as we now want to roll it out to some sales people who have little if any training in the use of AutoCAD.
Once the drawing is completed in model space we have four different layout tabs, each with a different paper size (A-D) and a different viewport scale. It works really great except that most of the time the users are requesting 11 x 17 size drawings and when the assembly get large, the way it fits in the paper space has to be adjusted.
My goal is to find some method of using the center of the three orthograohic views of the assembly (front, top and side views). I pretty sure I can calculate the point of the center of a rectangle that just enclose these three views and then zoom from there, but the trick would be to get the viewport scale set to something that wouldn't be whacko like 1-7/64" = 1'-0". The goal is to stay with 1:8, 1:12, 1:16, 1:20, etc...
Any pointers or suggestions would be appreciated.
Well, you can go inside the mspace vport and do a zoom extent.
Then grab the viewsize:
(setq vwz (getvar"viewsize"))
Goto Pspace and grab the pspace vport object and save it to variable " en " and then grab the following info:
(setq ed(entget en))
(setq vwh(cdr(assoc 40 ed))) ; vw height
(setq vww(cdr(assoc 41 ed))); vw width
Next, calculate the current value of the vport scale:
(setq vps(/ (/ vwh vwz) (/ vwh vww)))
Finally find the closes zoom scale factor that's greater than the current vps and use that.
Access a broad range of knowledge to help get the most out of your products and services.