AnyRail Model Railroad Forum

General Category => Tips and tricks => Topic started by: magnus on November 19, 2021, 09:23:55 PM

Title: Automate multiple Flex track layout
Post by: magnus on November 19, 2021, 09:23:55 PM
Flex tracks in AnyRail has many advanced features (not all yet documented in the manual). But I cannot figure out how lay out multiple flex tracks in an optimal way. Seems like a computable problem and thus would be possible in AnyRail. And I want to use both AnyRail's Curves and Easements on the Flex track.

For example, the attached file has some flex track for a hidden staging area. As you see the layout is not very nice. I could spend time on making it nicer manually, but it seems like everything is known here and thus should be possible to layout automatically. Is there a way to do that in Anyrail? One simplification would be to only use one too long flex track, do the layout with that one piece, and then cut it too appropriate pieces. But that does not produce a useful layout.

(In the example, the Minimum radius 1 is set to 547mm (~22"), R4 in Fleischmann HO Profi track, but that is just an example.)
Title: Re: Automate multiple Flex track layout
Post by: BadBanana on November 20, 2021, 01:04:37 PM
I am not sure what you think is not in the manual...  However, to achieve a better layout, I would recommend to use the ability to draw curves of fixed radius and angle with the Curve Flex function.  Note that at least one end of the piece of flex track being adjusted must not be connected to anything in order to use this function.  This allows you to place multiple pieces together and also to have very consistent track spacing.  I reworked your example a little using fixed radii of 700, 620 and 540 in 60 degree sections.  I used the Freeze Flex function to ensure that I don't accidental modify them, but you can also use the Glue function if that is more appropriate.  Please see the attached file.
Title: Re: Automate multiple Flex track layout
Post by: magnus on November 23, 2021, 03:14:01 AM
Thanks @BadBanana, that's much better, but it's still quite manual. And it doesn't produce the optimal layout. However, your advice put me on a better track ;-).

Using the formula for arc length

     Arc = θ × (π/180) × r, where θ is in degree

and existing AnyRail features I am now trying a better method:
(This method still needs to be adjusted for a) AnyRail Easements and b) outer and inner rail length to cut the flex rail)

1. Input variables*:
Minimum curves radius (R4): 547.0mm
Space between (curved) tracks: 63.5mm
Length of flex track: 800.0mm
Inner distance between railheads**: 16.5mm

*All these are Fleischmann HO Profi standards
**Since AnyRail and Fleischmann both measure radii to center of track, the arc lengths and angles need to be adjusted slightly for inner and outer rails, hence the 16.5mm adjustments when cutting the flex rail

Let's now calculate the requirements for the flex track for the inner track in the example file

2. Measure and calculate needed flex track length
The inner track turnouts in the example have an angle of ~51°, so we will need the full turn to be 180+51=231°. Each turnout's diverging track is 18° so our flex track only needs to curve 231-2*18=195°

Therefore the length of the flex track needs to be 195*(π/180)*547.0mm=1860.7mm
(Unfortunately I cannot enter this in AnyRail as the limit for flex track is 90 degrees)
 
3. Each flex track piece
Each flex track is 800 mm so we need 2 whole and 0.326 of a third piece (1860.7/800.0=2.326)

Each flex track needs to curve:
800mm=θ × (π/180) x 547mm gives θ=83.84°

and the shorter flex track should be cut to length of
0.326*800=283.7mm
and an angle of
0.326*83.84=29.7°

Entering this data into AnyRail produces almost the perfect fit***. I have attached your example using this method using 540mm radius instead (which you used). Using AnyRail Guides is very helpful when inspecting this so turn them on.

*** It is not a perfect fit if you study it closely, it is off by a few mm. Not sure why, but it could be:
- the angle measured is not exact (would be great if AnyRail gave the angle of a pair of selected track/turnouts, maybe in the status bar when 2 straight tracks are selected).
- the curves in the turnouts are radius=647.0mm (thus not the same as 540mm used in the example), and they are typically part of the Easement.

I had to add a parallel straight section to extend the turnout, which I need to think more about why that is the case
I also noticed that the flex track length has been adjusted to 801 mm in AnyRail, not sure why.

As mentioned, Easements need to be added to this method, which I will work on next.

@BadBanana - did you use AnyRail Easements in your example (not sure how to tell)? I also noticed you modified the placement of turnouts a bit, was there any method to this, or just to maximize staging track length?

Oh, and for the missing documentation: The colors red, orange, yellow, on Flex Track I found out are connected to Minimum Radius 1,2,3 settings. Very clever, but I had to search the forum to figure this out. I am not complaining, I know David adds features in the interim releases, which is great, but only updates the manual for major releases.
Title: Re: Automate multiple Flex track layout
Post by: BadBanana on November 23, 2021, 07:43:02 PM
Quote from: magnus on November 23, 2021, 03:14:01 AM@BadBanana - did you use AnyRail Easements in your example (not sure how to tell)? I also noticed you modified the placement of turnouts a bit, was there any method to this, or just to maximize staging track length?

Hi! I am glad I could help, even if only a little.

My placement of the fixed curves was approximate, as you observed. (I did it in a bit of a rush.)  I moved the turnouts just to try to improve the way they fed into the curves, and I did not pay any particular attention to easements.  I did not use the Easement function - it's something that I have not really looked into, to be honest.  I just connected from the fixed radius curves to the turnouts with more flex track pieces and used the Smooth function. I might have also nudged the control points just a little in one or two cases, but I was not trying to be scientific about it.  Rather I was aiming for a quick and obvious improvement over the previous version that I felt might at least be usable.