wimal Posted March 24, 2013 Posted March 24, 2013 I try to write a code to get the arc length between any two points on it. But my answer is wrong . why ( defun arclength() (setq ss (car (entsel "\nSelect arc:"))) (setq x_object (vlax-Ename->Vla-Object ss)) (setq r (vla-get-radius ename)) (setq dist(getdist"/ pick on arc")) (setq dist2 (/ dist 2)) (setq radian (atan dist2 r)) (setq distarc (* 2 r radian )) ) Quote
Lee Mac Posted March 24, 2013 Posted March 24, 2013 Try this: (defun arclength ( / en di rd ) (if (and (setq en (car (entsel "\nSelect Arc: "))) (= "ARC" (cdr (assoc 0 (entget en)))) (setq di (getdist "\nPick Chord: ")) (setq rd (cdr (assoc 40 (entget en)))) ) (* 2.0 rd (asin (/ di 2.0 rd))) ) ) ;; ArcSine - Lee Mac ;; Args: -1 <= x <= 1 (defun asin ( x ) (if (<= -1.0 x 1.0) (atan x (sqrt (- 1.0 (* x x)))) ) ) ArcSine from here. Quote
wimal Posted March 25, 2013 Author Posted March 25, 2013 (edited) O.K Thanks it is working nicelly Edited March 25, 2013 by wimal Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.