Author Topic: Create ARC with TAN-TAN-RAD  (Read 427 times)

0 Members and 1 Guest are viewing this topic.

Peter2

  • Swamp Rat
  • Posts: 618
Create ARC with TAN-TAN-RAD
« on: April 07, 2021, 05:03:03 AM »
There is the standard command to create a circle with "tan - tan - rad". Someone who knows a solution to create an arc with "tan tan - rad"?
(Example with new yellow arc between red and green arc see attachment)
Peter

AutoCAD Map 3D 2018 German (so some technical terms will be badly retranslated to English)
BricsCAD V19

BIGAL

  • Swamp Rat
  • Posts: 663
  • 30 + years of using Autocad
Re: Create ARC with TAN-TAN-RAD
« Reply #1 on: April 07, 2021, 10:06:45 PM »
Its a question that is often raised there are 4 possible solutions which is why TTR is close but then have to trim. In some 3rd party Civil  software this was solved by asking for approximate new arc centre pt.

Just did something worked great drew a couple more arcs failed miserably, need to look into that math answer for 3 arcs.

A man who never made a mistake never made anything

kirby

  • Newt
  • Posts: 41
Re: Create ARC with TAN-TAN-RAD
« Reply #2 on: April 09, 2021, 01:30:41 PM »
Hi Peter

Here is code that does just that, draw an arc transition between two arcs.  It will not do a reverse curve (S curve), just curves that bulge in the same direction.  Only uses arcs or circles as input, no polyarcs (but could be updated).

The workhorse is a routine that finds the intersection of 2 circles (which can be 2 points, a single point of tangency, or no intersections).  The 'trick' is that radials of tangent arcs must pass through the centre points of both arcs/circles.

Old code clipped out of a larger pavement geometry library, but I did a cleanup, sprinkled lots of comments throughout and added a quick help routine that lists the commands.

Regards,
Kirby

tombu

  • Bull Frog
  • Posts: 223
  • ByLayer=>Not0
Re: Create ARC with TAN-TAN-RAD
« Reply #3 on: April 10, 2021, 03:36:55 AM »
FILLET command set to [No trim] does that.
Option is controlled by the TRIMMODE (System Variable)
Tom Beauford P.S.M.
Leon County FL Public Works - Windows 7 64 bit AutoCAD Civil 3D

BIGAL

  • Swamp Rat
  • Posts: 663
  • 30 + years of using Autocad
Re: Create ARC with TAN-TAN-RAD
« Reply #4 on: April 10, 2021, 08:34:16 PM »
tombu only works for certain 2 arc patterns. Was getting a internal answer rather than external.

Kirby I think your on the money was looking at a option of like a W arc, a S arc, C a arc arc arc as requested.

Would do a dcl image please choose style, need some time to play.

Have the advantage of VL using intersectwith for working out trim side of circle or arcs simplify the coding did have that working as 1st attempt for "W" style but tombu answer much simpler. Will work on the C option next as I am pretty sure code will be shorter, using VL is shorter then assoc.

A quick comment but may work out wrong for a S add diff to 1st arc subtract diff for 2nd arc draw circles get 2 point possible solution.



« Last Edit: April 10, 2021, 09:00:27 PM by BIGAL »
A man who never made a mistake never made anything

tombu

  • Bull Frog
  • Posts: 223
  • ByLayer=>Not0
Re: Create ARC with TAN-TAN-RAD
« Reply #5 on: April 11, 2021, 07:06:41 PM »
tombu only works for certain 2 arc patterns. Was getting a internal answer rather than external.
What about this old lisp of yours that draws an arc clockwise between 2 lines or arcs in the direction of the line picks?
https://www.cadtutor.net/forum/topic/60493-connecting-lines-with-an-arc/?tab=comments#comment-500044
« Last Edit: April 11, 2021, 07:11:53 PM by tombu »
Tom Beauford P.S.M.
Leon County FL Public Works - Windows 7 64 bit AutoCAD Civil 3D

BIGAL

  • Swamp Rat
  • Posts: 663
  • 30 + years of using Autocad
Re: Create ARC with TAN-TAN-RAD
« Reply #6 on: April 11, 2021, 09:08:57 PM »
A lot of code lost when I changed to semi retirement, it not really working. Thanks though have saved it again for future use.
A man who never made a mistake never made anything

Peter2

  • Swamp Rat
  • Posts: 618
Re: Create ARC with TAN-TAN-RAD
« Reply #7 on: April 12, 2021, 06:06:17 AM »
Hi

thanks to all for contributions. Just for testing I add a drawing with 2 examples (red and cyan are existing, yellow it the newly created one. Exact trimming was not done):
- 2 arcs in same direction (of rotation)
- 2 arcs in different directions

For both I failed to work with "fillet command": The first shows "No solution", the second creates the arc in a correct, but unwanted position.
Peter

AutoCAD Map 3D 2018 German (so some technical terms will be badly retranslated to English)
BricsCAD V19

tombu

  • Bull Frog
  • Posts: 223
  • ByLayer=>Not0
Re: Create ARC with TAN-TAN-RAD
« Reply #8 on: April 12, 2021, 08:57:40 AM »
Hi

thanks to all for contributions. Just for testing I add a drawing with 2 examples (red and cyan are existing, yellow it the newly created one. Exact trimming was not done):
- 2 arcs in same direction (of rotation)
- 2 arcs in different directions

For both I failed to work with "fillet command": The first shows "No solution", the second creates the arc in a correct, but unwanted position.
An arc with a radius of 10 joins the two for the first exactly. It's probably not working to enough precision for fillet to provide the solution.
What's wrong with the second one?
Tom Beauford P.S.M.
Leon County FL Public Works - Windows 7 64 bit AutoCAD Civil 3D

