Tangent Extension to an Arc LISP

Tangent Extension to an Arc LISP

JA5.15
Enthusiast Enthusiast
3,153 Views
12 Replies
Message 1 of 13

Tangent Extension to an Arc LISP

JA5.15
Enthusiast
Enthusiast

A few years ago I found a LISP routine that allowed me to extend a line tangent from the endpoint of an arc. When I activated the command I could click on the arc and a line would appear on-screen locked to a tangent from the endpoint of the arc. I could view the line and could see how the tangent looked before clicking to create the line or escaping the command if I did not want to create the line. I found this very useful.

 

I recently upgraded to ACAD 2015 and have found that the routine no longer works. When I activate the command I select the arc as before but I can now draw a line anywhere I want; there is no tangency constraint nor do I see a preview of the line. Something has changed between 2014 and 2015 and I am not sure what. 

 

I would love to get this routine working again as it was in previous ACAD versions. I've attached the LISP routine as well. Hopefully someone with more knowledge than I can help me out.

 

Thanks.

 

 

0 Likes
Accepted solutions (1)
3,154 Views
12 Replies
Replies (12)
Message 2 of 13

rkmcswain
Mentor
Mentor

Let's see if the author can help. @alanjt_

 

 

 

 

R.K. McSwain     | CADpanacea | on twitter
0 Likes
Message 3 of 13

john.vellek
Alumni
Alumni

Hi @JA5.15,

 

I tried the routine and it appears to be working for me.  Can you prepare a Screencast to show me how it is behaving for you?


John Vellek


Join the Autodesk Customer Council - Interact with developers, provide feedback on current and future software releases, and beta test the latest software!

Autodesk Knowledge Network | Autodesk Account | Product Feedback
0 Likes
Message 4 of 13

ВeekeeCZ
Consultant
Consultant
Accepted solution

Yep... saw this issue before.

 

 

Replace this line

(vl-cmdf "_.line" "_non" pnt (strcat "<" ang) PAUSE)

with

(command-s "_.line" "_non" pnt (strcat "<" ang) PAUSE)
Message 5 of 13

JA5.15
Enthusiast
Enthusiast

That seems to have fixed it. Thank you very much! Although in 2015 the extension now appears as a dashed extension line rather than an object line with whatever layer characteristics I'm currently using. That is not an issue at all, just an observation.

 

Someday I'll learn all this code stuff, right as soon as I have some free time 😉

 

Thanks again!

0 Likes
Message 6 of 13

alanjt_
Collaborator
Collaborator

Sorry for the delay in looking at this. However, I'm glad someone stepped in and helped you out. 🙂

0 Likes
Message 7 of 13

Kent1Cooper
Consultant
Consultant

@JA5.15 wrote:

.... a LISP routine that allowed me to extend a line tangent from the endpoint of an arc. .... 


A related routine, if you want to:
A)  draw an Arc as a tangent continuation from either another Arc or a Line or the open end of a Polyline;

B)  draw a Line as a tangent continuation from [yes, an Arc as in this thread] or another Line or the open end of a Polyline.

 

Try out the attached [in-progress -- see below]  PolylineContinue .lsp with its PLC command.  It finds the direction that the nearer end of any of those things is headed, and applies that if you take advantage of it to the subsequent segment of a Polyline.  If what you pick on isn't already a Polyline, it will make it one, which you can Explode if you don't want it that way afterwards.

 

If what you want to do is a Line, since it will be in a Polyline command, you would use the Length option to get a line segment that's a tangent continuation from whatever you picked on.  That's admittedly a little more cumbersome than what the other routines here do, when what you pick is an Arc, but it works in ways that the others don't, i.e. as a tangent continuation of another Line or an open Polyline.  If what you want to do is an Arc, just go into PLINE's Arc option and it will do a tangent continuation [unless you then call for some other option such as to specify a Second point -- all options are still open to you].

 

As mentioned, it's in progress, with some issues I need to work on.  I took out most of my notes to myself and trial approaches to try to overcome the issues mentioned at the top of the file.  But in most ordinary circumstances it works fine.  However, one that I would mention specifically is that you should use Enter/space to end the PLINE command that it goes into, rather than ESCape, or [until I work on it some more] it won't reset certain things for you.

