Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Distinguished Contributor
sdbeach
Posts: 103
Registered: ‎05-18-2004
Message 11 of 20 (649 Views)

Re: Draw arc by length, radius, and delta

07-25-2005 08:30 AM in reply to: sdbeach
I’m given a line:
N 64(degrees) 00’00”W, length = 40.61’

Then given curve data table with:
Delta: 90(degrees) , Radius: 40, Length:62.83, Tangent: 40

I need to draw this curve....
*tcebob
Message 12 of 20 (649 Views)

Re: Draw arc by length, radius, and delta

07-25-2005 09:39 AM in reply to: sdbeach
Sorry, d, not enough; still only 2 independent variables. You might assume the curve is
tangent to the end of the line and go ahead and see if the whole shebang closes. But you
are not given the direction of the arc, so unless you have a plan in front of you can
only guess which way to go.

Drawing the curve is simple: extend the tangent 40', draw a line at 90 degrees any length
greater than 40 and fillet r = 40.

rs

wrote in message news:4910111@discussion.autodesk.com...
I'm given a line:
N 64(degrees) 00'00"W, length = 40.61'

Then given curve data table with:
Delta: 90(degrees) , Radius: 40, Length:62.83, Tangent: 40

I need to draw this curve....
Distinguished Contributor
sdbeach
Posts: 103
Registered: ‎05-18-2004
Message 13 of 20 (649 Views)

Re: Draw arc by length, radius, and delta

07-25-2005 09:53 AM in reply to: sdbeach
I have a plan in front of me..

I will try your suggestion, however, if I fillet the two lines, it will not give me a arc that's 62.83' in length!
*tcebob
Message 14 of 20 (649 Views)

Re: Draw arc by length, radius, and delta

07-25-2005 10:37 AM in reply to: sdbeach
Just tried it: 62.832'. If you think of it, it's one quadrant of a circle of radius 40'.
Length 2pi*40/4 = 62.831258. More or less.

rs

wrote in message news:4910213@discussion.autodesk.com...
I have a plan in front of me..

I will try your suggestion, however, if I fillet the two lines, it will not give me a arc
that's 62.83' in length!
Distinguished Contributor
sdbeach
Posts: 103
Registered: ‎05-18-2004
Message 15 of 20 (649 Views)

Re: Draw arc by length, radius, and delta

07-25-2005 10:46 AM in reply to: sdbeach
Thanks,
I will have to try this with the rest of the lines/curves.

I find it hard to believe that there is not a way to draw an arc tangent to a line/or other arc given the radius, delta, and length. I'm sure someone out there has a lisp. for this...

Thanks for the help
*Kent Cooper
Message 16 of 20 (649 Views)

Re: Draw arc by length, radius, and delta

07-25-2005 11:25 AM in reply to: sdbeach
Here's what I made years ago to do arcs when all you know is the radius and
the length along the curve. [It's a Screen Menu item, but could be defun'd
into a "command" of its own.] It uses the prompt responses to calculate the
center-point and included angle of the arc, and generates it from those. If
you only have a written description and no graphic version, you'll have to
do something like sketch it up roughly to figure out which direction the arc
turns.

The three variables you mention are not independent -- any two of them will
determine the third, so you can't force AutoCAD to use all three if any are
rounded off at all. Your example with a 90-degree arc drove someone's
earlier suggestion to fillet perpendicular lines, and its length figure was
most likely what was rounded off.

I made this routine because of having often run across deed descriptions
containing arcs with only the radius and length. They were almost always
tangent continuations of preceding straight line segments. If you are given
the included angle, too, then you have to decide which two variables of the
three you want to use to determine the arc, and which one to allow to be the
rounded-off resultant. I would be inclined most of the time to let that be
the length, since if the arc meets tangent straight lines at both ends,
their angles will determine the included angle of the arc, and the radius is
usually a nice round number.

(Watch for word wrap -- all lines except the last one should end with +
signs.)


