ayuksel 发表于 2022-7-5 16:22:30

弧的方向

你好
 
我正试图用AutoLISP绘制一个实体。但我在画弧线时被卡住了。
 
请看下面的图片,我被卡住了。
 

 
我需要这个弧平行于它下面的线。我尝试了一些UCS命令,但在那个时候arc出现在不相关的地方。我想不出来。我做错了什么事。(我可以在这里发布我的.lsp,但它可能会让你困惑,因为它包含许多由我定义的变量)
 
有人能帮忙吗?

ReMark 发表于 2022-7-5 16:35:37

我认为在下一篇文章中附上lisp例程的副本对你来说是最有利的。

ayuksel 发表于 2022-7-5 16:40:16

对不起,在这里:
 

(defun c:abd ()
       (setq wid1 60 len 115 wid1 60 wid2 22.5 hole1 20 hole2 15 rad1 22.5 rad2 20 rad3 50 rad4 10 rad5 7.5 he1 15 thi1 15 thi2 15 dist1 47.5 dist2 25 dist3 22.5 dist4 37.5)

;base
(setq pnt1 (getpoint "\nPlease select the starting point"))
(setq pnt2 (list (+ (car pnt1) (- len rad2))(cadr pnt1)(caddr pnt1)))
(setq pnt3 (list (car pnt2) (- (cadr pnt2) (- wid1 (* rad1 2)))(caddr pnt1)))
(setq pnt4 (list (+ (car pnt3) (* rad2 2)) (cadr pnt3)(caddr pnt1)))
(setq pnt5 (list (car pnt4) (+ (cadr pnt4) wid1)(caddr pnt1)))
(setq pnt6 (list (- (car pnt4) (+ len rad2)) (cadr pnt5)(caddr pnt1)))
(setq pnt7 (list (car pnt1) (cadr pnt1) (caddr pnt1)))

(command "line" "_non" pnt1 "_non" pnt2 "")
(setq l1 (entlast))
(command "line" "_non" pnt2 "_non" pnt3 "")
(setq l2 (entlast))
(command "line" "_non" pnt3 "_non" pnt4 "")
(setq l3 (entlast))
(command "line" "_non" pnt4 "_non" pnt5 "")
(setq l4 (entlast))
(command "line" "_non" pnt5 "_non" pnt6 "")
(setq l5 (entlast))
(command "line" "_non" pnt6 "_non" pnt7 "")
(setq l6 (entlast))

(setvar "filletrad" 10)
(command "._fillet" l1 l2)
(setq f1 (entlast))
(setvar "filletrad" 50)
(command "._fillet" l4 l5)
(setq f2 (entlast))

(command "._pedit" "_m" l1 l2 l3 l4 l5 l6 f1 f2 "" "_j" "0.00" "" "")

(setq base (entlast))
(command "extrude" base "" he1 "")

(setq extbase1 (entlast))


   (setq pnt8 (list (+ (car pnt1) dist1) (+ (cadr pnt1) (- rad1 rad5))(caddr pnt1)))
(setq pnt9 (list (+ (car pnt1) (+ dist1 dist3)) (+ (cadr pnt1) (- rad1 rad5))(caddr pnt1)))

(command "line" "_non" pnt8 "_non" pnt9 "")

(setq l7 (entlast))
   
(setq pnt10 (list (+ (car pnt1) dist1) (+ (cadr pnt1) (+ rad1 rad5))(caddr pnt1)))
(setq pnt11 (list (+ (car pnt1) (+ dist1 dist3)) (+ (cadr pnt1) (+ rad1 rad5))(caddr pnt1)))


(command "line" "_non" pnt10 "_non" pnt11 "")

(setq l8 (entlast))

(command "_.arc" "_non" pnt8 "_e" "_non" pnt10 "_direction" 180)

(setq arc1 (entlast))

(command "_.arc" "_non" pnt9 "_e" "_non" pnt11 "_direction" 0)

(setq arc2 (entlast))

   (command "._pedit" "_m" l8 arc1 l7 arc2 "" "_j" "0.00" "" "")

(setq excut (entlast))

(command "extrude" excut "" he1 "")

(setq extcuta (entlast))

(command "subtract" extbase1 "" extcuta "")

(setq extbasenew (entlast))

(setq pnt12 (list (car pnt1) (cadr pnt1) (+ (caddr pnt1) he1)))
(setq pnt13 (list (car pnt1) (cadr pnt1) (+ (caddr pnt1) (+ dist2 he1))))
(command "_.line" "_non" pnt12 "_non" pnt13 "")
(setq l9 (entlast))

(setq pnt14 (list (car pnt1) (+ (cadr pnt1) (* rad1 2)) (+ (caddr pnt1) he1)))
(setq pnt15 (list (car pnt1) (+ (cadr pnt1) (* rad1 2)) (+ (caddr pnt1) (+ dist2 he1))))
(command "_.line" "_non" pnt14 "_non" pnt15 "")
(setq l10 (entlast))







(command "_.arc" "_non" pnt13 "_e" "_non" pnt15 "_radius" rad1)



(setq arc3 (entlast))

)

ReMark 发表于 2022-7-5 16:46:38

这是学校写lisp程序来创建上述图片对象的作业吗?

ayuksel 发表于 2022-7-5 16:51:22

是的,这是我需要尽快完成的任务。我编写了一个LISP来绘制对象,必须使用对话框窗口(对话框控制语言代码)修改默认尺寸。

Roy_043 发表于 2022-7-5 16:56:29

如果在更改UCS时遇到问题,可以尝试在WCS中创建和拉伸实体,然后使用Rotate3D命令正确定位实体。我还建议从多段线开始,而不是圆弧和直线。

ayuksel 发表于 2022-7-5 17:05:52

 
是否可以在不连接草图的情况下拉伸草图?
 
我尝试了多段线,但也无法处理它。
 
这个项目把我逼疯了!

ayuksel 发表于 2022-7-5 17:12:10

 
你告诉rotate3d救了我一命!
 
谢谢!

Dadgad 发表于 2022-7-5 17:20:26

 
查看PRESSPULL命令。
http://www.cadtutor.net/tutorials/autocad/extrude-and-press-pull/

ayuksel 发表于 2022-7-5 17:22:50

 
非常感谢您的建议!
页: [1]
查看完整版本: 弧的方向