怎么调用fillet命令,请大神看看我的代码有什么问题
本帖最后由 wybjy 于 2018-7-10 22:46 编辑(defun c:dyfillet()
(setq p1x 0)
(setq p1y 0)
(setq p2x 0)
(setq p2y 100)
(setq p3x 100)
(setq p3y 100)
(setq p4x 0)
(setq p4y 50)
(setq p5x 50)
(setq p5y 100)
(setq r 20)
(setq p1 ( list p1xp1y ))
(setq p2 ( list p2xp2y ))
(setq p3 ( list p3xp3y ))
(setq p4 ( list p4xp4y ))
(setq p5 ( list p5xp5y ))
(command"pline" p1 p2 p3 )
(command "" )
(command"fillet" "R" "" r p4 p5)
(command "" )
)
程序运行到下面这行就报错,
(command"fillet" "R" "" r p4 p5)
发现程序运行到r 就报错了,p4和p5的目的想实现选取对象操作,看来这样是不行的。在CAD命令行输入直线上的点坐标是可以选择直线的,不知道在LISP里面怎么实现这样的操作。
(defun c:cs()
(setq p1x 0)
(setq p1y 0)
(setq p2x 0)
(setq p2y 100)
(setq p3x 100)
(setq p3y 100)
(setq p4x 0)
(setq p4y 50)
(setq p5x 50)
(setq p5y 100)
(setq r 20)
(setq p1 ( list p1xp1y ))
(setq p2 ( list p2xp2y ))
(setq p3 ( list p3xp3y ))
(setq p4 ( list p4xp4y ))
(setq p5 ( list p5xp5y ))
(command"pline" p1 p2 p3 "")
(command"fillet" "R" r )
(command"fillet" p4 p5 )
(princ)
)
本帖最后由 wybjy 于 2018-7-11 08:49 编辑
Linhay 发表于 2018-7-11 07:15
直线与直线倒角需要把直线与点做成点对,你这个画成多段线用点对的方法应该是不行,fillet里选项里可以选择 ...
我在CAD中操作是完全可以输入线上点来选择线对象的。按代码中的坐标建立多线后,我在CAD命令行输入fillet命令,再在命令行输入R,然后输入20.这时提醒选择对象,我就在命令行输入0,50,再空格,再输入50,100,空格之后倒角就完成了。现在主要是不明确0,50以及50,100这两个输入动作在程序中怎么实现。画多线时我采用list生成的表来表示坐标是可行的,但,fillet命令下好像不行。 (command"fillet" "R" "" r p4 p5)
(command "" )
這兩句改成
(command"fillet" "R" r)
(command"fillet" p4 p5) 那位大侠解答一下,谢谢 直线与直线倒角需要把直线与点做成点对,你这个画成多段线用点对的方法应该是不行,fillet里选项里可以选择P(多段线),你可以试试 bssurvey 发表于 2018-7-11 08:11
(command"fillet" "R" "" r p4 p5)
(command "" )
這兩句改成
大侠,我试了,还是不行。 你用用看 被承包的东子 发表于 2018-7-11 08:59
(defun c:cs()
(setq p1x 0)
(setq p1y 0)
谢谢大侠:handshake 被承包的东子 发表于 2018-7-11 08:59
(defun c:cs()
(setq p1x 0)
(setq p1y 0)
因為LISP 使用fillet時 選擇R輸入半徑後,指令會結束,並不會延續,所以要重新輸入指令,才會執行新指令,但後來的AUTOCAD都會延續指令,所以編寫LISP時,遇到不能連續的指令,只能拆分解測試。
页:
[1]
2