乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 83|回复: 8

[编程交流] Macro to open a dwg, then SAVE

[复制链接]

1

主题

5

帖子

4

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 17:14:11 | 显示全部楼层 |阅读模式
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?
回复

使用道具 举报

15

主题

102

帖子

106

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 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.
回复

使用道具 举报

1

主题

5

帖子

4

银币

初来乍到

Rank: 1

铜币
5
发表于 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???
回复

使用道具 举报

0

主题

252

帖子

290

银币

限制会员

铜币
-8
发表于 2022-7-6 17:36:55 | 显示全部楼层
to avoid the pause, use / instead of \ in your path
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 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
回复

使用道具 举报

1

主题

5

帖子

4

银币

初来乍到

Rank: 1

铜币
5
发表于 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.
回复

使用道具 举报

0

主题

252

帖子

290

银币

限制会员

铜币
-8
发表于 2022-7-6 18:06:11 | 显示全部楼层
add the .dwg maybe?
回复

使用道具 举报

1

主题

4

帖子

3

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 18:13:20 | 显示全部楼层
Definately add the .dwg
回复

使用道具 举报

1

主题

5

帖子

4

银币

初来乍到

Rank: 1

铜币
5
发表于 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.
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-4 16:36 , Processed in 0.934421 second(s), 70 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表