Jump to content

Lisp to create and name layouts and restore views by reading excel or notepad file?


bkirtland

Recommended Posts

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., through BRI170. I have already created all of the views from these intersections, 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 want the layout tabs to be named corresponding to an intersection ID, and then have the viewport show that same view. So, I want layout 1 to be renamed BRI1, and have the viewport view restored to the named view BRI1, and so on for all of the named views.

 

Here are the commands that I used 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, example BRI1]

 

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

 

MSPACE

 

-view > restore > [ASK FOR USER INPUT, example BRI1]

 

PSPACE

 

[select the viewport and lock the display]

 

This macro works great, except that I have to press play and enter the intersection ID twice per layout tab. I'm wondering if its possible to create a lisp that does this routine but reads an excel (or other) file and loops through and creates all the layout tabs in one fell swoop?

 

Thanks in advance for all of your help!

Link to comment
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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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...