Civil engineering feature implementation (Transportation Engineering)

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
User avatar
Joel_graff
Posts: 1108
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby Joel_graff » Wed Dec 12, 2018 8:33 pm

So just a quick update.

I've managed to import horizontal and vertical curve information. I pulled the data from an actual highway project that's about 10 miles long. To this point, I've managed to import horizontal and vertical curves into FreeCAD and create custom FeaturePython objects to store them. I've also managed to generate a horizontal alignment from a selected list of curves.

The imported curve objects:


align_tree.JPG
align_tree.JPG (51.97 KiB) Viewed 645 times



As you can see from the list, the alignment data is stored in a hierarchy, with each alignment containing two groups, one for horizontal curve data, and the other for vertical curves. Selecting a curve displays the relevant design information.

Having imported the curves, I have built the algorithm to generate the alignment as a BSpline from the horizontal curve data (vertical curve generation is next). It seems to be working! The top image is the FreeCAD alignment, and the bottom image is the original alignment in Microstation, from which I extracted the design data:

align_fc.JPG
align_fc.JPG (21.16 KiB) Viewed 645 times
align_micro.JPG
align_micro.JPG (26.35 KiB) Viewed 645 times



However, the accuracy of the Spline is not very good (10-50 feet). The accuracy needs to increase by three or four orders of magnitude, by my estimation.

Still, it's a start.
You can find the FreeCAD Trails workbench for transportation engineering on my github at:
https://www.github.com/joelgraff/freecad.trails
triplus
Posts: 8278
Joined: Mon Dec 12, 2011 4:45 pm

Re: Civil engineering feature implementation (Transportation Engineering)

Postby triplus » Thu Dec 13, 2018 10:30 am

Looks close. ;)
User avatar
Joel_graff
Posts: 1108
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby Joel_graff » Thu Dec 13, 2018 1:15 pm

triplus wrote:
Thu Dec 13, 2018 10:30 am
Looks close.
Turns out the issue was the spline tessellation - @chrisb figured that out for me. Dropped it to it's smallest value in the Draft preferences and, visually, it improved by maybe two orders of magnitude.

Still, it's a problem, but I don't know how much of a problem at this point...

Now it's on to figuring out how to add sideroad horizontal alignments, all of the vertical alignments, and then generate the composite 3D alignments by smooshing the horizontal and vertical together (could use a good spline-smooshing algorithm if anyone has one handy... ;) )

..and THEN maybe I can get back to doing sweeps. :lol:
You can find the FreeCAD Trails workbench for transportation engineering on my github at:
https://www.github.com/joelgraff/freecad.trails
User avatar
microelly2
Posts: 4228
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby microelly2 » Thu Dec 13, 2018 4:18 pm

Joel_graff wrote:
Thu Dec 13, 2018 1:15 pm
and then generate the composite 3D alignments by smooshing the horizontal and vertical together (could use a good spline-smooshing algorithm if anyone has one handy... ;) )
Let me know when you have test data to smooth.
I made a lot of experiments last two month.
User avatar
Joel_graff
Posts: 1108
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby Joel_graff » Thu Dec 13, 2018 6:08 pm

microelly2 wrote:
Thu Dec 13, 2018 4:18 pm
Let me know when you have test data to smooth.
I made a lot of experiments last two month.
Will do. I'm trying to get sideroad alignments to place properly - then I have to implement building vertical curves. If I get the time I've been getting to work on that, I'm hoping I'll have something before Christmas. Maybe.
You can find the FreeCAD Trails workbench for transportation engineering on my github at:
https://www.github.com/joelgraff/freecad.trails
User avatar
Joel_graff
Posts: 1108
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby Joel_graff » Tue Dec 18, 2018 2:24 pm

Sideroad placement is complete. Had to relearn a lot of basic geometry, lol.

Note that the curve tessellations are dependent on the size of the spline's bounding box. Thus, at 0.01% error, with a spline about 50,000 feet long, I have accuracy in the range of 1-10 feet. In terms of model generation, lower accuracy is fine during design, so long as the modeling is done "by the numbers" and doesn't rely on the generated geometry. The final production model, however, would need 3 orders of magnitude greater accuracy than this.

Anyway, the hierarchy shows how the curves are imported and stored in a separate group. The user need only select the curve group and (in this case) press CTRL+G to auto-generate a horizontal curve spline. Splines for sideroads are automatically placed at the correct position along it's parent or reference alignment...


phpBB [video]


align_comp.png
align_comp.png (98.18 KiB) Viewed 500 times
Capture.JPG
Capture.JPG (65.56 KiB) Viewed 500 times
You can find the FreeCAD Trails workbench for transportation engineering on my github at:
https://www.github.com/joelgraff/freecad.trails
triplus
Posts: 8278
Joined: Mon Dec 12, 2011 4:45 pm

Re: Civil engineering feature implementation (Transportation Engineering)

Postby triplus » Fri Dec 21, 2018 9:15 am