kirby

  • Newt
  • Posts: 41
Re: Create ARC with TAN-TAN-RAD
« Reply #9 on: April 12, 2021, 10:25:46 AM »
Hi

My routine only does the case of a larger radius transition arc between 2 other arcs all with the same direction of curvature (BigAl referred to as 'C' transition, we call it a 3 centred compound curve in Canada.  There are 2 versions, large transition radius which my routine solves or small transition radius.  Have another solver for the small transition radius case, but it is not generic. 

We use a 3 centred compound curves in pavement geometry to avoid spirals for larger intersection curb returns, e.g. 50-25-50m or 70-35-70m but having the middle curve offset by a distance.  These can be solved by simple offset geometry, since the larger 'outside' radii almost always transition to a line (aka tangent) segment.

If transition radius is smaller than one or either of the original arcs, then the centre point of the transition arc will lie on the radials.  Solving the general case could be done by iteration and numerical methods (e.g. bisection method); I don't think this can be directly solved by geometry (at least not with my 35 years out-of-date engineering education).   Need some thinking time for  this.

Circle TTR as suggested by Tombu can be used to do the 'W' transition, it seems to always default to this.

S transition with transition arc having same direction as one of the original arcs is a hybrid.  BigAl is right, you would need to specify the shape of transition vs. solving all possible cases.

(Note most of my code is 25+ years old, so did everything the 'hard' geometry way pre VL.  But not sure why Autodesk/AutoLisp would include an 'inters' command for line-line intersections but nothing for built in for other primitives line-circle or circle-circle intersections, or line-plane, plane-plane, etc.  Now moot with VL intersectwith methods).

kirby

  • Newt
  • Posts: 41
Re: Create ARC with TAN-TAN-RAD
« Reply #10 on: April 12, 2021, 02:20:29 PM »
Update that handles the C curve option (all arcs in same direction). 

Hopefully can solve the S curve option and add some commentary/feedback on which transition of radii will or will not work, after another lunchtime or two.

Command is 'AAT'

New routine 'ArcRay' added that can help visualize the radials.  Transition arc will have centre point on the circle at endpoints of these radials.

BIGAL

  • Swamp Rat
  • Posts: 663
  • 30 + years of using Autocad
Re: Create ARC with TAN-TAN-RAD
« Reply #11 on: April 12, 2021, 11:20:20 PM »
The C W S was just random idea for using with Initget. Bit shorter than 3CCCIC  :2funny:

The solution used by the old software was to pick a approximate center point for the new arc so implying a direction for the arc.
A man who never made a mistake never made anything

kirby

  • Newt
  • Posts: 41
Re: Create ARC with TAN-TAN-RAD
« Reply #12 on: April 16, 2021, 02:32:10 PM »
Hi

I think I might have it figured out after 3 lunchbreaks (aka think-breaks).

Testing Routine 'ArcRay' simply draws radial lines (projections from centre point to arc) at a given transition radius length along the arc at small degree increments.

Testing Routine 'ArcRadials' does the next step of fitting 3 point circles to the ends of radials.  Each arc will have two of these circles, one on the side towards the centre point (inside, drawn in colour red) and the other beyond the arc (outside, drawn in green).  The outer circle will simply be the original arc radius plus transition radius.  The inner circle will be the arc radius minus the transition radius, however if the transition radius is greater than the arc radius, then the radial will extend beyond the centre point.  The inner circle will have radius abs(arc rad - trans rad).  One of the attached images below shows the result of running both ArcRay and ArcRadials on 2 pairs of arcs.  If none of the circles intersect, then there are no possible transition arcs with the selected radius.

Since you have 2 arcs (or circles) that you want to draw a transition arc between, you will have 4 circles total (2 inside and 2 outside for each).  The intersection points of the circles will be the potential centre points of your transition arc.  2 circles can have 0, 1 of 2 points of intersection, based on the position of the circles w.r.t. each other.  Testing routine 'TestCCI' will show these intersections.  With 4 circles, you can have between 0 and 8 potential transition arcs.

Main routine 'ArcArcTrans' or shortcut 'AAT' uses the above to calculate each transition arc.  My original 20+ year old routine simply used the transition arc with the midpoint closest the the midpoint between the selection points of both original arcs, but this can return one of the arcs that you don't want.  The updated routine cycles through each of the transition arcs, draw them (with optional radials from centre point) and ask the user if they want to keep or discard.  I tried to come up with a new method of identifying the best transition arc, but sometimes there are a few valid options so just deleted this work in progress.

Note that for compound curves (curves in the same direction, C-Curves in BagAl's parlance, e.g. nn vs. nu or un, or Inside+Inside circle intersection), there is a defininte minimum and maximum transition radius that will work and these relate to the smallest and largest radii of the original arcs and the distance between the arc centre points.  For reverse curves (curves in opposite directions, S-curves, e.g. nu and un), there is a lower bound on the transition radius related to the smallest radius of the original arcs but no upper limit.  Alternate would be to do something like BigAl remembered and select an arc based on a selection point closest to the arc centre point.

Input can be ARC or CIRCLE entities only; I didn't want to deal with the complications of CW polyarc segments until I had something working.

All routines set an undo point.  Just use 'Undo' 'Back' to reset.

Outcome showing the resultant transition arcs for Peter's 2 cases are shown on the second image below.  Not the most elegant tool and (optionally) leaves a lot of messy circles to help the user understand the situation, etc. but it seems to work for a number of different combinations of arcs.  Please let me know if there are any problems.

Cheers!