meng2025 发表于 2025-2-17 10:17:14

调用command报错

程序如下
(defun c:lsp_01()
(setvar "cmdecho" 0)
(setq cenpt (getpoint "\n 中心点:"))
(setq hh (getdist cenpt "\n 高度 <50>:"))
(if (null hh) (setq hh 50.0))
(setq ww (* hh 2))
(setq pt1m (polar cenpt pi hh))
(setq pt1 (polar pt1m (* pi 1.5) (/ hh 2)))
(setq pt2 (polar pt1 0 ww))
(setq pt3 (polar pt2 (/ pi 2) hh))
(command "_rectang" pt1 pt3)
(command "_circle" cenpt pt1)
)
运行到command这行时就提示
; 错误: 出现异常: 0xC0000005 (访问冲突)
; 警告: 忽略展开 异常
; 错误: 出现异常: 0xC0000005 (访问冲突)

请问是什么原因?

自贡黄明儒 发表于 2025-2-17 10:21:03

重新安装过,实在不行换电脑

meng2025 发表于 2025-2-17 10:45:20

自贡黄明儒 发表于 2025-2-17 10:21
重新安装过,实在不行换电脑

OK,修复后就可以用了,谢谢

xyp1964 发表于 2025-2-17 11:29:34

(defun c:tt ()
(setq hh (getdist "\n高度<50>: "))
(if (null hh)
    (setq hh 50.0)
)
(while (setq p0 (getpoint "\n中心点: "))
    (setq p1 (mapcar '+ p0 (list (- hh) (* hh -0.5)))
          p2 (mapcar '+ p0 (list hh (* hh 0.5)))
    )
    (command "_rectang" "non" p1 "non" p2)
    (command "_circle" p0 "non" p1)
)
(princ)
)

meng2025 发表于 2025-2-18 11:42:50

xyp1964 发表于 2025-2-17 11:29


强大!又学到了。

yanshengjiang 发表于 2025-2-19 09:58:20

xyp1964 发表于 2025-2-17 11:29


不知道前4行替换为(or hh (setq hh (getdist "\n高度<50>: "))行不行
页: [1]
查看完整版本: 调用command报错