TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: David Bethel on February 20, 2014, 09:33:28 AM
-
Greetings,
I'm updating our detail pages for individual pieces of equipment.
Normally there are (1) Plan, (2) Elevations and (2) Isometrics ( as shown )
and lots of notes and dimensions
1/2" = 1'-0" and 8.5 x 11 p[aper ( landscape )
Based on the size of the equipment, I can calculate the display area
LowerLeft and UpperRight points for the isometrics
The isometric is a BLOCK that I can determine the boundry box
X and Y axis values
The BLOCK insbase point is always the LowerLeft of the bounding box
What I want to do is to maximize the INSERT scale so that the INSERT takes
up either the entire X axis or Y axis and not extend betyond the display area
while being centered in the display area.
( The INSERT scales will always be equal )
Any suggestions would be greatly appriciated !
-David
-
I would scale the insert based on the bounding box.
This may help in that endeavor.
http://www.theswamp.org/index.php?topic=39028.0
-
Thanks CAB
Yes, the scale is what I'm working on. Almost there but not quite. Thanks! -David
-
I'll have to tweak this for my personal needs, but it seems to work :
;;;INSERT A BLOCK INSIDE A DISPLAY AREA
;;;LowerLeft UpperRight BlocksiZe BlockName
(defun fill_disp (ll ur bz bn / vx vy vc is ipt)
(setq vx (- (car ur) (car ll))
vy (- (cadr ur) (cadr ll))
vc (list (+ (car ll) (* vx 0.5))
(+ (cadr ll) (* vy 0.5)))
is (min (/ vx (car bz)) (/ vy (cadr bz)))
ipt (list (- (car vc) (* (car bz) is 0.5))
(- (cadr vc) (* (cadr bz) is 0.5)) 0))
(command "_.INSERT" bn ipt is)
(while (> (getvar "CMDACTIVE") 0)
(command ""))
(list bn ipt is))