Author Topic: Set Drawing Limits To Extents  (Read 6734 times)

0 Members and 1 Guest are viewing this topic.

bayoubuoy

  • Guest
Set Drawing Limits To Extents
« on: January 14, 2011, 01:07:05 PM »
Sometimes I download blocks that have the drawing limits in hundreds of feet when the block is just a few inches.
I'm looking for a lisp routine to set the Drawing Limits to the values of the extents of the block (drawing).

thanks,
bayoubuoy

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Set Drawing Limits To Extents
« Reply #1 on: January 14, 2011, 01:15:27 PM »
Perhaps look into the EXTMIN / EXTMAX Sys Vars, and/or this.

Lee

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Set Drawing Limits To Extents
« Reply #2 on: January 14, 2011, 01:19:06 PM »
Look at LIMMIN and LIMMAX as well.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

stevej

  • Newt
  • Posts: 30
Re: Set Drawing Limits To Extents
« Reply #3 on: January 14, 2011, 01:36:14 PM »
I use this bit of code, although sometimes I need to run it twice for it to work, so I turn on the grid to verify.

Steve

Code: [Select]
(setq limmax (getvar "extmax"))       ;Gets drawing EXTENTS
(command "limits" "0,0" limmax)       ;Sets drawing LIMITS to drawing EXTENTS

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Set Drawing Limits To Extents
« Reply #4 on: January 14, 2011, 02:01:21 PM »
This?

Code: [Select]
(defun c:lim nil
  (mapcar 'setvar '(LIMMIN LIMMAX)
    (mapcar '(lambda ( x ) (reverse (cdr (reverse x))))
      (mapcar 'getvar '(EXTMIN EXTMAX))
    )
  )
)

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Set Drawing Limits To Extents
« Reply #5 on: January 14, 2011, 03:11:49 PM »
Works here Lee.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Set Drawing Limits To Extents
« Reply #6 on: January 14, 2011, 03:16:13 PM »
Works here Lee.

Good to hear Ron, thanks  :-)

bayoubuoy

  • Guest
Re: Set Drawing Limits To Extents
« Reply #7 on: January 14, 2011, 04:34:04 PM »
I use this bit of code, although sometimes I need to run it twice for it to work, so I turn on the grid to verify.

Steve

Code: [Select]
(setq limmax (getvar "extmax"))       ;Gets drawing EXTENTS
(command "limits" "0,0" limmax)       ;Sets drawing LIMITS to drawing EXTENTS

Steve,
Lurking here at The Swamp I learned enough to add a defun to your code.
Running twice does the trick.

Thanks much,
bayoubuoy

bayoubuoy

  • Guest
Re: Set Drawing Limits To Extents
« Reply #8 on: January 14, 2011, 04:36:16 PM »
This?

Code: [Select]
(defun c:lim nil
  (mapcar 'setvar '(LIMMIN LIMMAX)
    (mapcar '(lambda ( x ) (reverse (cdr (reverse x))))
      (mapcar 'getvar '(EXTMIN EXTMAX))
    )
  )
)

LeeMac,
Works great.

Thanks,
bayoubuoy

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Set Drawing Limits To Extents
« Reply #9 on: January 14, 2011, 05:04:54 PM »
You're very welcome Bayoubuoy  :-)