Opening a new template using custom user interface

Opening a new template using custom user interface

Dmelli
Participant Participant
2,140 Views
13 Replies
Message 1 of 14

Opening a new template using custom user interface

Dmelli
Participant
Participant

Hey guys,

 

I've been struggling with this routine/macro/script... I have 3 templates totally different and I wanted to open the specific template relate to their specific button created in custom user interface...only one click. Is it possible? I searched for examples or same situations here in this forum but nothing worked.

Could someone help me??? Tks

0 Likes
Accepted solutions (1)
2,141 Views
13 Replies
Replies (13)
Message 2 of 14

pendean
Community Legend
Community Legend
What have you tried so far? How or where has i failed?

These three File names are...? The full path location to them is...?
Are they actual DWT template files, or are you using the term "template" loosely to refer to DWG files?

Any reason you don't just create a shortcut in Windows to them on your desktop and just double-click when needed? Or is this a need-every-few-hours-in-a-day time task you want?

Message 3 of 14

Dmelli
Participant
Participant

Hey pendean,

 

This was my last shot and at least it


@pendean wrote:
What have you tried so far? How or where has i failed?

These three File names are...? The full path location to them is...?
Are they actual DWT template files, or are you using the term "template" loosely to refer to DWG files?

Any reason you don't just create a shortcut in Windows to them on your desktop and just double-click when needed? Or is this a need-every-few-hours-in-a-day time task you want?



opened the template...I used the context: ^C^C_FILEOPEN;QNEW;C:/USERS/DMELLI/DESKTOP/TOOL_TEST/Temp_1.DWT;FILEOPEN;1;

 

Then a message box appears: "Cannot find the specified drawing file. Please verify that the file exists." On this message you can click "OK" and it opens the template. In the command line it says "unable to display start tab". The command icons on the tab don't show until I pass the mouse over so that loads the icons.

0 Likes
Message 4 of 14

Dmelli
Participant
Participant

I am sorry...I didn't put a few information that you requested.

The file path: C:/USERS/DMELLI/DESKTOP/TOOL_TEST/temp_1.DWT

The template file (it is an actual template, not a drawing to start): temp_1.dwt

I wanted to have something easier on the workspace instead of having a desktop shortcut to load them because it is a need for a few hours task. 

0 Likes
Message 5 of 14

pendean
Community Legend
Community Legend
Teaching moment: FILEOPEN and QNEW are two separate commands, why do you have one right after the other?

Why don't you try it again without QNEW (and the semi-colon after it), put your file path/name line in double-quotes and observe if / where it fails after that from the commandline.

Message 6 of 14

Dmelli
Participant
Participant

Here is what I did: ^C^C_FILEOPEN;"C:/USERS/DMELLI/DESKTOP/TOOL_TEST/temp_1.DWT"

After that, it showed me this message: Cannot run FILEOPEN if SDI mode cannot be established.
Command: "C:/USERS/DMELLI/DESKTOP/TOOL_TEST/temp_1.DWT" Unknown command "DWT"". Press F1 for help.

So I opened one new drawing using QNEW, type SDI and changed the value to 0.

 

Changing SDI value to 0 allows me to open multiple drawings. It loads the template but shows me this message on the command line: 

Command: _FILEOPEN
Enter name of drawing to open <.>: "C:/USERS/DMELLI/DESKTOP/TOOL_TEST/temp_1.DWT"
Opening an AutoCAD LT 2018/AutoCAD 2018 format file.
Substituting [simplex.shx] for [@Arial Unicode MS].
Substituting [simplex.shx] for [@Arial Unicode MS].
Substituting [simplex.shx] for [cdisol].
Regenerating model.
Command:
**** System Variable Changed ****
2 of the monitored system variables have changed from the preferred value. Use SYSVARMONITOR command to view changes.
Unable to display Start tab. The Start tab will be restored after the application is restarted.

 

If I change the SDI value to 1 it opens with no problem but only 1 drawing at time.

0 Likes
Message 7 of 14

pendean
Community Legend
Community Legend
Macros are good at exposing problems 🙂
So you fixed what appears to have been a problematic SDI variable setting in your session, that's good. Which is your preference, SDI=0 or SDI=1? Most AutoCAD users prefer SDI=0. Look up usage in HELP.

SYSVARMONiTOR is just doing its job, you appear to have it set to alert you of changes to system variables you changed. You can just remove them from that list if you wish or use this alert as a reminder to change them back.

STARTMODE can be turned off IMHO: it is useless in my opinion and I have always had it off here: just remember to set STARTUP variable to 1 at least (how I like it), look up usage in HELP for other options with that variable.

BTW: looks like you need to fix/address all those missing fonts in your template files, do so now. @fonts are printer specific and you should not be using them ever, and it looks like you do not have the one called cdisol so why keep it referenced in your files.

Message 8 of 14

Paul_Gander
Advocate
Advocate
Accepted solution

You need to use the command NEW to open a template file as a new drawing. It won't work in a macro but you can put it in a script file and then call the script from a macro. Use the FILEDIA setting to suppress the file browser.

 

For example: Save the following text in your tool_test folder as "new_temp_1.scr"

_new "c:/users/dmelli/desktop/tool_test/temp_1"
_filedia 1

and call it from a toolbar/ribbon button with the following macro:

^C^C_filedia;0;_script;"c:/users/dmelli/desktop/tool_test/new_temp_1"
Message 9 of 14

pendean
Community Legend
Community Legend
FILEOPEN command in a macro works just fine, try it: its an old but useful undocumented command designed for macro writing.





Message 10 of 14

Paul_Gander
Advocate
Advocate

Thanks Dean. I wasn't aware of that command. It's an interesting one. It doesn't work if more than one file is open with SDI set to 0 and it closes the current drawing before opening the next. I wouldn't use it for starting a new drawing though.

Message 11 of 14

Dmelli
Participant
Participant

Perfect. I was about to describe it...lol

 

So I tried both suggestions.

Using "FILEOPEN" didn't allow me to open multiples "drawings" because of the SDI settings (0 or 1). Another detail is that when closing it had a risk to overwrite the dwt file...then I realized that FILEOPEN is opening the file that has DWT extension and not using a new drawing with the template (of course, I didn't think about it -_- ).

 

Using the command "NEW" allowed me to open a new drawing with the template file. 

 

Thanks Dean...that was a big input and a huge teaching moment to me and now a have more tools that I need to learn how to use... Thanks Paul, everything runs smooth.

0 Likes
Message 12 of 14

pendean
Community Legend
Community Legend
Thanks to Paul for offering another option.

Message 13 of 14

Anonymous
Not applicable

Dear sir I am not access 3D Modeling tool workspace please clear my problem

0 Likes
Message 14 of 14

steven-g
Mentor
Mentor

Your reply has nothing to do with the original post! But this is the LT forum AutoCAD LT does not have the 3D modelling tools, that is only available in full AutoCAD. If you have any more questions please start a new thread for those.