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
Kunda1
Posts: 3675
Joined: Thu Jan 05, 2017 9:03 pm

Re: Civil engineering feature implementation (Transportation Engineering)

Postby Kunda1 » Sun Nov 04, 2018 7:47 am

Indeed. It's slowly coming together :D
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
Joel_graff
Posts: 837
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby Joel_graff » Thu Nov 22, 2018 1:12 am

Just an update...

I've implemented arbitrary sweeps along 3D BSplines. It works as well as it did along arcs / lines in Sketches.

However, there's an obvious issue with the Sweep tool and b-splines. It's definitely a show stopper if the problem is as bad at scale. This is an extremely exaggerated example.

Not only do the sweeps show irregularities, but sometimes they either refuse to render or "flip" (render on the wrong side of the edge). Not sure which as I didn't have wireframe enabled.

Quick notes on what's happening in the video:

I select a sketch and select an edge and the sweep is automatically performed. I can set the start / end station (the beginning and end of the sweep) as a measurement along the sweep path. The resolution refers to the discretization of the spline - the distance between points. Thus, a value of 1 means points for the spline edge are generated every 1 mm.

I'm also developing this to support sweeps-on-sweeps, as demonstrated by the curb attached to the edge of pavement. I've continued with three or four more sketches, but they grow increasingly distorted and difficult to control.

Anyway, clearly some issues to solve with the Sweep tool. :/
phpBB [video]
User avatar
microelly2
Posts: 4163
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby microelly2 » Thu Nov 22, 2018 12:28 pm

I think the better way is not to use sweep but to calculate the poles of the border curves by yourself. can you share your testdata to compare the results
Joel_graff
Posts: 837
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby Joel_graff » Thu Nov 22, 2018 1:58 pm

microelly2 wrote:
Thu Nov 22, 2018 12:28 pm
I think the better way is not to use sweep but to calculate the poles of the border curves by yourself. can you share your testdata to compare the results
I don't really have test data - I just randomly built a spline and swept along it. What I actually do is discretize the target edge based on the resolution (with a minimum of three points), and build a BSpline on the points that are returned from edge.discretize().

Unfortunately, I didn't sync the test fcstd with my github, and I won't get back to work until Monday. :(

However, I have synced the code changes I've been working on, so that's available in the repo. See transportationwb/corridor/Cell.py for details...

In any case, I'm not opposed to adopting another approach, but I thought it was worth mentioning that Sweep doesn't play well with BSplines. At least, not highly-discretized ones...
Joel_graff
Posts: 837
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby Joel_graff » Thu Nov 22, 2018 2:07 pm

I should also mention that I've started building the code for alignment designs... I've collected the horizontal and vertical curve data from a production 10-mile-long highway alignment with urban and rural areas as well as multiple intersecting sidestreets. I need to get the lidar terrain data for it, too, but that's getting a bit ahead of myself atm... :)

Anyway, we don't have nearly as interesting topography here in Illinois as @microelly2 has in Germany, but it'll do for now. ;). Besides, now I have actual highway design data which describes the alignment to build from.

Currently, I'm developing a way to describe the curves (horizontal and vertical) in JSON files. That way, a new curve can be added or old one removed purely by entering numbers. It's actually going quite well - I've just about finished the object code for the vertical curve portion that will auto-generate BSplines from the curve data. Horizontal curves should prove simple enough to do as well.

With that in place, then they have to get merged while preserving curve accuracy. BSplines seem to be pretty accurate with enough points along the curves / tangents. I need to keep the error under 0.3 mm (probably an order of magnitude less than that to be safe), and initial tests suggest as long as enough points are specified, it should be easily accomplished.

Ultimately, I still want to use the Sketcher as basis for the curve design tool, and right now, I've got @abdullah running in circles trying to figure out why it won't let me constrain elements at a scale of thousands of feet.

