mgreathouse 发表于 2022-7-5 17:02:47

未知(command-s)故障。

我在尝试使用AutoCAD MEP 2017导入DGN并保存DWG时遇到了此LISP文件的问题。当我运行脚本时,它显示以下错误:
这发生在CAD中显示任何类型的活动之前,所以我假设这发生在文件中的第一个(command-s)上。知道这是什么原因吗?我使用的代码基于m.Moolhuysen的版本。
 
编辑:可能值得注意的是,我重新启动了CAD,现在似乎是在第一次延迟之后发生的,我根本没有更改代码。
 
(defun C:KURCONV (/ fil tx1 tx2 tx3 tx5)
   (setq tx1 "C:\\Users\\mgreathouse\\Desktop\\DGN to DWG\\dgnlist.txt"   ;; list of file names to be imported
       tx2 "C:\\Users\\mgreathouse\\Desktop\\DGN to DWG\\Input DGNs\\"    ;; input folder.
       tx3 "C:\\Users\\mgreathouse\\Desktop\\DGN to DWG\\Output DWGs\\"   ;; output folder.
   )
   (setq fil (open tx1 "r"))
   (setq tx5 (read-line fil))

; repeats program until all lines from tx1 have been read in
   (while tx5
       (command-s "_-DGNIMPORT" (strcat tx2 tx5) "" "" "")
       (command-s "._DELAY" 1000)
       (command-s "_Z" "e")
       (command-s "_-LAYOUT" "set" "20x29")
       (command-s "_MVIEW" "L" "ALL" "OFF" "")
       (command-s "_.MSPACE")
       (command-s "_Z" "e")
       (command-s "_.PSPACE")
       (command-s "_MVIEW" "L" "ALL" "ON" "")
       (setq tx5 (substr tx5 1 (- (strlen tx5) 4)))
       (command-s "_SAVEAS" "" (strcat tx3 tx5))
       (command-s "._DELAY" 1000)
       (command-s "_-LAYOUT" "set" "model")
       (command-s "_DELETE" "all" "")
       (setq tx5 (read-line fil))
   )
(close fil)
)

Lee Mac 发表于 2022-7-5 17:37:18

请尝试以下操作:
2

mgreathouse 发表于 2022-7-5 17:52:40

这真是太棒了!一旦我转换了所有这些DGN,我将对您使用的一些lisp函数做一些研究,找出它们的区别,以及为什么这样做更好。今晚应该让我很忙,并帮助我学习更多,因为我对AutoLISP很陌生。
 
谢谢!

Lee Mac 发表于 2022-7-5 18:22:24

不客气!
页: [1]
查看完整版本: 未知(command-s)故障。