arc length

How would one find the length of an arc using autolisp?

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
I think you need to calculate it using the object data, which is Radius(group code 40) and Start Angle and End Angle(group code 50).
--


MichaelB
www.michaelbulatovich.ca
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
HiHo; Here is a old one you can use the parts. ;CADENCE Magazine February 1992 ;Page 86
;Note: Calculate arc length, included angle, chord, and radius ;en = entity name ;ed = entity definition ;et = entity type ;r = radius ;p1 = end pt of arc at start angle ;p2 = end pt of arc at end angle ;c = chord length ;cb = chord bearing ;sa = start angle ;ea = ending angle ;a = included angle ;al = arc length ;ctr = center point ;answer1 = arc length, included angle, and radius ;answer2 = chord length and bearing ;-------------------- (defun c:ArcLIST (/ i en ed et r p1 p2 c cb sa ea a al ctr answer1 answer2) ;-----clear user input----- (setq i 1) (while i (setq en (car (entsel "\nPick an arc: "))) (if en (progn (setq ed (entget en)) (setq et (cdr (assoc 0 ed))) (if (/= et "ARC") (prompt "\nEntity is not an arc.") (setq i nil) );if );progn (prompt "\nYou did not pick anything.") );if );while ;-----retrieve relevant data----- (setq ctr (cdr (assoc 10 ed))) (setq r (cdr (assoc 40 ed))) (setq sa (cdr (assoc 50 ed))) (setq ea (cdr (assoc 51 ed))) (setq p1 (polar ctr sa r)) (setq p2 (polar ctr ea r)) (setq c (distance p1 p2)) ;chord length (setq cb (angle p1 p2)) ;chord bearing ;-----calculate included angle----- (if (< sa ea) (progn (setq ea (- ea sa)) (setq sa (- sa sa)) (setq a ea) ) (progn (setq sa (- sa ea)) (setq ea (- ea ea)) (setq a (abs (- sa (* 2 pi)))) ) );if ;-----calculate arc length----- (setq al (/ (* pi r a) pi)) ;arc length (terpri) (setq answer1 (strcat "Arc length = " (rtos al) " Included angle = " (angtos a 0) " Radius = " (rtos r) ) );setq (setq answer2 (strcat "Chord length = " (rtos c) " Chord bearing = " (angtos cb) ) );setq (prompt answer1) (terpri) (prompt answer2) (princ) );defun

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Thanks, I think I can make that work for what I am doing. Happy Autolisping

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
(Dees) wrote:

This is one lisp available:
;|
DIMARC.LSP - Dimension an arc with length, rather than angle (c) 1998 Tee Square Graphics
|;
(defun C:DIMARC (/ arc ent obj l) (setq cmd (getvar "cmdecho") arc (entsel "\nPick ARC to dimension: ") ent (entget (car arc)) obj (cdr (assoc 0 ent))) (if (= obj "ARC") (progn (setvar "cmdecho" 1) (setq l (* (cdr (assoc 40 ent)) (if (minusp (setq l (- (cdr (assoc 51 ent)) (cdr (assoc 50 ent))))) (+ pi pi l) l))) (command "_.dimangular" arc "_t" (rtos l)) (while (= (logand (getvar "cmdactive") 1) 1) (command pause)) (setvar "cmdecho" cmd)) (alert "Object selected is not an ARC.")) (princ) )
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.