Help with a custom Macro will not function as designed

Help with a custom Macro will not function as designed

NbeersUZ4NB
Explorer Explorer
301 Views
3 Replies
Message 1 of 4

Help with a custom Macro will not function as designed

NbeersUZ4NB
Explorer
Explorer

I need help with the following AutoCAD Macro

Im using AutoCAD 2023 and just need a simple button to complete a specific set of tasks when selected. I have tried to make a custom macro but as i add new commands its starts to act up and dosent function as intended.

i assume this is a user error issue and figured i would seek some assistance.

Goal of the Marco: (while in Model Space)

  • Zoom Extents
  • Save All - File Name to be supplied
  • View Layout 1 (named JPEG)
  • Activate Model Space (inside layout 1)
  • Zoom Extents
  • Activate Paper Space (inside layout 1)
  • Zoom Extents
  • Plot Layout (name to match filename)
  • View Layout 2 (named BMP)
  • Activate Model Space (inside layout 2)
  • Zoom Extents
  • Activate Paper Space (inside layout 2)
  • Zoom Extents
  • Plot Layout (name to match filename)
  • View Layout 3 (named PNG)
  • Activate Model Space (inside layout 3)
  • Zoom Extents
  • Activate Paper Space (inside layout 3)
  • Zoom Extents
  • Plot Layout (name to match filename)
  • View Model space
  • Save

This is the Marco i have at this time:

^C^C_zoom e _saveas 2018 / layout set JPEG mspace zoom e pspace zoom e plot layout set BMP mspace zoom e pspace zoom e plot layout set PNG mspace zoom e pspace zoom e plot layout set model qsave

 

let me know where i went wrong, or point me to reference material that might help anything helps

 

 

0 Likes
Accepted solutions (1)
302 Views
3 Replies
Replies (3)
Message 2 of 4

paullimapa
Mentor
Mentor
Accepted solution

First of all, with that many commands in a macro, you should look into creating a SCRIPT file:

AutoCAD tip: how to write command scripts and automate plotting | CADnotes (cad-notes.com)

Then at the location where you want to PLOT you need to include all the parameters.

You can do a search on-line for examples on script files that generate a PLOT from either Model tab or Layout.

Here's an example found in this forum:

Plot script - Autodesk Community - AutoCAD

You can also learn about SCRIPT files from an article I recently wrote:

https://issuu.com/augi/docs/aw202205hr/18?ff

Then on the menu button macro all you have to do is include the command SCRIPT and then the name of the script file that contains all the sequence you desire


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 4

Kent1Cooper
Consultant
Consultant

Be more specific about "starts to act up and dosent function as intended."  [How far does it get?  Are there any messages?  Etc., etc.]  I haven't used macros for anything as extensive as that, but I notice a couple of things in addition to what's already been mentioned.

 

There's a SAVEAS command in there.  I know an AutoLisp routine cannot start in one drawing and continue in another, but I'm not sure whether a macro can -- it would need to here, since SAVEAS takes you into the new drawing.

 

Also, the symbol for User input in a command macro [assuming that's valid for the SAVEAS in the context] is a backslash, not a forward slash.

Kent Cooper, AIA
0 Likes
Message 4 of 4

Sea-Haven
Mentor
Mentor

My $0.05 there are plenty of lisp plot layout routines out there, I have a few matching printer including a jpg one. 

 

Not sure why your zooming extents in a mspace then plotting jpg then going to another layout to plot a BMP. Why not stay in the same layout and just repeat the plot for JPG, PNG and BMP.

 

Here is an example plot code. Note its hard coded for the layout title block.

(COMMAND "-PLOT"  "Y"  "" "DWG To PDF"
	       "Iso full bleed A3 (420.00 x 297.00 MM)" "m" "LANDSCAPE"  "N"   "W"  "-6,-6" "807,560" "1=2"  "C"
	       "y" "Acad.ctb" "Y"	"n" "n" "n" pdfName "N" "y"
    )

 

 

 

0 Likes