View Full Version : Macro,script?For my border set ups.
hyposmurf
30th Jun 2003, 06:54 pm
What Im hoping to do is use a number of menu buttons to individually insert each standard company border,this button will also configure my page setup and plot settings details for each different border.Maybe Im over eager and expecting too much :) but this would be incredibly handy.I already have my menu buttons configured so I can insert each border,but as far as the page set up and plot settings Im not sure of :? .As far as I know I wont be able to use a macro for the page setup and plot settings,but would need a script.Ive never created a script before though :( .Is this the right method or is there another method?Can anyone give me some guidance on scripts if it is?Can I use a macro and script from one menu button or do I need two?
Flores
30th Jun 2003, 10:46 pm
(You failed to mention which version of Autocad, but this will work with 2k+)
Why not make a template drawing with all of your settings so all of this will be pre-configured? We only use horizontal and vertical a-size, and horizontal d-size layouts. We have layouts with the page setups and borders already inserted (and dimstyles, layers, etc.). If you need another layout, just right-click the layout tab, and select "move or copy", and then choose "copy".
Save your template drawing as a .dwt for new drawings, and also save it as a .dwg for older drawings. To insert layout with border (even layers, dimstyle, etc.) into an older drawing, use the design center (adcenter) to insert whatever you want.
Flores
fuccaro
1st Jul 2003, 07:18 am
I agree with Flores.
Hyposmurf you may create some templates with (printer) setups, borders and so on. For each often-used template you may create a button to open it. So arranging all this buttons in a toolbar you will have a simple and quick way to start your drawing from the desired template.
hyposmurf
1st Jul 2003, 08:59 am
Yeh I see what you mean,a template would be the ultimate way to go.If I use say a macro to insert a template like this:
^C^C(COMMAND "INSERT" "A0") "AO" being my template file,this should work I hope :) ,but will this mean that all my previous settings in the drawing will now be changed to the template file I just inserted?This would be the desired outcome though.Also thinking that I could have my borders already set up within this template file and also my main vport :) ,Will just have to try it out see!Yeh it's CAD 2K by the way,I have a habit of switching from other forums and forgetting to state which one I use :) ,you dont have to in other forums.
hyposmurf
1st Jul 2003, 11:57 am
Right Ive had a go and this is what I came up with:
^C^C(COMMAND "-LAYOUT""T""A0HTG" )
This starts the layout command,then "T" to select the template option and my preconfigured template is AOHTG".However it doesnt work exactly how I want it to :( !This is what I get:
Command: (COMMAND "-LAYOUT""T""A0HTG" ) -LAYOUT
Enter layout option [Copy/Delete/New/Template/Rename/SAveas/Set/?] <set>: T
Enter file name: A0HTG Enter layout name(s) or [?]: nil
Enter layout name(s) or [?]:
So its asking for my layout names,if I suggest Layout1 then it adds another layout called Layout3-Layout1.Even though it has inserted the template I wanted,I was hoping to have the inserted template replace my existing Layout 1 and not add any other template names.
My final macro that still needs some tweaking is:
^C^C(COMMAND "-LAYOUT""T""A0HTG""Layout1" ) Can anyone just help me out with the last bit?
fuccaro
1st Jul 2003, 02:08 pm
I hope I will never be enforced to work on your computer. Probable your AutoCAD looks like the control panel of a space shuttle.
(COMMAND "-LAYOUT""TEMPLATE""A0HGT.DWT""LAYOUT1")
(COMMAND "-LAYOUT""DELETE""LAYOUT1")
(COMMAND "-LAYOUT""RENAME""LAYOUT3-LAYOUT1""LAYOUT1")
hyposmurf
1st Jul 2003, 02:36 pm
I hope I will never be enforced to work on your computer. Probable your AutoCAD looks like the control panel of a space shuttle.
(COMMAND "-LAYOUT""TEMPLATE""A0HGT.DWT""LAYOUT1")
(COMMAND "-LAYOUT""DELETE""LAYOUT1")
(COMMAND "-LAYOUT""RENAME""LAYOUT3-LAYOUT1""LAYOUT1")
That doesnt look as dificult as I thought :) ,you add in two new functions.I've added it to my button and it all works,but the help menu pops up right at the end.Is there a way to stop this from popping up?This is what I get get in my command window:
Command: (COMMAND "-LAYOUT""TEMPLATE""A0HTG.DWT""LAYOUT1") -LAYOUT
Enter layout option [Copy/Delete/New/Template/Rename/SAveas/Set/?] <set>:
TEMPLATE Enter file name: A0HTG.DWT Enter layout name(s) or [?]: LAYOUT1
Command: nil
Command:
_HELP
Command:
HELP
Command: (COMMAND "-LAYOUT""DELETE""Layout1") -LAYOUT
Enter layout option [Copy/Delete/New/Template/Rename/SAveas/Set/?] <set>: DELETE
Enter name of layout to delete <Layout1>: Layout1 Regenerating model.
Layout "Layout1" deleted.
Command: nil
Command:
HELP
Command:
HELP
Command: (COMMAND "-LAYOUT""RENAME""Layout3-Layout1""Layout1") -LAYOUT
Enter layout option [Copy/Delete/New/Template/Rename/SAveas/Set/?] <set>: RENAME
Enter layout to rename <Layout2>: Layout3-Layout1
Enter new layout name: Layout1 Layout "Layout3-Layout1" renamed to "Layout1".
Command: nil
Yeh my screen is beginning to look that way,though its only 17" so cant have too many buttons.It seems to be the trend at work to have your own buttons and I personally find them a great help at speeding tasks up,where as the accelerator keys are a bit limited.Thanks Fuccaro
fuccaro
1st Jul 2003, 03:15 pm
Just wondering:
was it HELP the last command sent to AutoCAD before to use your new macro? If so probable an extra space or <enter> tells to AutoCAD to repeat the last command. If this is the situation you should find out the way to correct the situation. Today AutoCAD repeats the Help command but next time it could be something more difficult to correct!
This is just my opinion, as i wrote before I am not so good in macros. This means from here you are on your own.
Flores
1st Jul 2003, 09:18 pm
^C^C(COMMAND "-LAYOUT""T""A0HTG" )
Actually, in a tool-button macro, you do not need the "command" or any other quotes. This is what you would need, assuming that the template is in your support path:
-LAYOUT T A0HGT.dwt LAYOUT1
In macros, a space between words is equivalent to an "enter", a semi-colon is equvalent to an enter also, so the following will work also:
-LAYOUT;T;A0HGT.dwt;LAYOUT1
My template layouts have names like "a_horizontal", "a_vertical" etc. so it is easy to see what each layout contains.
Flores
fuccaro
2nd Jul 2003, 10:38 am
Thank you Flores!
I feel lucky because in macros you may insert lisp expressions and you may call Lisp functions.
hyposmurf
2nd Jul 2003, 01:05 pm
I didnt know that either,as Im relatively new to macros,does any one know of any good sites for CAD macros?
hyposmurf
2nd Jul 2003, 07:02 pm
^C^C(COMMAND "-LAYOUT""T""A0HTG" )
Actually, in a tool-button macro, you do not need the "command" or any other quotes. This is what you would need, assuming that the template is in your support path:
-LAYOUT T A0HGT.dwt LAYOUT1
In macros, a space between words is equivalent to an "enter", a semi-colon is equvalent to an enter also, so the following will work also:
-LAYOUT;T;A0HGT.dwt;LAYOUT1
My template layouts have names like "a_horizontal", "a_vertical" etc. so it is easy to see what each layout contains.
Flores
Thanks your help.If I apply whatr youve said how do I enter my next two commands delete and rename?Do I leave gaps in between them or do some thing else?This is what it would look like:
-LAYOUT T A0HTG.DWT LAYOUT1^M -LAYOUT DELETE Layout1^M -LAYOUT RENAME Layout3 -Layout1 Layout1 DELETE Layout1
Though it doesnt work :(
Powered by vBulletin™ Version 4.1.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.