Jump to content
jesset

Macro - New Drawing with Client Templates/Layers

Recommended Posts

jesset

Hey guys!

 

I am working on a macro where the user will click the button, the macro opens a script to open a new drawing with a client template, after that it'll load a couple of lisps and run those to setup the standard layers and automate the drawing layout portion.

 

I am fairly new to this, I have noticed that the macro quits as soon as the script runs opening a new drawing. Is this a limitation with running a macro?

Share this post


Link to post
Share on other sites
Dadgad

Why not just include those standard layers in the client specific .DWT (template)?

You could also preload the Sheet into the Layout, so you hit the ground running.

Share this post


Link to post
Share on other sites
BIGAL

Agree with Dadgad, You can point the "NEW" to a different directory that holds all your client DWT's

 

CONFIG, FILES, Template settings, Drawing file template location, your directory

Share this post


Link to post
Share on other sites
jesset

Point taken with layers, going to rethink that bit.

 

However, I am looking to automate the setup of the layouts as this changes project to project. Basically the lisp gets the user input for the type of layout (keyplan/plotplan/details) and how many layouts they need and creates those layouts with the proper titleblocks. Ideally, I'd have this lisp run after the new drawing template is loaded.

Share this post


Link to post
Share on other sites
tombu

Like everyone else I don't understand why you would need a lisp for this?

 

I have a drop-down in my Ribbon with a list of macros like this starts a new drawing using my "FL83-NF.dwt" template:

^C^C^P(vla-activate (vla-Add (vla-get-Documents (vlax-get-acad-object)) (strcat (getvar "localrootprefix") "template" (chr 92) "AutoCAD Template" (chr 92) "FL83-NF.dwt"))) 

Once I determine the layout size needed I use lisp to pop it in from another drop-down like this macro for an 11×17 border:

^C^C^P(or C:Steal (load "StealV1-8.lsp"))(Steal (strcat (vl-filename-directory (getenv "QnewTemplate")) (chr 92) "AutoCAD Template" (chr 92) "Templates.dwt") (list (list "Layouts" (list "11×17")))) .regen

For that macro you'll need Lee Mac's Steal from Drawing routine.

 

Don't forget to thank Lee if you use it!

Share this post


Link to post
Share on other sites
YZ

If the Macro truncates after running the NEW command, perhaps an easy solution (until you can get them to work together) is to have 2 button macros next to each other in the ribbon. One creates the new dwg, the other runs the lisps that create the layers.

 

If it were me I'd call scripts rather than lisp for building the layers, but whatever you are comfortable with (I am much more familiar with scripts). If you already have the lisp created then you definitely want to harness that.

Share this post


Link to post
Share on other sites
tombu

When adding or configuring layers in a drawing for a specific task like after importing shp files from GIS I'll import a Layer State to do it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×