Jump to content

Recommended Posts

Posted

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?

Posted

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.

Posted

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

Posted

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.

Posted

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!

Posted

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.

Posted

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.

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