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
HakanSeven12
Veteran
Posts: 1481
Joined: Wed Feb 06, 2019 10:30 pm

Re: Civil engineering feature implementation (Transportation Engineering)

Post by HakanSeven12 »

Joel_graff wrote: Wed Apr 17, 2019 11:50 am EDIT: Fixed in two places. Try it now. It should work fine with the __path__ attribute.
Yes it works :)
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Post by yorik »

VERY interesting improvements! I really like this stuff that appears when hovering on an object... We should use that more..
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 »

yorik wrote: Mon Apr 22, 2019 2:17 pm VERY interesting improvements! I really like this stuff that appears when hovering on an object... We should use that more.
It's really the result of needing arcs and splines in n architecture optimized for wires.

The issue is that I need better visual tessellation than I can get with arcs / splines, so I defaulted to discretized wires. Given that precision in highway design depends entirely on what you're doing (bridges and surveys need way more accuracy than, say, ditches), discretized wires give me that exact level of control. But they're useless when I want to, say, interactively adjust the radius of a curve. So I had to devise a way to overlay the geometry model (as it exists in the actual XML data) over the wire representation in FC.

I've got some fun ideas I'm playing with at the moment - your recent responses on my other posts helped a lot. :)
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 »

My test alignment.



error

Code: Select all

C:/Users/Hakan/Desktop/Manisa.xml

        Invalid curve definition: cannot determine radius / tangent lengths
        

        Invalid curve definition: cannot determine radius / tangent lengths
        

        Invalid curve definition: cannot determine radius / tangent lengths
        

        Invalid curve definition: cannot determine radius / tangent lengths
        
Errors encountered during alignment creation:

Bearing mismatch (0.2040, 6.2511) at curve {'Type': 'Line', 'Hash': None, 'Start': Vector (4275019402.22413, 507603457.4799376, 0.0), 'End': Vector (4275017561.111967, 507660837.8030049, 0.0), 'Center': None, 'PI': None, 'Description': '', 'BearingIn': 6.251110187446423, 'Length': 57409.852545577996, 'ID': '', 'StartStation': 0.0, 'Status': '', 'ObjectID': '', 'Note': '', 'BearingOut': 6.251110187446423, 'InternalStation': (-769657.0, -712247.147454422)}
I think it gives error at consecutive curves.
Last edited by HakanSeven12 on Wed Jan 06, 2021 7:03 pm, edited 1 time in total.
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: Fri Apr 26, 2019 6:29 am I think it gives error at consecutive curves.
You know, that very likely could be. I've never actually tested consecutive curves. Eventually, I'll write 2-center / 3-center curve object support, but I figured they could just be pieced together for the time being.

Hmmm. Definitely something to test over the weekend.

Edit: I did take a quick look. The issue isn't the consecutive curves. It's at the second line object in your XML. It appears the parser is comparing the 'dirStart' attribute of the preceding curve with the line's direction / bearing. It should be comparing the 'dirEnd' attribute.

I see no obvious problems with your XML, though... Odd.
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
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: Fri Apr 26, 2019 6:29 am I think it gives error at consecutive curves.
Ok, so I think I've sorted this out. There were three issues at play - documenting them here for posterity:

  • When curve data is imported, it's run through some matrix math. Basically, I can't assume any specific parameters have been provided, so I use a general algorithm to test to see if enough parameters have been provided to define the curve. If so, then it checks to ensure that all of the parameters are correct. So, if the curve coordinates are all defined, it passes check #1, but if the radius value doesn't match what is calculated from the coordinates, it fails check #2.

    The issue, here, is my tolerance for error in check #2 was 0.00001 mm (a millionth of a millimeter). In reality, that should be a millionth of a foot / meter. So, I reduced the tolerance to 0.0001 mm (one ten-thousandth of a millimeter) and everything passed the second check.
  • The 'bearing mismatch' error, it turns out, was because the algorithm was calculating bearings which were outside [0, 2*pi]. A quick bound check on that calculation fixed it.
  • If 'optional' elements / attributes were omitted in the original XML (like the start station of a curve), the algorithm would substitute in a default value, like '0.0'. Switched this to None to prevent an invalid attribute from being interpreted as a valid one (Station 'None' is invalid, station '0', however may be perfectly valid).
There's an issue I only just noticed, however: If you decrease the interval of the alignment to 1 meter, it gets wavy. (Under the data tab, 'Segment' section, set 'Method' to interval and 'Seg_Value' to 1). Set it to 10 m and it goes away. Obviously, that's not good. :/

Will have to explore that a bit further.

And... I think I need to start using the issue tracker. lol

Anyway, give it a try, it should import...
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
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 »

Also fixed the unit issue. If you import / open a document that's in different units, you will now get asked if you want to switch the system preferences to those units. If not, it will fail to import / load.

It's a start, anyway.
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 »

Its work but X-Y coordinates swapped :)
C3D.png
C3D.png (144.27 KiB) Viewed 966 times
FC.png
FC.png (103.22 KiB) Viewed 966 times
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: Fri Apr 26, 2019 7:54 pm Its work but X-Y coordinates swapped
Right.

Probably because you measure bearings counterclockwise from east? I assumed bearings measured clockwise from north.
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 »

Joel_graff wrote: Fri Apr 26, 2019 7:56 pm Right.

Probably because you measure bearings counterclockwise from east? I assumed bearings measured clockwise from north.
I dont think its about bearing. Its totally have diffrerent coordinates from my road.I added my road surface too. Its far far away from my model.
Post Reply