Author Topic: Maximizing An INSERT In A Display Area  (Read 1747 times)

0 Members and 1 Guest are viewing this topic.

David Bethel

  • Swamp Rat
  • Posts: 656
Maximizing An INSERT In A Display Area
« 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
R12 Dos - A2K

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Maximizing An INSERT In A Display Area
« Reply #1 on: February 20, 2014, 10:32:55 AM »
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
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

David Bethel

  • Swamp Rat
  • Posts: 656
Re: Maximizing An INSERT In A Display Area
« Reply #2 on: February 20, 2014, 11:58:15 AM »
Thanks CAB

Yes, the scale is what I'm working on.  Almost there but not quite.  Thanks!  -David
R12 Dos - A2K

David Bethel

  • Swamp Rat
  • Posts: 656
Re: Maximizing An INSERT In A Display Area
« Reply #3 on: February 20, 2014, 01:19:57 PM »
I'll have to tweak this for my personal needs, but it seems to work :

Code: [Select]
;;;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))
R12 Dos - A2K