Hi
i have problem drawing arc.
scenario is :
user select line and my routine will draw arc. Line is tangent to arc.
Problem si how autocad declare start and end angle of the arc.
Please help me with some hints????
|
Hi
i have problem drawing arc.
scenario is :
user select line and my routine will draw arc. Line is tangent to arc.
Problem si how autocad declare start and end angle of the arc.
Please help me with some hints????
(defun c:tn ( / ed ent po oldlay )
(while(setq ent (car(setq po(entsel "\nSelect an ARC/LINE"))))
(setq po (osnap(cadr po) "END"))
(setq ed (entget ent))
(cond
((= (dxf 0 ed)"ARC")
(tnLine ent po)
)
((= (dxf 0 ed)"LINE")
(setq p1 (dxf 10 ed) p2(dxf 11 ed))
(if (equal po p1 0.001)
(command "LINE" p2 p1 "")
(command "LINE" p1 p2 "")
)
(entdel (entlast))
(setq oldlay (getvar "CLAYER"))
(command "ARC" "" pause)
(command "MATCHPROP" ent (entlast)"")
)
)
)
)
;;
;; Draw tangent line
;;
(defun tnLine ( ent po / obj poFrom ang StartP oldlay)
(setq oldlay (getvar "CLAYER"))
(setq obj (vlax-ename->vla-object ent ))
(setq StartP nil)
(if (not(equal (setq poFrom (vlax-safearray->list (vlax-variant-value (vlax-get-property obj 'StartPoint)))) po 0.0001))
(setq poFrom (vlax-safearray->list (vlax-variant-value (vlax-get-property obj 'EndPoint))))
(setq StartP T)
)
(if StartP
(setq ang (-(vlax-get-property obj 'StartAngle)(/ pi 2)))
(setq ang (+ (vlax-get-property obj 'EndAngle)(/ pi 2)))
)
(setvar "POLARADDANG" (rtos(radian->degrees ang)2 4))
(command "_.LINE" poFrom (polar poFrom ang (getdist poFrom "\nDistance:"))"")
(command "MATCHPROP" ent (entlast)"")
)
You may want to try this code:
http://www.acadnetwork.com/topic-264.0.html
Specify 2 points and then point in the middle of your line
hth,