如何制作一个简单的框架?
我还是个新手。关于autolisp,我还有很多需要学习的地方。我需要帮助完成这个相框。如果有任何帮助,我将不胜感激。这是我的密码。(默认c:picf()
(setvar“cmdecho”0)
;询问用户三个问题
(setq osmode(getvar“osmode”))
(setq高度(getint“\n输入高度:”)
(setq width(getint“\n输入宽度:”)
(setq-thick(getint“\n输入厚度:”)
;设置起点和右上角点
(setq stpt(列表0.0.0))
(setq trp(极性(极性stpt 0宽度)(*pi 0.5)高度))
(命令“矩形”stpt trp“”)
(setvar“osmode”0)
(setvar“osmode”osmode)
(普林斯)
) 把你的setvar osmode放在getvar osmode之后,你现在已经把它放得太低了。
你也可以做pline,但它需要你额外计算3个点,这样做的原因是你可以使用一个自动加载的defun pline例程,这里有很多关于VLa Addlwpolyline的例子。然后你可以做2分以上的练习。这可能是一个好主意,从“命令”开始,使用vla add
最近有一篇关于矩形的帖子,从一个角度讲,我建议使用“斯纳潘”
“矩形”之后是什么?除了Bigal提到的“osmode”设置的明显位置之外,我在你的帖子上没有看到任何问题 建议移到Vla ADDPOLYINE,这样做的优点是一次设置其所有属性,而不是一个接一个命令PE last width等
无论如何,ps使用代码括号
(defun c:picf ()
(setvar "cmdecho" 0)
;askimg the user three questions
(setq osmode (getvar "osmode" ))
(setq height (getint "\nEnter the height: "))
(setq width (getint "\nEnter the width: "))
(setq thick (getint "\nEnter the thickness: "))
;setting the start point and top right point
(setq stpt (list 0.0 0.0))
(setq trp (polar (polar stpt 0 width) (* pi 0.5) height))
(command "rectangle" stpt trp "")
(command "pedit" "L" "w" thick)
(setvar "osmode" 0)
(setvar "osmode" osmode)
(princ)
)
我想这可能会向你展示这个公式,并给你一些关于如何设置lisp程序的想法。
我可能是错的,但我认为你错过了一个步骤或2在你的lisp张贴,但由于我不知道如何在lisp编程,我可能是错的。
无论如何,希望这能对你有所帮助 pBe仍然一无所知 文明,
请编辑您的帖子以包含代码标签。 发布一张最终结果的图片怎么样?
这就是它应该看起来的样子。 试试这个。。。如果这能满足你的要求,请告诉我。
(defun c:Test (/ hgt wid thk pt l p1 p2 p3 p4 p5 p6 p7 ct)
(if
(and
(setq hgt (getdist "\nEnter the height: "))
(setq wid (getdist "\nEnter the width: "))
(setq thk (getdist "\nEnter the thickness: "))
(if (> wid (* 2. thk))
t
(progn
(alert
"Width of outter border must be bigger two times at least than the Thickness !"
)
nil
)
)
(setq pt (getpoint "\n Specify point :"))
)
(progn
(setq l(- wid (* thk 2.))
p1 (polar pt 0. wid)
p2 (polar p1 (* pi 1.5) hgt)
p3 (polar p2 pi wid)
p4 (polar (polar pt 0. thk) (* pi 1.5) thk)
p5 (polar p4 0. l)
p6 (polar p5 (* pi 1.5) l)
p7 (polar p6 pi l)
ct (inters p4 p6 p5 p7)
)
(command "_.rectang" "_none" pt "_none" p2)
(command "_.rectang" "_none" p4 "_none" p6)
(entmake
(list '(0 . "CIRCLE") (cons 10 ct) (cons 40 (/ l 2.)))
)
)
)
(princ)
)
页:
[1]
2