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.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
Kunda1
Posts: 8698
Joined: Thu Jan 05, 2017 9:03 pm

Re: Civil engineering feature implementation (Transportation Engineering)

Postby Kunda1 » Mon Sep 18, 2017 4:17 am

microelly2 wrote:ping
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
microelly2
Posts: 4690
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby microelly2 » Wed Sep 20, 2017 3:00 pm

I work at the moment on the problem finding a two arc connection between two lines AB and BC with tangential constraints
bp_577.png
bp_577.png (9.75 KiB) Viewed 1025 times
There are always two solutions
the expected short yellow curve
and the longer pink solution
both solutions have one degree of freedom.
It is the point T/T2 where the arcs connect.
I expect that is possible to create an unambigious parametric solution for that problem;start with two lines create this kind of connector.

here the example
Attachments
zwei_tangentenkreise_mehrere_loesungen.fcstd
(21.28 KiB) Downloaded 18 times
User avatar
saso
Posts: 1584
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby saso » Wed Sep 20, 2017 3:15 pm

I never did any real road designs but back in the school we always used the euler spiral (klotoide) for this, like line-klotoide-arc-klotoide-line :|

https://en.wikipedia.org/wiki/Euler_spiral
https://de.wikipedia.org/wiki/Klothoide
https://en.wikipedia.org/wiki/Geometric_design_of_roads
https://sl.wikipedia.org/wiki/Klotoida# ... _curve.svg
User avatar
microelly2
Posts: 4690
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby microelly2 » Wed Sep 20, 2017 8:56 pm

There exists a lot of problems with multiple solutions.

Example:
Given 2 side lengths and one non enclosed angle for a triangle the solution can be ambigious.
How I have to model this task with the sketcher functionality to get exactly the solution I want?


The sketcher (always) gives you one solution. But is this solution that what you expect.
How I can constraint a sketch by using "inequalities" like: the point should lie inside a certain area (example rectangle or circle).

The other example is my last post.

I have looked for a method to describe inequalities/intervals in terms of the sketcher.
With these methods I can restrict the searching area for the sketcher solver.
User avatar
Joel_graff
Posts: 1848
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby Joel_graff » Wed Sep 20, 2017 11:40 pm

microelly2 wrote:
Wed Sep 20, 2017 8:56 pm
How I can constraint a sketch by using "inequalities" like: the point should lie inside a certain area (example rectangle or circle).
If we can figure out how to support inequalities, I can see how to easily create a boundary that contains the correct solution. Another option would be to require that the rotation angle of the arc be less than 360 degrees as, in every case, the two solutions will be less than and greater than / equal to 360 degrees. A third approach would be to force it to calculate both solutions and choose the one with the shorter curve length.

In fact, it would be ideal to be able to specify an inequality as a property of the constraint itself, based on a property / properties of the adjoining geometry. Thus, when the solver solves the problem, it checks the constraint for any user-defined inequalities and rejects solutions which fail it.

That, in fact, might go a long way to solve the "user expectation" problem that we discussed earlier.

I don't see any way to get it done without rewriting the solver to support new functionality. But the concept of a "constraint inequality" makes a lot of sense to me.

edit: I didn't look closely enough to realize that these were two curves and not one. That said, a constraint with an inequality that doesn't permit the angle of either curve to meet or exceed 180 degrees would be sufficient, here.
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
microelly2
Posts: 4690
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby microelly2 » Thu Sep 21, 2017 9:28 am

this is an example of a circle which can only lie inside the square.
inequality_sketch.FCStd
(4.17 KiB) Downloaded 21 times
User avatar
microelly2
Posts: 4690
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby microelly2 » Wed Sep 27, 2017 3:11 pm

an animation of the possible solution to connect two lines by tangential arcs.
phpBB [video]

I needed some investigation to "see" a robust structure for modeling the problem.

the next step will be a python sketch extension to create these parametric objects by one click from gui.
User avatar
Joel_graff
Posts: 1848
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby Joel_graff » Fri Sep 29, 2017 11:34 am

That definitely looks like it solves the problem. Good work!
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
Kunda1
Posts: 8698
Joined: Thu Jan 05, 2017 9:03 pm

Re: Civil engineering feature implementation (Transportation Engineering)

Postby Kunda1 » Sat Oct 07, 2017 12:21 pm

@microelly2 nice! What's the next step ?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
microelly2
Posts: 4690
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby microelly2 » Wed Nov 01, 2017 11:02 am

This is the first version of a general feedback sketch
The idea of such a sketch was to reduce the inner complexity of a sketch by swap out helper construction to another sketch or to combine multiple sketches for complex constructions.
it is more powerful than expressions.
It is possible to deactivate some components to speed up design or flip between different sketches on demand.

this is the first version and not all parameters are already used.

phpBB [video]

bp_598.png
bp_598.png (92.03 KiB) Viewed 592 times
Description
The Sketch_Rectangle contains a rectangle with constraints ax,ay for the position of the left lower corner and bx,by for the lenght an height of the rectangle.

The Skethc001_Circle contains a circle with constraint cr for the radoius of the circle.

The goal is to resize the rectangle depending on ax,ay with this conditions:

1) one corner is on the circle
2) the diagonal from this corner goes through the origin

The TwoClientsFeedback is a Sketch obekct, which does the calculation of bx,by and sends the values back to Sketch_Rectangle


it has 4 named constraints
ax,bx,cr are red constraints and get their values from the other skteches
bx,by are blue constraints and are used for feedback.


configuration of the TwoClientsFeedback


ClientA is Sketch_Rectangle
data from ClientA are ax,ay
date back to ClientA are bx,by

ClientB is Sketch_Circle
data from ClientB are cr
there are no date back to ClientB

Whenever ClientA or ClientB changes the Feedback Sketch is recomputed and the values are send back to ClientA.

To demonstrate this there are 3 Animation Managers.
When you double clickj a Manager and start it,
it changes one constraint (ax,ay, cr) by expressions

You can stop updating of a client <?> be setting its "active Client <?>" Flag to False.


Example file
https://www.dropbox.com/s/llyubzr3594rv ... fcstd?dl=0
required workbenches
nurbswb https://github.com/microelly2/freecad-n ... 66d83e7b5e
animation - not realy needed, you can delete the managers and change the parameters by hand.