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
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Post by Joel_graff »

I appear to have a preliminary attempt complete and integrated into pivy_trackers. If you don't like using pivy_trackers, we can work on an alternate implementation for your efforts.

Using pivy_trackers requires writing a custom tracker that manages the data and the geometry you're most concerned about.

A basic tracker is fairly simple to implement.

Code: Select all

import FreeCADGui as Gui

from pivy_trackers.tracker.line_tracker import LineTracker
from pivy_trackers.tracker.context_tracker import ContextTracker

class GeoRefTracker(ContextTracker):
    """
    Test georeferencing
    """

    def __init__(self, coords):
        """
        Constructor
        """

        super().__init__('geo_ref_tracker', Gui.ActiveDocument.ActiveView)

        self.system = ['UTM', 'Z35', 'FLAT']
        self.position = (4275011518.128912, 507510589.4751387, 0.0)
        
        self.view_state.set_geo_reference(self.system, self.position)
        
        self.line_tracker = LineTracker('GEO_LINE_TRACKER', coords, parent, is_geo=True)
        self.line_tracker.set_geo_reference(self.system, self.position)

        self.base.set_visibility()
        self.insert_into_scenegraph(verbose=True)

How you handle the geo-referenced system, position, and coordinates is really up to you, of course.

No doubt there's other things to improve / do to make this better.
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
HakanSeven12
Veteran
Posts: 1481
Joined: Wed Feb 06, 2019 10:30 pm

Re: Civil engineering feature implementation (Transportation Engineering)

Post by HakanSeven12 »

If I understand pivy_trackers correctly, it is for dynamic interaction with coin nodes. Like editing an alignment. Right? Most of my workflow is static. So I'm interested with how you create your alignments by using SoGeo. Then I can implement it to my surfaces and points by fallowing same way.

Thanks for your efforts.
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Post by Joel_graff »

It really doesn't matter how you use them - things like highlighting and dragging can be disabled. And this is how I use pivy_trackers for horizontal alignments.
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
HakanSeven12
Veteran
Posts: 1481
Joined: Wed Feb 06, 2019 10:30 pm

Re: Civil engineering feature implementation (Transportation Engineering)

Post by HakanSeven12 »

I see. I will look at it when I have time and I will keep you informed.

Are you not using draft wires for alignments?
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Post by Joel_graff »

I do for displaying them, but not for editing them.
You won't be able to use Draft Wires for geospatial datasets because they don't support that. You'll have to create FeaturePython objects that maintain SoGeo* node graphs - which I know we discussed already...

The FeaturePython object would simply instance a geospatial pivy_tracker object to handle the rendering.
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
HakanSeven12
Veteran
Posts: 1481
Joined: Wed Feb 06, 2019 10:30 pm

Re: Civil engineering feature implementation (Transportation Engineering)

Post by HakanSeven12 »

I know but I little confused. Because SoGeo reduce your geometry near to origin and define a new coordinate for origin point. But you are using it only for editing and not for creating. I think that course a problem because your editing geometry and real object will be totally different area of scene graph. Am I wrong?

Also that means my object will be created near to origin but your alignment not. Anyway we will see when I created my FPOs. Maybe I am thinking wrong way.
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Post by Joel_graff »

HakanSeven12 wrote: Tue May 26, 2020 9:52 am Also that means my object will be created near to origin but your alignment not. Anyway we will see when I created my FPOs. Maybe I am thinking wrong way.
I anticipate having to adjust horizontal alignments to support SoGeo nodes, really. I suspect in the end it will just have to be that way...
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
HakanSeven12
Veteran
Posts: 1481
Joined: Wed Feb 06, 2019 10:30 pm

Re: Civil engineering feature implementation (Transportation Engineering)

Post by HakanSeven12 »

Hi. Did you ever tried lxml? It looks like very simple. Maybe it would be useful.

https://stackoverflow.com/questions/302 ... ml-landxml

https://python101.pythonlibrary.org/chapter31_lxml.html
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Post by Joel_graff »

I use an xml parser to parse LandXML files and encode the data. The issue is knowing what to do with the data after parsing - or perparing it to be encoded. :)

My parser only handles the horizontal alignment side of LandXML data.
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
HakanSeven12
Veteran
Posts: 1481
Joined: Wed Feb 06, 2019 10:30 pm

Re: Civil engineering feature implementation (Transportation Engineering)

Post by HakanSeven12 »

Okay :) I just want to say there is another option.
Post Reply