Civil engineering feature implementation (Transportation Engineering)
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Be nice to others! Read the FreeCAD code of conduct!
- Joel_graff
- Veteran
- Posts: 1949
- Joined: Fri Apr 28, 2017 4:23 pm
- Contact:
Re: Civil engineering feature implementation
Yeah, I sort of figured it out a week ago, I think, but it's basically what Abdullah was getting at.
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
pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
- Joel_graff
- Veteran
- Posts: 1949
- Joined: Fri Apr 28, 2017 4:23 pm
- Contact:
Re: Civil engineering feature implementation
Ok, So I've begun building a script to generate alignments. It's certainly fine to generate the horizontal and vertical separately, then project them to generate the 3D.
I'm reasonably sure Sketcher is the most expedient way to set up either alignment, but there are problems with using it to create alignments.
The alignment macro I'm writing really only needs three key elements: lines, arcs and tangential constraint. More complex geometries I intend on building (2-center, 3-center, and spiral curves) are simply a specific combination of tangentially-constrained lines and arcs.
The following PDF link provides a simple point of reference as to what the basic geometric requirements for alignments:
http://www.globalsecurity.org/military/ ... 33/ch3.pdf
So my plan is really pretty simple. The user simply selects one of five possible geometry types (tangent, simple curve, 2-center, 3-center, spiral) and can either append it to the end of the alignment, or insert it at a selected point. The macro then adds the desired geometry and tangentially constrains it to the surrounding geometry. From there, the user adjusts the curve / tangent either by click / drag or by manually entering data into a dialog.
The problem is, when applying a tangent constraint to two points, the result causes both objects to move. I want to ensure that the preceding geometry does not move. There is a constraint which does that, but it puts dimensions on the screen which are entirely irrelevant for my purposes.
Any way to achieve a fixed constraint without having to use that? It may be that I'm just not well-schooled enough in Sketcher's constraint system - apologies if this is an obvious question...
I'm reasonably sure Sketcher is the most expedient way to set up either alignment, but there are problems with using it to create alignments.
The alignment macro I'm writing really only needs three key elements: lines, arcs and tangential constraint. More complex geometries I intend on building (2-center, 3-center, and spiral curves) are simply a specific combination of tangentially-constrained lines and arcs.
The following PDF link provides a simple point of reference as to what the basic geometric requirements for alignments:
http://www.globalsecurity.org/military/ ... 33/ch3.pdf
So my plan is really pretty simple. The user simply selects one of five possible geometry types (tangent, simple curve, 2-center, 3-center, spiral) and can either append it to the end of the alignment, or insert it at a selected point. The macro then adds the desired geometry and tangentially constrains it to the surrounding geometry. From there, the user adjusts the curve / tangent either by click / drag or by manually entering data into a dialog.
The problem is, when applying a tangent constraint to two points, the result causes both objects to move. I want to ensure that the preceding geometry does not move. There is a constraint which does that, but it puts dimensions on the screen which are entirely irrelevant for my purposes.
Any way to achieve a fixed constraint without having to use that? It may be that I'm just not well-schooled enough in Sketcher's constraint system - apologies if this is an obvious question...
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
pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
- microelly2
- Veteran
- Posts: 4688
- Joined: Tue Nov 12, 2013 4:06 pm
- Contact:
Re: Civil engineering feature implementation
Joel_graff wrote: ↑Sun Jun 04, 2017 12:27 pm
So my plan is really pretty simple. The user simply selects one of five possible geometry types (tangent, simple curve, 2-center, 3-center, spiral) and can either append it to the end of the alignment, or insert it at a selected point. The macro then adds the desired geometry and tangentially constrains it to the surrounding geometry. From there, the user adjusts the curve / tangent either by click / drag or by manually entering data into a dialog.
The problem is, when applying a tangent constraint to two points, the result causes both objects to move. I want to ensure that the preceding geometry does not move. There is a constraint which does that, but it puts dimensions on the screen which are entirely irrelevant for my purposes.
There is no other way to fix the position of a point. You have to pin it (Sketcher Lock)
https://www.freecadweb.org/wiki/Constraint_Lock
The problem is that the sketch will be filled with constraints.
There was a discussion to hide some of the constraints but at the moment there is no method to do this.
the only idea for a workaround is to have an other sketch in the background and connect your working sketch with external geometry constraint to it.
The macro can add the lock constraints to the background sketch. So the foreground sketch will stay slim.
- Joel_graff
- Veteran
- Posts: 1949
- Joined: Fri Apr 28, 2017 4:23 pm
- Contact:
Re: Civil engineering feature implementation
I played with it and noticed that you can't edit the foreground sketch so long as it's tied to the external geometry... That's a shame - I had hoped to benefit from that external tie while editing the geometry, so that adding new geometry and constraints wouldn't shift the existing geometry
I'm starting to think the transportation functionality might require a modified sketcher workbench to work smoothly, but I hope we can demonstrate the basic functionality in vanilla FreeCAD without having to build a lot of workaround code...
I'm starting to think the transportation functionality might require a modified sketcher workbench to work smoothly, but I hope we can demonstrate the basic functionality in vanilla FreeCAD without having to build a lot of workaround code...
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
pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
- microelly2
- Veteran
- Posts: 4688
- Joined: Tue Nov 12, 2013 4:06 pm
- Contact:
Re: Civil engineering feature implementation
You can switch between the sketches
If you want to change some values in the backbone you change the constraints or work without hard constraints
The foreground sketch never can change values in the background, so once a foreground point is bound to the background you
have two opportunities
change the background sketch
or delete the external geometry constraint.
https://youtu.be/iajoWEJE7iM
If you want to change some values in the backbone you change the constraints or work without hard constraints
The foreground sketch never can change values in the background, so once a foreground point is bound to the background you
have two opportunities
change the background sketch
or delete the external geometry constraint.
https://youtu.be/iajoWEJE7iM
- Joel_graff
- Veteran
- Posts: 1949
- Joined: Fri Apr 28, 2017 4:23 pm
- Contact:
Re: Civil engineering feature implementation
Ok, so external geometry isn't quite what I need, here, though I think it might be handy in the future. So, I'm letting that be for the moment. It may not be so big an issue, anyway.
That said, I don't suppose there's a way to expose FeaturePython objects in Sketcher? From what I can tell, they have to live at the document level (sibling to a Sketch).
I have the idea to build classes for these specific curves, since they have a lot of accompanying geometry...
That said, I don't suppose there's a way to expose FeaturePython objects in Sketcher? From what I can tell, they have to live at the document level (sibling to a Sketch).
I have the idea to build classes for these specific curves, since they have a lot of accompanying geometry...
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
pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
Re: Civil engineering feature implementation
Joel_graff wrote: ↑Thu Jun 08, 2017 2:59 am Ok, so external geometry isn't quite what I need, here, though I think it might be handy in the future. So, I'm letting that be for the moment. It may not be so big an issue, anyway.
That said, I don't suppose there's a way to expose FeaturePython objects in Sketcher? From what I can tell, they have to live at the document level (sibling to a Sketch).
I have the idea to build classes for these specific curves, since they have a lot of accompanying geometry...
@wmayer care to weigh in?wmayer wrote:ping
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
- microelly2
- Veteran
- Posts: 4688
- Joined: Tue Nov 12, 2013 4:06 pm
- Contact:
Re: Civil engineering feature implementation
There is a way to add more intelligence to a Sketch, the SketchObjectPython.Joel_graff wrote: ↑Thu Jun 08, 2017 2:59 am That said, I don't suppose there's a way to expose FeaturePython objects in Sketcher? From what I can tell, they have to live at the document level (sibling to a Sketch).
I have the idea to build classes for these specific curves, since they have a lot of accompanying geometry...
https://forum.freecadweb.org/viewtopic. ... 10#p178192
I would build for any basic segment a special SketchObjectPython and connect them by special connector (SketchObjectPython too)
The task of the connectors is to hold the tangent conditions (direction) and placement condition
The segments read these data from the connectors and adjust the inner geometry depeding on the connectors and some internal parameters
The SketchObjectPython can then create a 3D curve using the elevation data from the underlying terrain ore some other database.
Re: Civil engineering feature implementation
Just checking in...any progress?Joel_graff wrote:ping
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
- Joel_graff
- Veteran
- Posts: 1949
- Joined: Fri Apr 28, 2017 4:23 pm
- Contact:
Re: Civil engineering feature implementation
I only saw the response a few days ago, so not much progress yet. I have to watch the video a couple more times I think.
Really, it's been a mental game just trying to figure out how to use Sketcher's constrained geometry to model horizontal and vertical alignments. The requirements for civil geometry are really pretty simple and Sketcher should have no problem managing it. I've got a fair idea of how to approach it, but coding Python's slow - you know.. documentation.
Plus, there's a weird bug it seems in sketcher's selection code...
Really, it's been a mental game just trying to figure out how to use Sketcher's constrained geometry to model horizontal and vertical alignments. The requirements for civil geometry are really pretty simple and Sketcher should have no problem managing it. I've got a fair idea of how to approach it, but coding Python's slow - you know.. documentation.
Plus, there's a weird bug it seems in sketcher's selection code...
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
pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers