See the top rated post in this thread. Click here

Results 1 to 8 of 8

Thread: Save and Close Macro

  1. #1
    Member
    Join Date
    2014-10
    Posts
    9
    Login to Give a bone
    0

    Default Save and Close Macro

    We currently have a button that will do a zoom extents and then save and close a drawing. We just have the following macro under the button:

    ^C^CZOOM;E;_qsave;CLOSE;

    I would like to add in an extra step that switches the layout back to model space and then do a zoom extents, save and close. I tried the following macro:

    ^C^CLAYOUT; S; MODEL; ZOOM;E;_qsave;CLOSE;

    But that requires user input instead of doing everything automatically.

    Any direction would be greatly appreciated.

    Thank you,
    Mike

  2. #2
    All AUGI, all the time Tharwat's Avatar
    Join Date
    2010-06
    Posts
    906
    Login to Give a bone
    0

    Default Re: Save and Close Macro

    Maybe ...

    Code:
    tilemode;1

  3. #3
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL
    Posts
    3,217
    Login to Give a bone
    0

    Default Re: Save and Close Macro

    Unless the viewport is locked doing a zoom extents while in one and saving will have undesirable results.

    I'd recommend switching to Paper Space if in a viewport. Then if in Paper Space zoom extents before switching to Model tab. Finish with zoom Extents save and close. This macro should do the trick:
    Code:
    $M=$(if,$(eq,$(getvar,tilemode),0),$(if,$(eq,$(getvar,cvport),1),Z;E,PS;Z;E));tilemode;1;Z;E;_qsave;CLOSE
    Tom Beauford P.S.M. - Civil 2019 on Windows 10 Enterprise
    Design Analysis - Leon County Public Works/Engineering Wrap [CODE] tags around selected text
    2280 Miccosukee Rd. Tallahassee, FL 32308-5310
    Ph# (850)606-1516 Home Page

  4. #4
    Member
    Join Date
    2014-10
    Posts
    9
    Login to Give a bone
    0

    Default Re: Save and Close Macro

    Thank you for the replies! Since sometimes our viewports end up getting unlocked for one reason of another, I ended up going Tom's macro and it works great, thank you!

  5. #5
    Member
    Join Date
    2014-10
    Posts
    9
    Login to Give a bone
    0

    Default Re: Save and Close Macro

    Tom,

    The macro you provided works perfectly when a drawings is in paper space, but do you know how to edit the macro so that when the drawing is in model space it just does a zoom, extents, save and close and does not require user input?

    Thank you,
    Mike

  6. #6
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL
    Posts
    3,217
    Login to Give a bone
    0

    Default Re: Save and Close Macro

    Quote Originally Posted by mviall681618 View Post
    Tom,

    The macro you provided works perfectly when a drawings is in paper space, but do you know how to edit the macro so that when the drawing is in model space it just does a zoom, extents, save and close and does not require user input?

    Thank you,
    Mike
    Sorry, tested for each circumstance this time try it now:
    Code:
    $M=$(if,$(eq,$(getvar,tilemode),0),$(if,$(eq,$(getvar,cvport),1),Z;E;,PS;Z;E;))tilemode;1;Z;E;_qsave;CLOSE
    Tom Beauford P.S.M. - Civil 2019 on Windows 10 Enterprise
    Design Analysis - Leon County Public Works/Engineering Wrap [CODE] tags around selected text
    2280 Miccosukee Rd. Tallahassee, FL 32308-5310
    Ph# (850)606-1516 Home Page

  7. #7
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL
    Posts
    3,217
    Login to Give a bone
    1

    Default Re: Save and Close Macro

    Updated to bring up saveas dialog box for untitled drawings:
    Code:
    $M=$(if,$(eq,$(getvar,dwgtitled),0),saveas,$(if,$(eq,$(getvar,tilemode),0),$(if,$(eq,$(getvar,cvport),1),Z;E;,PS;Z;E;))tilemode;1;Z;E;_qsave;CLOSE)
    It was saving them as close.dwg
    Tom Beauford P.S.M. - Civil 2019 on Windows 10 Enterprise
    Design Analysis - Leon County Public Works/Engineering Wrap [CODE] tags around selected text
    2280 Miccosukee Rd. Tallahassee, FL 32308-5310
    Ph# (850)606-1516 Home Page

  8. #8
    Member
    Join Date
    2014-10
    Posts
    9
    Login to Give a bone
    0

    Default Re: Save and Close Macro

    Thank you so much, this will be a big time saver and also save a lot of confusion, especially with new hires!

Similar Threads

  1. VBA to run an excell macro then close autocad
    By wayne.orton714858 in forum AutoCAD Customization
    Replies: 1
    Last Post: 2011-03-14, 03:49 PM
  2. VBA program always prompting to save .DVB on close
    By amy.143074 in forum VBA/COM Interop
    Replies: 12
    Last Post: 2009-03-06, 03:55 PM
  3. Close, relinquish, no save to central
    By ron.sanpedro in forum Revit - Worksharing/Worksets/Revit Server
    Replies: 22
    Last Post: 2007-09-12, 08:43 PM
  4. Replies: 2
    Last Post: 2006-12-05, 03:47 AM
  5. Close a file and don't save changes
    By jgardner.79905 in forum AutoLISP
    Replies: 4
    Last Post: 2006-08-21, 05:31 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •