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
microelly2
Posts: 4228
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Civil Engineering Design functions

Postby microelly2 » Wed Apr 25, 2018 1:08 pm

I have inserted the code into the nurbs workbench for testing as shown in the video.

phpBB [video]



here is the demo file
https://www.dropbox.com/s/9o0y8d0d7fb13 ... FCStd?dl=0
the latest version of the nurbs wb is required
User avatar
Joel_graff
Posts: 1108
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil Engineering Design functions

Postby Joel_graff » Wed Apr 25, 2018 2:11 pm

microelly2 wrote:
Wed Apr 25, 2018 1:08 pm
I have inserted the code into the nurbs workbench for testing as shown in the video.

phpBB [video]



here is the demo file
https://www.dropbox.com/s/9o0y8d0d7fb13 ... FCStd?dl=0
the latest version of the nurbs wb is required
That really looks like what I've been hoping to achieve... but how is adding new curves / deleting existing handled?

Also, I've encountered the same error with nurbs as I have with your transportation wb fork - an error with the global name 're' in InitGui.py.

I solved it in transportation-wb - basically, it's a missing import of the regex module. I see it both on my linux and windows machines. I can fix it on my side, but the fact that it's happening suggests there's something in your environment that's creating broken code when you push it to github... or maybe just something I don't understand about python. :)
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 » Wed Apr 25, 2018 3:07 pm

First of a ll the mystic re:
I import the re module in my pluginloader which is always started as one of my first workbenches.
So adding a

import re

into the InitGui will help. I have to fix it in all of my workbenches.
but how is adding new curves / deleting existing handled?
The workflow can be:
given two lines (endlines fo two streets)
create a special sketch by script (the Sketch of my demo)
connect/align the first line with one given street
connect/align the last line with the other given street

then there are 6 degrees of freedom to vary the layout.
changing some of them.
applying the method Sketchertools - create Arc Sketch creates the two arcs
we can add some other geometries into this 2nd sketch too to get an object with all information needed for the next steps
at the moment I only put the two arcs into the calculated sketch but we can add more.

we can create on the same way templates for a one arc connection and a three arc connection too if required.
the one arc connection consists of 6 lines
the 3 arc connector will have 12 lines.
User avatar
microelly2
Posts: 4228
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby microelly2 » Thu Apr 26, 2018 2:26 pm

Use of three layers
constraints = given geometry connectors
design = sketches with lines and constraints
result = calculated street segments

the design templates can be stored in a sketcher library and loaded on demand
the result sketch depends on the design sketch and is completly rewritten when something changes
further design on top of the result sketch should be done in a next layer with result sketch as external geometry

there is a default label generator for ech vertex, edge, face of a part.
the content of the labels can be changed by the user
unused labels can be deleted.

todo: label should automatic follow the geometry if it changes.

phpBB [video]
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 Apr 26, 2018 4:06 pm

microelly2 wrote:
Thu Apr 26, 2018 2:26 pm
Use of three layers
constraints = given geometry connectors
design = sketches with lines and constraints
result = calculated street segments
:shock:

That really looks good. The templates solve the problem I'd been struggling with. Is a top-layer constraint required in order to connect two templates? Or can two templates be directly connected to each other in the design layer?

I'm guessing by separating templates using top-layer constraints makes it much easier to add / delete and otherwise manage the alignment...?

Moving forward, the goal would be to develop a workflow that shows creating a horizontal alignment (which you've done nicely here), projecting it to a terrain to build the existing vertical profile, then bringing it back into sketcher to lay out the new vertical profile. All stuff you've demonstrated, it's just a matter of piecing it all together.

Good job. It looks really cool. :D
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 Apr 26, 2018 7:32 pm

Joel_graff wrote:
Thu Apr 26, 2018 4:06 pm
Is a top-layer constraint required in order to connect two templates? Or can two templates be directly connected to each other in the design layer?
if the "end segment" of a template is not yet connected we can use it as a new constrait layer (contraints layer must not be the same sketch)
this way constraint layers and design/result layers can build a DAG.
But the idea of using a feedback sketch to write the end segment back to a constraint sketch will work too. In this case we must be aware that no
cyclic dependencies are create which may be difficult to see for end users - we must play with this idea.

I want only one template per sketch because I fear complexity in the sketches.

I'm guessing by separating templates using top-layer constraints makes it much easier to add / delete and otherwise manage the alignment...?
yes, we can add/modify constraint layers.
If something goes wrong only the related template is crashed. We can delete and recreate it woithout impact to the others.

Moving forward, the goal would be to develop a workflow that shows creating a horizontal alignment (which you've done nicely here), projecting it to
a terrain to build the existing vertical profile, then bringing it back into sketcher to lay out the new vertical profile. All stuff you've demonstrated, it's just a matter of piecing it all together.
indeed, these are the next steps. At the moment no problems infront of us, land ahoi :D
User avatar
microelly2
Posts: 4228
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby microelly2 » Mon Apr 30, 2018 2:19 pm

Joel_graff wrote:
Thu Apr 26, 2018 4:06 pm
Moving forward, the goal would be to develop a workflow that shows creating a horizontal alignment (which you've done nicely here), projecting it to a terrain to build the existing vertical profile, then bringing it back into sketcher to lay out the new vertical profile. All stuff you've demonstrated, it's just a matter of piecing it all together.

split the corridor path into two curves:
one is the xy-projection
the other is the z-coordinate along the path length s

and recombine them after modification back into a 3D curve
phpBB [video]
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 » Mon Apr 30, 2018 2:55 pm

microelly2 wrote:
Mon Apr 30, 2018 2:19 pm
split the corridor path into two curves:
one is the xy-projection
the other is the z-coordinate along the path length s

and recombine them after modification back into a 3D curve
That's it! Now to enable the editing in a split view inside sketcher...

I also tried to follow the workflow in your PM - there's something missing on my side... I'll have to look at it again over lunch to let you know what's broken for me.
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 » Thu May 03, 2018 12:47 pm

@microelly2: I took a look at the sketchlib templates that you've developed. It's off to a good start!

Really, I think the geometry is well-constrained and isn't overly complex.

As for templates to develop, I really see only a few key templates as necessary:

1. A simple curve (with two tangents)
2. A 2-center curve (two simple curves in series, in the same direction)
3. A 3-center curve (three simple curves in series with an over-arching pair of tangents which span all three curves)
4. A spiral curve (A special 3-center curve with two tangent sections on either side)
5. Possibly a tangent template? It's just a line, but it may facilitate other cleanup work to wrap it in a template...
6. Default alignment layouts for special designs like interchanges / roundabouts (see https://en.wikipedia.org/wiki/Interchange_(road))

Referring to the screenshot, I just wanted to put down a few notes about what it would take to make this a viable horizontal design tool (and, by extension, the vertical design tool as well). Referring to the screenshot:

Capture.JPG
Capture.JPG (73.14 KiB) Viewed 248 times

1. The parallel and equal-length constraints should be hidden. Equal-length tangents are assumed by default, except in cases of compound (2 / 3-center curves).

2. Blocking constraints should be applied to all tangents by default. Dragging a tangent line should release the block constraint on it and it's adjacent tangents. Dragging a tangent PI (point of intersection) should release the block constraints on the adjacent tangents. Releasing either one should re-apply the block constraints. To that end, I've managed to get dragging to work in the 3D view, but not inside Sketcher...

3. Need to add radius control tangent - basically a line added on the tangent layer that's orthogonal to the curve tangents and extends from the endpoint of the curve to it's center point.

4. Need to default to a kilometer / mile scale with resolution down to the nearest hundredth of a foot (centimeter) or thousandth of a foot (millimeter).

5. Need to implement stationing.

Anyway, not much of this is critical for a proof-of-concept release, but they do represent how close we are to something potentially useful (IMO).

I should probably do some work on the github milestones and issues to target the features for a proof-of-concept release...

I'm going to look into your approach and try to understand it better. I'd like to be able to contribute to the templates as well...
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 » Fri May 04, 2018 6:44 am

bp_775.png
bp_775.png (457.67 KiB) Viewed 214 times
light blue constraint tangents
orange/yellow design sketches
red result street segments
bp_776.png
bp_776.png (121.02 KiB) Viewed 214 times
the main problem for me (who never build a street) is to find the positions where one arc ends and the next starts.
I will use this example crossing to find which methods we need to be comfortable such as fast lock/unlock for special groups of geometries inside the sketch and hide/unhide constraint groups too.

for stationing I will create an extra layer with symbols and markers

at the moment I create only markers for the vertexes and edges:
bp_777.png
bp_777.png (13.45 KiB) Viewed 214 times


for reference picture i.imgur.com/5UfOKRt.jpg
Image