弯头autolisp项目。。someon公司
这是最终产品。 两件事(dtr 0)是0.0,没有SW提示,因此没有pt1 我已经在您的代码中指出了一些错误:(defun C:Elbow (/IP P1 P2) ;add spaces
(defun newerr (msg)
(princ (strcar "\n *ERROR* : "msg)) ;wrong function name - should be STRCAT
(setvar "MENUECHO" me)
(setvar "CMDECHO" ce)
(setvar "clayer" cl)
(gc) (princ)
)
(setq acaderr *error*
*error* newerr
me (getvar "MENUECHO")
ce (getvar "CMDECHO")
cl (getvar "CLAYER") ;missing parenthesis
)
(setvar "menuecho" 0)
(setvar "cmdecho" 0)
(graphscr)
(defun dtr (A)
(*PI (/ A 180.0)) ;missing space after function
) ;missing parenthesis
(defun rtd (A)
(/ (* A 180.0) PI)
)
(setq IP (getpoint "\nPick Insertion Point: "))
(setq P1 (Polar IP (dtr 0) SW)) ;SW variable isn't defined
(setq CP (Polar P1 (dtr 0) 4))
(setq P2 (Polar CP (dtr 90) 4))
;OSMODE system variable must be disabled prior of calling commands
(command "line" IP P1 "")
(command "arc" P2 "C" CP P1)
(command "line" P2 P3 "") ;P3 variable isn't defined
;wrong placed parenthesis
(setvar "MENUECHO" me)
(setvar "CMDECHO" ce)
(setq *error* acaderr)(gc)
(princ)
)
此外,请根据代码发布规则编辑您的帖子。 非常感谢你们的反馈。。我将应用所有内容并再次运行它。。祝我好运! 祝你好运让我们知道进展如何。 试试这个简单的代码
(defun c:Elbow (/ dtr w r p p1 p2 p3)
(defun dtr (A)
(* PI (/ A 180.0))
)
(if (and (setq w (getdist "\n Specify the width :"))
(setq r (getdist "\n Specify the radius of small arc :"))
(setq p (getpoint "\nPick Insertion Point: "))
)
(progn
(setq p1 (Polar p pi w)
p2 (polar (polar p 0. r) (dtr 90.) (+ w r))
p3 (Polar p2 (dtr 270) w)
)
(command "_.line"
"_none"
p
"_none"
p1
""
"_.arc"
"_none"
p2
"_E"
p1
"_a"
90.
"_.line"
"_none"
p2
"_none"
p3
""
"_.arc"
"_none"
p3
"_e"
p
"_a"
90.
)
)
)
(princ)
)
再次出现了一些错位/括号缺失;SW变量仍未定义;您忽略了我关于OSMODE系统变量的建议。
(defun C:Elbow (/ IP P1 P2)
(defun newerr (msg)
(princ (STRCAT "\n *ERROR* : "msg))
(setvar "MENUECHO" me)
(setvar "CMDECHO" ce)
(setvar "clayer" cl)
(gc) (princ)
)
(setq acaderr *error*
*error* newerr
me (getvar "MENUECHO")
ce (getvar "CMDECHO")
cl (getvar "CLAYER")
)
(setvar "menuecho" 0)
(setvar "cmdecho" 0)
(graphscr)
(defun dtr (A)
(* PI (/ A 180.0))
)
(defun rtd (A)
(/ (* A 180.0) PI)
)
(setq IP (getpoint "\nPick Insertion Point: "))
(setq P1 (Polar IP (dtr 0) SW))
(getpoint "\nPick the second point: "))
(setq CP (Polar P1 (dtr 0) 4))
(setq P2 (Polar CP (dtr 90) 4))
(setq P3 (Polar P2 (dtr 0)))
(command "line" IP P1 "")
(command "arc" P2 "C" CP P1)
(command "line" P2 P3 "")
(setvar "MENUECHO" me)
(setvar "CMDECHO" ce)
(setq *error* acaderr)(gc)
(princ)
)
我们的新朋友Tharwat正在学习AutoLISP课程,如第一篇文章所述;我相信,如果一个人指出他/她的错误,而不是提供一个功能性的例行程序,他/她将受益更多。
可以
*SW代表什么?
*带有getpoint的函数没有稍后使用的变量,否则它目前没有任何意义
*点3没有距离值
希望这有帮助 观察得好,塔尔瓦!
塔托法斯塔,你现在行动。 因此,我修改了原始代码以定义SW,并插入了OSMODE命令。。它成功了!!我用了你们两个的建议,形成了一个全新的功能肘。。非常感谢你们;-)
页:
[1]
2