ksperopoulos 发表于 2022-7-6 07:50:06

删除所有尺寸

我试图删除图纸中的所有尺寸,但我一直在思考如何实现这一点。
 

(defun C:edims ()
(command "erase"(ssget (list (cons 0 "DIMENSION"))) "all" "")
(princ)
)

ksperopoulos 发表于 2022-7-6 07:54:25

我想我明白了。至少它似乎奏效了。
 

(defun C:edims ()
(command "erase" (ssget "x" (list (cons 0 "DIMENSION"))) "" (princ)
)
)

Tharwat 发表于 2022-7-6 07:59:10

你好
以下代码将在无故障的情况下运行;错误:参数值错误:AutoCAD命令
因为你的代码响应命令行,你可以检查一下。
(defun C:edims (/ er)
(setq er(ssget "_x" (list (cons 0 "DIMENSION"))))
(command "_erase" er "")
(princ)
)

当做
塔尔瓦尔

VVA 发表于 2022-7-6 08:02:19

最好使用掩码*维度。在Autocad 2008中添加更多ARC_标注

(defun C:edims (/ ss)
(if (setq ss (ssget "_x" (list (cons 0 "*DIMENSION"))))
   (command "_erase" ss "")
   )
(princ)
)

Tharwat 发表于 2022-7-6 08:04:22

 
你好
我想知道那个Astrick有什么用。
 
顺致敬意,
塔瓦特

CHLUCFENG 发表于 2022-7-6 08:06:50

星号(*)表示维度之前任意数量字符的通配符。
 
我经常用它来冻结建筑图纸中的家具层。
 
例如,在命令行键入:
 
(command "layer" "F" "*furn*" "")
 
连续(按该顺序)包含字母“furn”的所有层将被冻结。

Tharwat 发表于 2022-7-6 08:12:17

 
谢谢你的解释。。。但是我也试过了,它和你的一样有效。
(command "layer" "F" "furn" "")
 
那么它们之间的区别是什么呢。
 
当做
塔瓦特

Lee Mac 发表于 2022-7-6 08:14:29

在帮助文件中查找wcmatch。

VVA 发表于 2022-7-6 08:20:15

在/-局部变量后命名。生命中的时间-定义它们的身体功能(命令)
小示例

(defun C:TEST1 ( )
;;;str - a global variable. It retains its value after the command
(setq str (getstring "\nType any word: "))
(princ "\nYou enter ")(princ str)
(princ)
)

(defun C:TEST2 (/ str1 )
;;;str1 - a local variable. It is removed after the completion of command
(setq str1 (getstring "\nType any word: "))
(princ "\nYou enter ")(princ str1)
(princ)
)

和结果

Lee Mac 发表于 2022-7-6 08:22:05

我不久前写的一个老常见问题。。。
 
http://www.cadtutor.net/forum/showpost.php?p=265649&postcount=4
页: [1] 2
查看完整版本: 删除所有尺寸