[ARCxDist]^C^C^P(setq pt (getpoint "Starting Point <@>: ")) \+
(if (= pt nil) (setq pt (getvar "LASTPOINT"))) +
(setq rad (getdist pt "Radius: ")) \+
(setq dir (getangle pt "Starting Direction : ")) \+
(if (= dir nil) (setq dir (getvar "LASTANGLE"))) +
(setq dist (getdist "Distance Along Curve: ")) \+
(setq curve (strcase (getstring "Curving Left (CCW) or Right (CW) (L/R)?
: "))) \+
(setq ang (* (/ (/ dist rad) pi) 180) offset (/ pi 2)) +
(if (= curve "R") (setq ang (- ang) offset (- offset) angl 50) +
(setq angl 51)) (setq dir2 (+ dir offset) ctr (polar pt dir2 rad)) +
(command "ARC" pt "C" ctr "A" ang) +
(setvar "LASTPOINT" (polar (getvar "LASTPOINT") +
(cdr (assoc angl (entget (entlast)))) (cdr (assoc 40 (entget (entlast))))))
^P

--
Kent Cooper


wrote...
Thanks,
I will have to try this with the rest of the lines/curves.

I find it hard to believe that there is not a way to draw an arc tangent to
a line/or other arc given the radius, delta, and length. I'm sure someone
out there has a lisp. for this...

Thanks for the help
*Jeff Mishler
Message 17 of 20 (649 Views)

Re: Draw arc by length, radius, and delta

07-25-2005 12:05 PM in reply to: sdbeach
Here's one that will draw a tangent arc from the end of a selected line, or
if the last object created was a line you can just hit enter to use it. You
must supply the Radius and Delta. The delta must be input in the format of
the current AUnit setting. The end of the line is determined by either where
the line is selected (the nearest endpoint is used) or the end of the last
line.

[code]
(defun c:arcfromline (/ ang ctrpt delta dist doc endang endpt ent half
obj pick rad space ss1 ss2 startang stpt)
(vl-load-com)
(setq doc (vla-get-activedocument (vlax-get-acad-object))
space (if (= (getvar "cvport") 1)
(vla-get-paperspace doc)
(vla-get-modelspace doc)
)
)
(princ "\nSelect line or Enter to use last created line: ")
(if (or (setq ss1 (ssget ":smileyfrustrated:" '((0 . "LINE"))))
(setq ss2 (ssget "L" '((0 . "LINE"))))
)
(progn
(setq obj (vlax-ename->vla-object (ssname ss 0))
pick (if ss1
(last (last (last (ssnamex ss1 0))))
(vlax-get obj 'endpoint)
)
half (/ (vla-get-length obj) 2.0)
)
(setq dist (vlax-curve-getdistatpoint obj
(vlax-curve-getclosestpointto obj pick)))
(if (< half dist)
(setq stPt (vlax-get obj 'startpoint)
endPt (vlax-get obj 'endpoint)
)
(setq stPt (vlax-get obj 'endpoint)
endPt (vlax-get obj 'startpoint)
)
)
(setq rad (getdist endPt "\nRadius of arc: ")
ang (angle stPt endPt)
ctrPt (polar endPt (- ang (/ pi 2)) rad)
startang (+ pi (- ang (/ pi 2)))
delta (getangle "\nDelta: ")
)
(if (minusp rad)
(setq startang (angle ctrPt endPt)
endang (+ startang delta))
(setq endang (angle ctrPt endPt)
startang (- startang delta))
)
(vlax-invoke space 'addarc ctrPt (abs rad) startang endang)
)
)
(princ)
)
[/code]

wrote in message news:4910298@discussion.autodesk.com...
Thanks,
I will have to try this with the rest of the lines/curves.

I find it hard to believe that there is not a way to draw an arc tangent to
a line/or other arc given the radius, delta, and length. I'm sure someone
out there has a lisp. for this...

Thanks for the help
Distinguished Contributor
sdbeach
Posts: 103
Registered: ‎05-18-2004
Message 18 of 20 (649 Views)

Re: Draw arc by length, radius, and delta

07-25-2005 12:26 PM in reply to: sdbeach
Thanks,

When I pick a line I get the following error message:
bad argument type: lselsetp nil

do I have to change a line in the lisp??

Devon
*Jeff Mishler
Message 19 of 20 (649 Views)

Re: Draw arc by length, radius, and delta

07-25-2005 12:41 PM in reply to: sdbeach
Sorry about that....I added the option to use the last line and messed up
the ss. This one should work for you.

(defun c:arcfromline (/ ang ctrpt delta dist doc endang endpt ent half
obj pick rad space ss1 ss2 startang stpt)
(setq doc (vla-get-activedocument (vlax-get-acad-object))
space (if (= (getvar "cvport") 1)
(vla-get-paperspace doc)
(vla-get-modelspace doc)
)
)
(princ "\nSelect line or Enter to use last created line: ")
(if (or (setq ss1 (ssget ":smileyfrustrated:" '((0 . "LINE"))))
(setq ss2 (ssget "L" '((0 . "LINE"))))
)
(progn
(if ss1
(setq obj (vlax-ename->vla-object (ssname ss1 0))
pick (last (last (last (ssnamex ss1 0))))
)
(setq obj (vlax-ename->vla-object (ssname ss2 0))
pick (vlax-get obj 'endpoint)
)
)
(setq half (/ (vla-get-length obj) 2.0)
dist (vlax-curve-getdistatpoint obj
(vlax-curve-getclosestpointto obj pick)))
(if (< half dist)
(setq stPt (vlax-get obj 'startpoint)
endPt (vlax-get obj 'endpoint)
)
(setq stPt (vlax-get obj 'endpoint)
endPt (vlax-get obj 'startpoint)
)
)
(setq rad (getdist endPt "\nRadius of arc: ")
ang (angle stPt endPt)
ctrPt (polar endPt (- ang (/ pi 2)) rad)
startang (+ pi (- ang (/ pi 2)))
delta (getangle "\nDelta: ")
)
(if (minusp rad)
(setq startang (angle ctrPt endPt)
endang (+ startang delta))
(setq endang (angle ctrPt endPt)
startang (- startang delta))
)
(vlax-invoke space 'addarc ctrPt (abs rad) startang endang)
)
)
(princ)
)
wrote in message news:4910418@discussion.autodesk.com...
Thanks,

When I pick a line I get the following error message:
bad argument type: lselsetp nil

do I have to change a line in the lisp??

Devon
Distinguished Contributor
sdbeach
Posts: 103
Registered: ‎05-18-2004
Message 20 of 20 (649 Views)

Re: Draw arc by length, radius, and delta

07-25-2005 12:47 PM in reply to: sdbeach
Awesome, works great.

Thank you,
Devon

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community