autocad2007中: 1.怎样使样条曲线与两端连接的样条曲线相切? 2.怎样使圆弧与两端连接的样条曲线相切?
1个回答
2016-06-06 · 知道合伙人软件行家
关注
展开全部
样条曲线绘制切线,有个方法,就是【偏移对象】,然后找到对应点。绘制对应点的垂直线。根据这个原理编程来绘制切线。
autolisp编程代码如下:
(defun c:tes ( / &ang1 &dis1 &k1 &n1 &p1 &p2 ent1)
(if (null vlax-dump-object) (vl-load-com) )
(if (and (setq &k1 (entsel "\n请选择样条曲线或圆弧"))
(setq &k1 (car &k1))
(member (cdr (assoc 0 (entget &k1))) '("ARC" "SPLINE"))
(setq &k1 (vlax-ename->vla-object &k1))
(setq &p1 (getpoint "\n请选择切线点"))
(> (setq &dis1 (* 0.1 (vlax-curve-getDistAtParam &k1 (vlax-curve-getEndParam &k1)))) 0)
(setq &p1 (vlax-curve-getclosestpointto &k1 &p1))
(setq &n1 (vlax-curve-getParamAtPoint &k1 &p1))
(null (vl-catch-all-error-p (vl-catch-all-apply 'vla-offset (list &k1 0.01))))
(setq ent1 (entlast))
(setq &p2 (vlax-curve-getPointAtParam ent1 &n1))
)
(progn
(entdel ent1)
(setq &ang1 (+ (angle &p1 &p2) (* pi 0.5)))
(setq &p2 (polar &p1 &ang1 &dis1) &p1 (polar &p1 &ang1 (* &dis1 -1.0)))
(entmake (list '(0 . "LINE") (cons 10 &p2) (cons 11 &p1)))
)
)
(princ)
)
追问
编程看不懂,这也太高难度了,期待更简单的方法
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询