Jump to content
bkirtland

Trouble Switching from Paperspace to Modelspace in Action Recorder Macro

Recommended Posts

bkirtland

Hi everyone,

 

I'm new to using macros/lisps in AutoCAD, though I do have a small programming background in some other programs. To give you some background on what I'm trying to do: I have a big .dwg file that shows all of the roads in a particular city in the USA, and I have created views of all of the intersections that have crosswalks. All of these intersections have their own intersection IDs, which have a format such as BRI1, BRI2A, BRI3B, BRI4, BRI5, etc. I have already created all of the views from these intersections (of which there are over 100), and now, in the same .dwg, I am trying to quickly create layouts from a template that show only one view each. I have a .dwt set up for this, and the name of the layout for this template is EB124. I am having no trouble creating these layouts individually, but as there are over 100 in this particular section of the city, I want to be able to quickly create the layouts and then move onto the next section.

 

Here are the commands that I used to try to create a macro for this using the Action Recorder:

 

-layout > t > [select template from file] > EB124

 

-layout > set > EB124

 

-layout > rename > EB124 > [ASK FOR USER INPUT]

 

[select the viewport in the new layout and unlock the display]

 

MSPACE

 

-view > restore > [ASK FOR USER INPUT]

 

PSPACE

 

[select the viewport and lock the display]

 

 

When I do these all while recording the macro, it works perfectly. However, when I try to play the resulting macro, it works like a charm until it seems like the macro doesn't actually execute the MSPACE command? So I am in paperspace when it executes the -view>restore portion, which then seems to delete the xref that contains the titleblock? I have tried using REA afterward in case the xref is just not showing up, but it looks like it is instead replaced by a polyline, which seems bizarre to me.

 

I also tried executing the -view>restore command while in paperspace outside of the macro to try to replicate the problem, and it results in the same problem.

 

I have attached screenshots of the action recorder commands (because I don't think I can attach the .actm file?) as well as screenshots of what correct results and actual results look like. Note that the views in the "correct" vs "incorrect" results are different, and this is OK. Unfortunately due to confidentiality, I cannot actually attach the .dwg file.

 

I also figure that there is an easier way to do this using lisps, but I just don't even know where to start...

 

Thanks in advance for any help!

action recorder 1.PNG

action recorder 2.PNG

action recorder 3.PNG

Correct_Result.PNG

Missing_Titleblock.PNG

Share this post


Link to post
Share on other sites
bkirtland

Hi again everyone,

 

An update: I figured out my problem, which was that the XREF layer was frozen in the some of the views, so when I restored those views, it restored the layer states as well, and froze the viewport layer.

 

I hope nobody spent a long time thinking about this!

Share this post


Link to post
Share on other sites
Dadgad

How refreshing, somebody else who actually uses the Action Recorder, which I use a lot, as I am not a member of the Lisperati.

I love being able to quickly create, on the fly, task appropriate action macros.

I think this functionality is widely overlooked by most users.

What's not to like about a keystroke recorder, as long as we know who is in the drivers seat, and it didn't come to the party in a Trojan Horse?

 

You seem to have solved your problem, but I thought it worth mentioning that another way to access Mspace, which has some advantages, is using VPMAX, should you be working in an active viewport, after which VPMIN takes you back. :beer:

Share this post


Link to post
Share on other sites
Dadgad
Hi again everyone,

 

An update: I figured out my problem, which was that the XREF layer was frozen in the some of the views, so when I restored those views, it restored the layer states as well, and froze the viewport layer.

 

I hope nobody spent a long time thinking about this!

 

Should it be advantageous, you could uncheck the SAVE LAYER SNAPSHOT option when saving a new view, then you wouldn't have that problem. :|

Share this post


Link to post
Share on other sites
BIGAL

Its a pity that the macro record does not save in a programming language Msword & Excel record VBA, I think it was Corelcad in .Net I know I have tried to edit macros with very little success so gave up.

Share this post


Link to post
Share on other sites
Dadgad
Its a pity that the macro record does not save in a programming language Msword & Excel record VBA, I think it was Corelcad in .Net I know I have tried to edit macros with very little success so gave up.

 

I usually don't try to Edit them, I just create a new one, after all it is as quick as your keystrokes, assuming one has thought for a moment first about the repetitive task you are trying to facilitate. Every time I receive drawings from my team I create and run one on all of them, before diving into the task at hand, it really helps my flow.

 

It is not as powerful as being able to write lisp, but it is proabably a lot quicker and or user friendly for most folks, like myself , who are not coders. I may create a half a dozen new ones in a typical day.

Edited by Dadgad

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...