If nothing else, it seems like being able to build alignments purely from the data seems within reach...
triplus
Posts: 7955
Joined: Mon Dec 12, 2011 4:45 pm

Re: Civil engineering feature implementation (Transportation Engineering)

Postby triplus » Thu Nov 22, 2018 11:40 pm

Joel_graff wrote:
Thu Nov 22, 2018 2:07 pm
If nothing else, it seems like being able to build alignments purely from the data seems within reach...
Good to hear that.
Joel_graff
Posts: 837
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby Joel_graff » Fri Nov 30, 2018 4:54 pm

microelly2 wrote:
Thu Nov 22, 2018 12:28 pm
I think the better way is not to use sweep but to calculate the poles of the border curves by yourself. can you share your testdata to compare the results
I realize I meant to post this Monday, but things got busy...

Here's a link to the file I used in my video, if you're still interested...

https://drive.google.com/open?id=1yLCsY ... moL1cwl8Ks

On another note, I've got vertical curve data importing quite nicely, now - it creates a separate FPO for each vertical curve. Horizontal curves are next. Once that data's loaded, it's an easy thing to generate splines for each curve. Not sure how well they will mesh together, but that's probably another week or two out yet...
User avatar
microelly2
Posts: 4163
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby microelly2 » Fri Nov 30, 2018 5:54 pm

Joel_graff wrote:
Fri Nov 30, 2018 4:54 pm
https://drive.google.com/open?id=1yLCsY ... moL1cwl8Ks

On another note, I've got vertical curve data importing quite nicely, now - it creates a separate FPO for each vertical curve. Horizontal curves are next. Once that data's loaded, it's an easy thing to generate splines for each curve. Not sure how well they will mesh together, but that's probably another week or two out yet...
Here the idea to get a simple and smooth street volume

Code: Select all

import Draft
import Part

s=App.ActiveDocument.BSpline.Shape
c=s.Curve
[a,b]=s.ParameterRange
bm=int(round(b))+1


ff=App.ActiveDocument.Template.Shape
comps=[]
pts=[]

h=FreeCAD.Vector(0,0,1)
for i in range(bm):
	v=c.value(i)
	t=c.tangent(i)
	n=t[0].cross(FreeCAD.Vector(0,0,1)).normalize()
	pts += [v,v+t[0]*2,v,v+n*2,v]
	ff2=ff.copy()
	pm=ff2.Placement
	v0=pm.Base
	pm2=FreeCAD.Placement()
	pm2.Base=v
	ptsa=[v,v+2*n,v+2*n+h,v+h,v]
	ff2=Part.makePolygon(ptsa)

	comps += [ff2]

Draft.makeWire(pts)
Part.show(Part.Compound(comps))
la=Part.makeLoft(comps)
Part.show(la)

sweep is not a show stopper,we can calculate the loft/sweep by ourselve.
i did the same idea here and the sources are still somewhere.
https://youtu.be/ZwJ26sdSN_E
bp_916.png
bp_916.png (129.02 KiB) Viewed 288 times
Joel_graff
Posts: 837
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby Joel_graff » Fri Nov 30, 2018 6:00 pm

microelly2 wrote:
Fri Nov 30, 2018 5:54 pm
Here the idea to get a simple and smooth street volume
Gorgeous. :)

I'll definitely take a closer look once I get done with the data import / processing code.

Anyway, it'll be nice to have a real alignment with several sidestreets to develop with. Eventually, we should be able to use it to finish developing the sketcher-based workflow...
User avatar
microelly2
Posts: 4163
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby microelly2 » Fri Nov 30, 2018 7:52 pm

Joel_graff wrote:
Fri Nov 30, 2018 6:00 pm
Anyway, it'll be nice to have a real alignment with several sidestreets to develop with. Eventually, we should be able to use it to finish developing the sketcher-based workflow...
Well, we will go forward, I'm working at the moment on fine tuning the methods for the shoe project. But I still have always a look on this project here and will contribute whenever possible.