Qwer1243 发表于 2025-1-4 11:12:01

为什么在cad2020中以下代码运行不了?

;;;*****倒直角优化****
(defun c:w1 (/ txt)
(setvar "cmdecho" 0)
(setq txt (memory "\n输入倒角距离<" 'txt_dzj 20))
(command-s "_.chamfer" "d" txt txt "_.chamfer" "u")
(princ)
)(defun memory (str var mor /)
(or (eval var) (set var mor))
(setq strtmp (getreal (strcat str (rtos (eval var) 2 4) ">")))
(if (null strtmp) (setq strtmp (eval var)))
(set var strtmp)
)为什么(command-s "_.chamfer" "d" txt txt "_.chamfer" "u")这句在cad2020中运行不了,在2014中运行是可以的,有没有什么解决办法

pzweng 发表于 2025-1-4 13:07:27

设置系统变量用的?
有直接对应的系统变量:chamfera和chamferb

hi7720 发表于 2025-1-4 13:14:15

(command-s "_.chamfer" "d" txt txt "_.chamfer" "u")
改成
(command "_.chamfer" "d" txt txt "_.chamfer" "u")

qazxswk 发表于 2025-1-4 13:19:03

txt_dzj是啥玩意?

Qwer1243 发表于 2025-1-4 13:39:45

hi7720 发表于 2025-1-4 13:14
(command-s "_.chamfer" "d" txt txt "_.chamfer" "u")
改成
(command "_.chamfer" "d" txt txt "_.chamf ...

cad2020 (command)用不了的

Qwer1243 发表于 2025-1-4 13:44:42

qazxswk 发表于 2025-1-4 13:19
txt_dzj是啥玩意?

一个记忆变量

qazxswk 发表于 2025-1-4 13:48:27

改为command在2021上可以运行

Qwer1243 发表于 2025-1-4 13:49:10

pzweng 发表于 2025-1-4 13:07
设置系统变量用的?
有直接对应的系统变量:chamfera和chamferb

你这个思路可以,直接设置系统变量,我试了一下是可行的, 感谢回复

Qwer1243 发表于 2025-1-4 13:57:44

qazxswk 发表于 2025-1-4 13:48
改为command在2021上可以运行

我刚才试了一下,2020好像也可以,我现在用的是笔记本
我记得我在单位的台式机2020是不行的,不知道是什么原因
页: [1]
查看完整版本: 为什么在cad2020中以下代码运行不了?