Kent Cooper, AIA
0 Likes
Message 8 of 13

alanjt_
Collaborator
Collaborator
@Anonymous:
The method you describe of drawing an arc, then being able to draw a line from that arc is precisely the reason I wrote the routine, as to avoid this extra set of steps that previously annoyed me for years.

Your routine is just the PLine command that is a continuation of a selected line/arc/pline. It does not account for the next segment being tangent from the selected segment. I mean no offense, but I'm not sure why you are posting this here.
0 Likes
Message 9 of 13

Kent1Cooper
Consultant
Consultant

@alanjt_ wrote:
The method you describe of drawing an arc, then being able to draw a line from that arc is precisely the reason I wrote the routine, as to avoid this extra set of steps that previously annoyed me for years.

Your routine is just the PLine command that is a continuation of a selected line/arc/pline. It does not account for the next segment being tangent from the selected segment. I mean no offense, but I'm not sure why you are posting this here.

If what you want to do is draw a Line that's a tangent continuation from the end of an Arc immediately after drawing the Arc [as your first sentence implies], then you don't need any routine at all.  Draw the Arc, start a Line command, and when it's asking for the first point, just hit Enter, and see what happens.  A routine would be needed only if you want to draw a Line tangent from the end of an Arc that isn't the last thing drawn, and that The User must select.

 

And yes, my routine does account for tangent continuation from the end of the selected object* [did you try it?], though with the admitted "cumbersome"-ness I described in Post 7, that if it's a Line you want to continue with, you need to use PLINE's Length option and give it a numerical length [which will be drawn tangentially], rather than pick along a tangential "drag" line.  The main reason it determines the direction the end is headed is for the possibility of a tangent arc-segment continuation, but you can continue tangentially with a line segment.  Its doing that for an arc extension, and its being able to continue three different entity types [whether or not you want to continue them tangentially], are for me of enough benefit to outweigh the cumbersomeness in that one circumstance.  But for those who never need any such thing except to draw Line entities that are tangent continuations of Arc entities, when they haven't just drawn the Arc in question, your routine is certainly better.

 

I posted it because it draws exactly what's in the Subject line [people will find this thread by Searching for something like that], including being more universal than what's described in the first sentence of Post 1.

 

