Draw a line the same length as an arc length

Draw a line the same length as an arc length

Anonymous
Not applicable
1,597 Views
5 Replies
Message 1 of 6

Draw a line the same length as an arc length

Anonymous
Not applicable

I'm trying to put together a lisp that will draw a line the same length as an arc-length.  I would also like to be able to choose the starting location for the line.  The work flow I'm looking for is:

command arclentolinestraighten

select the arc

click the start location of the line

 

To give some background, I work at a company that installs aluminum composite panels.  We often cut a sheet at a given radius and then attach a tab along the arc length.  We will roll the tab at the given radius and attach them along the arc, perpendicular to it creating a rounded "box".  To get the length of the tab, I will have to select the arc, look at the properties for the arc length and then draw a line the same length to create the tab.  I would like a lisp that would do that process for me.

 

I'm really inexperienced with lisps, so any help would be appreciated.

0 Likes
Accepted solutions (2)
1,598 Views
5 Replies
Replies (5)
Message 2 of 6

_gile
Consultant
Consultant
Accepted solution

Hi,

 

Quickly done:

 

(defun c:arclentolinestraighten (/ ent pt len)
  (and
    (setq ent (car (entsel "\nSelect an arc: ")))
    (= (cdr (assoc 0 (entget ent))) "ARC")
    (setq pt (getpoint "\nSpecify line start point: "))
    (setq len (vlax-curve-getDistAtParam ent (vlax-curve-getEndparam ent)))
    (command "_.line" pt (mapcar '+ pt (list len 0. 0.)) "")
  )
  (princ)
)


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 3 of 6

SeeMSixty7
Advisor
Advisor
Accepted solution

Here is a quick shot to get you started.

 

Good luck,

 

(defun C:ARCLINE()
   (setq arcent (entsel "\nSelect Arc: "))
   (if arcent
       (progn
           (setq arcobj (vlax-ename->vla-object (car arcent))
           	     arclen (vla-get-arclength arcobj)
                 startpoint (getpoint "\nStart Point of Line: " )
           	     nextpoint  (getpoint startpoint "\nDirection of line: ")
           	     nextpoint (polar startpoint (angle Startpoint nextpoint) arclen)
           )
           (command "line" startpoint nextpoint "")
        )
     )
)
      
Message 4 of 6

Anonymous
Not applicable

That worked great. Thanks

0 Likes
Message 5 of 6

Anonymous
Not applicable

That worked great. Thanks

Message 6 of 6

john.uhden
Mentor
Mentor

Of course they work great.  You have the best of the best helping you out.

John F. Uhden

0 Likes