延长两条线是怎么做的
RT,想了两个办法:通过两端点坐标求交点;然后划线
通过0长度倒角延长相交,然后打断于点,然后变换图层。。都不会搞,求代码
绘制圆弧切线
(defun c:tt (/ last_obj last_se obj obj_data obj_data_list obj_i obj_name n plst ss var1 var2 )
(princ "\n<----圆弧切线---->")
(princ "\n请选择圆弧,多段线/<退出>...")
(setq var1 (getvar "cmdecho"))
(setq var2 (getvar "osmode"))
(setvar "cmdecho" 0)
(setvar "osmode" 0)
(setq n 0)
(setq obj (ssget '((0 . "*POLYLINE,ARC"))))
(if obj
(repeat (sslength obj)
(setq ent (entget (ssname obj n)))
(if (= (cdr (assoc 0 ent)) "ARC")
(progn
(setq plst (sys_get_pt_arc_tan ent))
(command "_.line" (car plst)(caddr plst) "")
(command "_.line" (cadr plst) (caddr plst) "")
)
)
(if (= (cdr (assoc 0 ent)) "LWPOLYLINE")
(progn
(setq last_obj (ssget "p"))
(setq obj_data_list '())
(setq ss (ssadd (ssname obj n)))
(command "_undo" "mark")
(command "_explode" ss)
(setq last_se (ssget "p"))
(if (not (eq last_se last_obj))
(progn
(setq obj_i -1)
(repeat (sslength last_se)
(setq obj_name (ssname last_se (setq obj_i (1+ obj_i))))
(setq obj_data (entget obj_name))
(if (= (cdr (assoc 0 obj_data)) "ARC")
(setq obj_data_list (append (list obj_data) obj_data_list))
)
)
)
)
(command "_undo" "back")
(if obj_data_list
(foreach i obj_data_list
(setq plst (sys_get_pt_arc_tan i))
(command "_.line" (car plst)(caddr plst) "")
(command "_.line" (cadr plst) (caddr plst) "")
)
)
)
)
(setq n (+ n 1))
)
)
(setvar "cmdecho" var1)
(setvar "osmode" var2)
(princ)
)
(defun sys_get_pt_arc_tan (ent / cen jdq jdz p1 p2 p3 p4 p5 rad)
(setq cen (cdr (assoc 10 ent)));获取圆弧圆心
(setq rad (cdr (assoc 40 ent)));获取圆弧半径
(setq jdq (cdr (assoc 50 ent)));获取起始角度
(setq jdz (cdr (assoc 51 ent)));获取终止角度
(setq p1 (polar cen jdq rad);获取圆弧起始点
p2 (polar cen jdz rad);获取圆弧终止点
p3 (polar p1 (+ (/ pi 2) jdq) rad);获取起始点切线方向的半径点
p4 (polar p2 (+ (/ pi 2) jdz) rad);获取终止点切线方向的半径点
p5 (inters p1 p3 p2 p4 nil);切线交点
)
(if (not p5)
(princ "\n切线无交点...")
(list p1 p2 p5)
)
) duotu007 发表于 2012-4-27 14:17 static/image/common/back.gif
绘制圆弧切线
(defun c:tt (/ last_obj last_se obj obj_data obj_data_list obj_i obj_name n plst ss va ...
万分感谢,还有注释,好好学习一下 本帖最后由 BIT中原 于 2012-4-28 09:54 编辑
我想修改一下那两条线的图层,可以一并做了么?我刚会在绘直线之前加一句话把环境变成我想要的图像,绘图之后怎么还原回来啊 duotu007 发表于 2012-4-27 14:17
绘制圆弧切线
(defun c:tt (/ last_obj last_se obj obj_data obj_data_list obj_i obj_name n plst ss va ...
感谢 分享 谢谢:handshake
页:
[1]