Hi everyone,
I am constantly making viewports of my models. I would like to ask if there is a way to make a shortcut directly
to a specific template (like shift+..)?
Tiping layout, t, and searching for the template take just a few time but when you have to make 100 layouts it turns into a good amount of time.
I know i can go to CUI and create a command with a specific shortcut but i don't know if it is possible to request a specific layout that way.
Regards,
David
Ive just worked out the following which can be run as a script file
FILEDIA 0
LAYOUT
T
2005B.DWT
A3_
FILEDIA 1
Just copy the above and paste it into a text file with a .scr extension
Change the 2005b.DWT for your template file
Change the A3_ for your layout
NOTE before you do this your template file HAS to be in the default template directory.
Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Since this is all happening within the same DWG file, you don't really need to do this as a "script" (in the AutoCAD sense). This can easily be turned "horizontal" and written as a button macro:
^C^Cfiledia;0;layout;t;mytemplatefile;mylayoutname;filedia;0
Another approach to consider is DesignCenter. Layouts can be dragged and dropped from one DWG (or DWT, or DXF...) to another. Set DesignCenter to the template folder and file, and it's pretty quick.
@dmfrazier wrote:
Since this is all happening within the same DWG file, you don't really need to do this as a "script" (in the AutoCAD sense). This can easily be turned "horizontal" and written as a button macro:
^C^Cfiledia;0;layout;t;mytemplatefile;mylayoutname;filedia;0
I can never get the hang of doing them horizontally. I shall have to remember the ;
And it should be filedia;1 at the end to set the dialog boxes back (sorry :p)
Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Menu macro syntax is not really my forte, either, but I find it easier, and the menu macro more convenient, than creating, storing, and running a script. In most cases I prefer to use LISP code in the menu macro anyway.
Thanks for noticing the filedia error (apology accepted ).
Hi,
thanks for all the replies!!
The problem is i am new at all this, and it will take some time to try them all. Right now i am trying with the horizontal macro provided.
Firstly,I create the command with the text and the alterations and i gave a display name and i put it in a shortkey of the Partial customization files.
Fristly i thought the display name was what i had to put in the command line, an error because i searched and apparently you can t simply type the command??
Nonetheless even when i call him with the shotcut create nothing appens..
@hwalker wrote:Ive just worked out the following which can be run as a script file
FILEDIA 0
LAYOUT
T
2005B.DWT
A3_
FILEDIA 1
Just copy the above and paste it into a text file with a .scr extension
Change the 2005b.DWT for your template file
Change the A3_ for your layout
NOTE before you do this your template file HAS to be in the default template directory.
Thanks, i am trying this right now. It s working but it doesn t load dirreclty the template, He ask for the : Insert layout name().
I don t understand why. I created my layout then i save it and everytime i try to open it i ask me for Insert layout name() and i have to click
at unique layout existing.
Why it doesn t assume the name of the original layout, there is a way to skip this?
I'm not sure why it's not working. I've attached a script file which does work. I've just tried it on my machine. As I said change the 2005b.dwt and A3_ lines for what you want.
Change the .txt extension to .scr before you run it
Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
"...and i put it in a shortkey of the Partial customization files."
Depending on how (where) the partial CUI is loaded, you might not be able to run a custom command from a shortcut key.
"Fristly i thought the display name was what i had to put in the command line, an error because i searched and apparently you can t simply type the command??"
Correct. A "command" defined in the CUI is not available to run at the command line.
"Nonetheless even when i call him with the shotcut create nothing appens.."
Okay...here are the steps:
1. In the CUI editor, create a new "command" in your "main" CUI and give it a name that means something to you, based on its function, and a description (if you wish).
2. Copy the (corrected) macro code discussed earlier into the macro field.
3. Assign an icon image to the "command" (if you wish).
4. Put this new "command" into a toolbar (or menu) of your choice. (This is done by drag-drop from command list pane to the appropriate section in the CUI pane.)
5. Click the OK button to save and close the CUI editor.
6. Execute the "command" by clicking the toolbar button or menu you selected at step 4.
The lines works but still it ask me to choose the name of the layout, i try to put it in the code but autocad doesn t recognize it.
I put what it shows me when i run the code and the code. Maréchal is the name of the legend of the layout i want, I wanted to know if someway i can skip this step. ( taking out Maréchal is exactly the same in the code)
Try this AutoLISP code in a button macro:
(command "_.layout" "t" "normal.dwt" "Marechal")
Note: you might have to edit "Marechal" to include your special "e" character.
When I run it with my template and any of its layout names, it works.
To get your special e character do ALT+0201 for a capital É and ALT+0233 for a lowercase é
As to the script not working. Where is your NORMAL.DWT located?
The directory it should be in is the one which opens up when you change the drawing type in the file open box from DWG to DWT. If it is the right place the following text is what should happen
Command: '_script
Command: FILEDIA
Enter new value for FILEDIA <1>: 0Command: LAYOUT
Enter layout option [Copy/Delete/New/Template/Rename/SAveas/Set/?] <set>: T
Enter file name: 2005B.DWT
Enter layout name(s) or [?]: A3_
Duplicate definition of block GENAXEH ignored.
Duplicate definition of block attriba3a ignored.
Duplicate definition of block attriba2a ignored.
Duplicate definition of block _Oblique ignored.
Duplicate definition of block scalebar ignored.
Duplicate definition of block Datum ignored.
Press ENTER to continue:
Command: FILEDIA
Enter new value for FILEDIA <0>: 1
Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
I think the "horizontal macro" idea (using standard menu macro syntax) should be abandoned. Using that method, a dialog/selection box appears prompting for selection of a layout, and the OP doesn't want that.
With the script, that dialog/selection box doesn't appear, so the layout name specified in the script is used (assuming it exists).
The AutoLISP code in the menu macro works the same as the script (for me, anyway).
You were right about the script, the thing is i was creating in notepad and next i was copying the text and pasting in command line and it
was always prompting the layout name of the template. I wasn't able to save as .scr because i didn't have the file extension on in windows explorer.
Running it with a script in Autocad it works just fine with no irrating windows layout names prompting.
The question now is i have a script in desktop that works what is the best way to use it? Can i make a shorcut of it directly in Autocad?
well, in the meantime i also create the macro and put the command in a visible toolbar and i don´t think there is a fastest way to create layout from a template.
I appreciate all the help and the patience ( i am a rookie in all this), this will help me to save a lot of time.
Regards,
David Ribeiro
"...i have a script in desktop that works what is the best way to use it? Can i make a shorcut of it directly in Autocad?"
The "best" thing to do is place a copy of that script in one of the folders listed in your Support File Search Path (Options, Files tab, Support File Search Path). This way AutoCAD will be able to find it without including the path when you run the script command (see step #2, below).
The next thing to do is create a "command" in your CUI as I described before. (This is essentially "mak[ing] a shortcut of it").
Here are the steps again (modified to run your script):
1. In the CUI editor, create a new "command" in your "main" CUI and give it a name that means something to you, based on its function, and a description (if you wish).
2. Place this into the macro field: (command "_.script" "scriptname") - replacing scriptname with the name of your script file (without the extension).
3. Assign an icon image to the "command" (if you wish).
4. Put this new "command" into a toolbar (or menu) of your choice. (This is done by drag-drop from command list pane to the appropriate section in the CUI pane.)
5. Click the OK button to save and close the CUI editor.
6. Execute the "command" by clicking the toolbar button or menu you selected at step 4.
By the way, it is also possible to run an AutoCAD script by dragging-and-dropping the script file from a folder to the AutoCAD application window, but I think for the long run the button macro is best.
Just to humor me, did you ever try the AutoLISP code version of this "script" in a button macro? Just follow the same steps listed above, but at step #2, place the following code into the macro field:
(command "_.layout" "t" "normal.dwt" "Marechal")
Note that you must edit the layout name with your special character and you must ensure the template name is correct and that AutoCAD knows where to find it.
Please don't give up.