dcowell 发表于 2022-7-6 17:14:11

Macro to open a dwg, then SAVE

I'm working on a custom partial CUI menu for my firm. (I'm using AutoCad 2007.) I have a few drawings setup with items in both paperspace and modelspace.So, within the pulldown/menu, I've created a command with the following macro (that does not work)...
 
^c^cfiledia;0;open,Sheet-Setup_ID1-1_Notes;Saveas;
 
Any ideas?

neekcotrack 发表于 2022-7-6 17:25:51

 
Try doing something like this:
 
You are not putting the location path like this:
 
C:\Test\Test\Test\Sheet-Setup_ID1-1_Notes.dwt
 
Plus after the saveas command it will as what version would you like to save it as, and the location you would like to save it to.
 
Try tryping the commands in one at a time in the command line.

dcowell 发表于 2022-7-6 17:31:06

Thanks for the response.However, if I add the path, the macro thinks it's a "pause", thus, I've placed the path in the SUPPORT FILE SEARCH PATH under the OPTION, File tab (which worked for block, etc. in the menu).Note, placing a "quote" around the path & file name did not work either.
 
After the saveas, I think I'd like the user to enter the rest of the information. So the prompt is good.
 
Right now, it does goto asking the version, but when done and saveas file path and name entered; the actual file it was supposed to open was not completed.Must be something with the open and all the lisp routines, etc. that need to run.Maybe the macro is not giving it enough time to "Open" before it asks for saving???

CmdrDuh 发表于 2022-7-6 17:36:55

to avoid the pause, use / instead of \ in your path

BIGAL 发表于 2022-7-6 17:49:44

One problem autocad has is with directory names that have spaces in them change the space to a _ and often problem solved.
 
eg old \projects\joe blogs\job54
new   \projects\joe_blogs\job54

dcowell 发表于 2022-7-6 17:55:08

Okay, still working on this and I'm thankful for all your input.Here's my Macro...I've simplified it for now not to do the SAVEAS as I can add that once it's working.
 
^c^cfiledia;0;open;T:/AutoCad2007/library/PKS/Sheet_Setup/Sheet-Setup_ID1-1_Notes;
 
I've checked all the spellings and I don't use spaces in folders or files.However, Autocad hangs up and shows...
 
Command: filedia
Enter new value for FILEDIA : 0
Command: open
Command: T:/AutoCad2007/library/PKS/Sheet_Setup/Sheet-Setup_ID1-1_Notes
Unknown command
"T:/AUTOCAD2007/LIBRARY/PKS/SHEET_SETUP/SHEET-SETUP_ID1-1_NOTES".Press F1 for
help.

CmdrDuh 发表于 2022-7-6 18:06:11

add the .dwg maybe?

craigjonnson 发表于 2022-7-6 18:13:20

Definately add the .dwg

dcowell 发表于 2022-7-6 18:21:28

Okay, I added the .dwg, and the same problem appears. I'm actually thinking it's between the "open" and the ; see below. Even though when you type it you need to hit the return, is there some other symbol to use here instead of ; which, if you look below, looks like it terminates the macro and sees the path as a new command.
 
Command: filedia
Enter new value for FILEDIA : 0
Command: open
Command: T:/AutoCad2007/library/PKS/Sheet_Setup/Sheet-Setup_ID1-1_Notes.dwg
Unknown command
"T:/AUTOCAD2007/LIBRARY/PKS/SHEET_SETUP/SHEET-SETUP_ID1-1_NOTES.DWG". Press F1
for help.
页: [1]
查看完整版本: Macro to open a dwg, then SAVE