alexmai 发表于 2021-9-18 11:15:45

为什么总出现报错 nil

等分块命令:
(Command "DIVIDE" (entsel) "B" (cdr (assoc 2 (entget (car (entsel))))) "Y")

(Command "DIVIDE" pause "B" (cdr (assoc 2 (entget (car (entsel))))) "Y")

在选择物体时,会立即出现: nil ,究竟是为什么,如何避免这个报错?

gaics 发表于 2021-9-18 15:09:28

本帖最后由 gaics 于 2021-9-18 17:06 编辑

(Command "DIVIDE" (entsel) "B" "块名" "Y" )直接给定块名,也是返回nil
(Command "DIVIDE" (entsel) "B" "块名" "Y" 5)
最终返回nil
(Command "DIVIDE" (entsel) "B" "块名" "Y" 5)(princ)
没有提示
建议这么写:
(Command "DIVIDE" (entsel) "B" (cdr (assoc 2 (entget (car (entsel))))) "Y" pause)
或者通过变量传递等分数量
页: [1]
查看完整版本: 为什么总出现报错 nil