Joel_graff wrote:
Tue Dec 18, 2018 2:24 pm
The user need only select the curve group and (in this case) press CTRL+G to auto-generate a horizontal curve spline. Splines for sideroads are automatically placed at the correct position along it's parent or reference alignment...
Too easy!

P.S. End users might complain a bit about the error marks in the tree view, though. :!:
User avatar
Joel_graff
Posts: 1108
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby Joel_graff » Sat Dec 22, 2018 12:42 am

triplus wrote:
Fri Dec 21, 2018 9:15 am
Too easy!

P.S. End users might complain a bit about the error marks in the tree view, though
Yeah, that's a recalculation issue I'm too lazy to fix. Not a big deal, but it doesn't matter at the moment. I'll get it one of these days. ..

I'm trying to get through the vertical curve generation right now. That has it's own challenges. But at least I can put to use some of the awesome code @microelly2 has created for this. ..
You can find the FreeCAD Trails workbench for transportation engineering on my github at:
https://www.github.com/joelgraff/freecad.trails
paullee
Posts: 1385
Joined: Wed May 04, 2016 3:58 pm

Re: Civil engineering feature implementation (Transportation Engineering)

Postby paullee » Thu Dec 27, 2018 11:54 am

Hi, I had not followed every single posts here but hope a swept-path analysis on FC maybe available some day and carry out analysis e.g. on the vehicular ramp I am trying to build shown below :)

I am trying to use the Part Sweep and find it behave different if different sets of profiles are used, anything to do with the sweep on spline problems?

2 profiles + 1 path (spine)
- 1st ScreenCapture
  1. I try this first
  2. I have a line on say level 0m that is the starting edge of the ramp
  3. Another line on say level 4m that is the ending edge of the section of ramp
  4. A line / arc just 'flat' on level 0m that is the curvilinear edge of ramp 'on plan' (- I havn't figured out how to make a 3d profile yet)
  5. Do a Part Sweep and it return something (+ Part Extrude) as expected
1 profile + 1 path (spine)
- 2 ~ 4 ScreenCapture
  1. I try this then
  2. I only use the starting edge on level 0m
  3. And the line / arc just on level 0m that is the curvilinear edge of ramp
  4. To do a Part Sweep and it return something ending with something like 'super-elevation' (a term learn from some highway engineer - do not know this is similar everywhere
It seem to 'control' the sweep, it may need to place the profile at every start / end of edges to prevent it from 'guessing' /'generating' from the inherent geometric ?

[EDIT]Or better still or possible, code to place profile at every start/endpoint of an edge and do a sweep every edges? Seem problematic if there are hundreds of edges for highway construction.
Screenshot from 2018-12-27 18-45-29.png
Screenshot from 2018-12-27 18-45-29.png (227.73 KiB) Viewed 292 times
Screenshot from 2018-12-27 18-46-06.png
Screenshot from 2018-12-27 18-46-06.png (226.15 KiB) Viewed 292 times
Screenshot from 2018-12-27 18-46-28.png
Screenshot from 2018-12-27 18-46-28.png (206.77 KiB) Viewed 292 times
Screenshot from 2018-12-27 18-47-30.png
Screenshot from 2018-12-27 18-47-30.png (218.82 KiB) Viewed 292 times
Attachments
Test_ ArchSketch_ 13_ Arcs_Problems _ Example _ Ramp Study.fcstd
(17.26 KiB) Downloaded 7 times
User avatar
Joel_graff
Posts: 1108
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby Joel_graff » Thu Dec 27, 2018 2:10 pm

paullee wrote:
Thu Dec 27, 2018 11:54 am
It seem to 'control' the sweep, it may need to place the profile at every start / end of edges to prevent it from 'guessing' /'generating' from the inherent geometric ?

[EDIT]Or better still or possible, code to place profile at every start/endpoint of an edge and do a sweep every edges? Seem problematic if there are hundreds of edges for highway construction.
I'll have to take a closer look at your file, but at this point, I still think splines are the way to go. The problem with splines is that they have a limited level of accuracy. For example, suppose I generate a spline that's several miles / kilometers long. I can set the tessellation of the spline (in the Part Design preferences) to 0.01%, which gives me 1-10 foot accuracy (1/3rd to 3 meters). I need accuracy down to the thousandth of a foot. The problem is, tessellation is controlled by the size of the spline - it's not fixed. Apart from that, I think it would be prohibitively difficult to try to manage sweeps that are constrained to individual arcs / line segments.

At the moment, I'm working on generating 3D splines from existing design data, but at this point, it's manually entered - not drawn in sketcher as I had originally hoped. Still, I'm getting close. Hopefully will have progress in the next month.
paullee wrote:
Thu Dec 27, 2018 11:54 am
Hi, I had not followed every single posts here but hope a swept-path analysis on FC maybe available some day and carry out analysis e.g. on the vehicular ramp I am trying to build shown below
@microelly2 wrote the swept path analysis tool and I think it's perfectly useful in a 2D context. But, it's missing a UI. I don't think the UI would be difficult to create. It just takes time. :/
You can find the FreeCAD Trails workbench for transportation engineering on my github at:
https://www.github.com/joelgraff/freecad.trails