* I use the word "object" rather than your word "segment," because segment apply only in Polylines, and if in using PLC you should pick on a segment of an open Polyline that is not the end segment, it will find the nearer end and go from there, rather than from the segment you pick on [which of course can't be "continued" from], and if you should pick on a segment of a closed Polyline, it will tell you it can't work with one of those.

Kent Cooper, AIA
0 Likes
Message 10 of 13

alanjt_
Collaborator
Collaborator
Immediately after drawing the arc, being the catalyst. Hence the reason I wrote the routine, as I stated.

I tried your routine, and when I selected an arc, it just started the pline command as normal, not drawing it tangent to anything.
0 Likes
Message 11 of 13

Kent1Cooper
Consultant
Consultant

@alanjt_ wrote:
Immediately after drawing the arc, being the catalyst. Hence the reason I wrote the routine, as I stated.

I tried your routine, and when I selected an arc, it just started the pline command as normal, not drawing it tangent to anything.

Immediately after drawing the Arc, if you're continuing off the end rather than the start of the Arc, you don't need any routine to draw a tangent-continuation Line, as described in Post 9.  [TLA even imposes an unnecessary extra step, since it requires selecting the Arc you just drew, which the method in Post 9 does not.  But that method won't do what you're after if you want to draw the Line from the start of that Arc.  However, it does "know" in which direction you drew it, even though an Arc's entity data stores information always with the "start" at the clockwise end, always proceeding counterclockwise.]

 

Yes, PLC starts a normal Pline command, and even though the rubber band doesn't lock into the tangent direction, if [as described in both Posts 7 & 9 -- did you try it?] you choose the Length option and give it a length, it does draw it as a tangent continuation from the end of the Arc [or Polyline or Line, if that's what you selected -- choices that TLA doesn't allow].

 

It could be made to lock into that direction with a < entry as in earlier posts here.  But PLC is designed to continue a Polyline in whatever way you want to continue it, not only tangentially.  Also, a locked-in direction at the start will be lost if the User calls for any other Pline-prompt options [Width, etc.] before picking a next-vertex point [not an issue with a Line, obviously].

 

And if you choose the Arc option, PLC does draw it tangent to the end [at least it "drags" that way, though you can overrule that with several of the Pline-prompt options], even though the selected object is not part of the Polyline it's drawing yet -- it's not truly "continuing" -- but will be joined to it when you're done.

 

PLC won't be all things to all people, and isn't preferable to TLA in all situations, but is just another way of achieving tangent continuations, in more situations than TLA can do.

Kent Cooper, AIA
0 Likes
Message 12 of 13

alanjt_
Collaborator
Collaborator

@Kent1Cooper wrote:

@alanjt_ wrote:
Immediately after drawing the arc, being the catalyst. Hence the reason I wrote the routine, as I stated.

I tried your routine, and when I selected an arc, it just started the pline command as normal, not drawing it tangent to anything.

Immediately after drawing the Arc, if you're continuing off the end rather than the start of the Arc, you don't need any routine to draw a tangent-continuation Line, as described in Post 9.  [TLA even imposes an unnecessary extra step, since it requires selecting the Arc you just drew, which the method in Post 9 does not.  But that method won't do what you're after if you want to draw the Line from the start of that Arc.  However, it does "know" in which direction you drew it, even though an Arc's entity data stores information always with the "start" at the clockwise end, always proceeding counterclockwise.]

 

 

As I have stated, I'm fully aware of how the line command acts if executed directly following an arc having been drawn. However, TLA exists as a way to continue a tangent line from any existing arc. I never intended users to draw an arc, then execute TLA. I was just sick of needing a piece of tangent from an arc and having to draw an arc on top of it to then execute the line command so it would draw it tangent.

 

 


@Kent1Cooper wrote:

 

Yes, PLC starts a normal Pline command, and even though the rubber band doesn't lock into the tangent direction, if [as described in both Posts 7 & 9 -- did you try it?] you choose the Length option and give it a length, it does draw it as a tangent continuation from the end of the Arc [or Polyline or Line, if that's what you selected -- choices that TLA doesn't allow].

 

It could be made to lock into that direction with a < entry as in earlier posts here.  But PLC is designed to continue a Polyline in whatever way you want to continue it, not only tangentially.  Also, a locked-in direction at the start will be lost if the User calls for any other Pline-prompt options [Width, etc.] before picking a next-vertex point [not an issue with a Line, obviously].

 

And if you choose the Arc option, PLC does draw it tangent to the end [at least it "drags" that way, though you can overrule that with several of the Pline-prompt options], even though the selected object is not part of the Polyline it's drawing yet -- it's not truly "continuing" -- but will be joined to it when you're done.

 

PLC won't be all things to all people, and isn't preferable to TLA in all situations, but is just another way of achieving tangent continuations, in more situations than TLA can do.


I didn't realize you had to specify "length" first to get a tangent continuation in your command.

I have my startup set cmdecho to 0, so I didn't see any prompts after selecting the initial arc.

I'm not saying it has to be locked in, I just didn't see the relevance of PLC since I couldn't see the prompts - see above statement.

0 Likes
Message 13 of 13

Kent1Cooper
Consultant
Consultant

@alanjt_ wrote:

I didn't realize you had to specify "length" first to get a tangent continuation in your command.

I have ... set cmdecho to 0, so I didn't see any prompts after selecting the initial arc.....


It's not part of my command, except as a result of being part of the PLINE command that it uses [when in line-segment mode].  PLC does assume command echoing being on to begin with.  When I've worked out those kinks, it will turn it off for parts of what it does, and could be made to turn it on [rather than just reset whatever it was set to] for relevant parts, for anyone who may generally have it off.
Kent Cooper, AIA
0 Likes