MiGo 发表于 2022-7-6 04:38:48

 
我喜欢script pro。我们一直在使用它,唯一的quark是它为每个图形打开autocad并关闭它。关闭cad时,似乎会强制出错,因此对于每个dwg,您都会收到通常发送给他们的AutoCAD错误消息。

Commandobill 发表于 2022-7-6 04:43:01

我不认为你需要脚本专业。。。我认为,如果您使用lisp并让它编写一个脚本,告诉autocad为每个对象运行lisp。如果找到了,那么谜题就完成了。。。只是还没有人把它简化到那个程度。。。每个人似乎都认为需要编写脚本和lisp。但是你可以让lisp为你编写脚本,并让它在任何情况下重新编写它。。。

Lee Mac 发表于 2022-7-6 04:44:21

像这样简单的事情应该可以做到:
 

(defun c:rscr (/ wfile rfile ofile)
(if (and (setq wfile (getfiled "\nSelect File to Write to: " "" "scr" 1))
          (setq rfile (getfiled "\nSelect File from Directory to Read: " "" "dwg" ))
   (progn
   (setq ofile (open wfile "w"))
   (foreach x (vl-directory-files (vl-filename-directory rfile) "*.dwg" 1)
       (write-line (strcat "open " x " (load \"mylisp\") close \"Y\"") ofile))
   (close ofile))
   (princ "\n<!> File Selection Error <!>"))
(princ))

 
这很容易修改。

Shawndoe 发表于 2022-7-6 04:47:35

你好
 
就我个人而言,我不喜欢混合脚本和LISP例程。只是感觉。。。错误的所以我想出了一个解决办法。我的代码包含在NDA中,因此我无法为您发布,但我会为您提供在没有脚本的情况下执行所需的步骤。
 
<br>I. Create a routine to run from drawing1.<br>   a. Create a list of routines to run. <br>   b. Create a list of work drawings for processing.<br>   c. Place the routines list in the vlisp blackboard.<br>   d. Open the first work drawing in list.<br>      1. Drawing1 lisp processing is suspended.<br>      2. Startup routine in acad20xxdoc.lsp begins.<br>      3. See Section II<br>   e. Save and Close current work drawing.<br>   f. Back to step d and open next work drawing in list.<br>II. Create startup routine for acad20xxdoc.lsp<br>   a. Check vlisp blackboard for routines list.<br>      1. If there load the first routine.<br>      2. Otherwise normal startup<br>   b. Execute the routine. <br>      1. This is the actual work you want done to the drawings.<br>      2. See section III<br>   c. Repeat from step a for all routines in list.<br>   d. Do not set the work drawing as active.<br>      1. Opening a drawing is different from making it active.<br>      2. When made active, control will not return to drawing1.<br>      3. Inactive drawings will execute all startup routines then hand control back to the last active drawing.<br>III. Create the routines to make your drawing changes.<br>   a. Can be any routine that does not require user input.<br>
 
这将运行任何不需要命令行输入的例程。在所有启动例程完成之前,命令行不可用。这意味着没有GetString或其他命令行用户输入。如果您最终需要用户输入,则必须制作DCL才能获得它。
 
如果你有任何问题,请告诉我,我会尽力帮助你。
 
祝你过得愉快。
肖恩多

Commandobill 发表于 2022-7-6 04:49:45

 
它可以工作,但只允许单选。。。

Lee Mac 发表于 2022-7-6 04:54:45

 
单选????
 
你从包含你想要的所有文件的目录中选择一个文件,它就会得到所有文件。。。

Commandobill 发表于 2022-7-6 04:56:16

我道歉。我同时处理多项任务,但没有意识到。它工作得很好。

Lee Mac 发表于 2022-7-6 05:01:35

 
你让我担心了一分钟。。
 
别担心伙计,
 
干杯
 

Rsteel13 发表于 2022-7-6 05:04:54

李·麦克,
 
我对您的代码进行了以下修改:
 
3
 
并在我的新创建中获得以下结果。scr文件:
 
 
运行脚本时,Autocad无法找到文件,因为没有显示路径。我尝试更改目录设置的标志,但无法产生任何有价值的内容。有什么想法吗?
 
谢谢
罗伯特

Lee Mac 发表于 2022-7-6 05:05:57

我还试图修改旗帜,但没有成功。
 
我认为最简单(也是欺骗的方式)的办法是要么改变ACAD搜索路径也在你的文件夹中搜索,要么在ACAD搜索路径中创建一个文件夹并将文件放在那里。
 
但我被困在其他地方
页: 1 [2]
查看完整版本: 在几个屏幕上重复lisp例程