Looking for help with curve fitting algorithm.

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
keithsloan52
Veteran
Posts: 2756
Joined: Mon Feb 27, 2012 5:31 pm

Looking for help with curve fitting algorithm.

Post by keithsloan52 »

The toSketch workbench https://github.com/KeithSloan/toSketch has an experimental Curve fitting facility. Have not worked on it for some time and will have to spend sometime re-acquainting myself with the code.

Wondering if anyboy else would be interested in improving the code.

The code is in classCurveFitFeature in toSCommands.py and it uses a python library geomdl

Attached is a test file
Throttle-Lock-Test.FCStd
(227.01 KiB) Downloaded 12 times
  • Throttle_lock - is an import STL Mesh
  • Throttle_lock_cs is a cross section of the Mesh using the Mesh Workbench
  • Sketch is a Sketch produced by the toSketch icon/function of the workbench
  • Fitted_Sketch is the result of trying to curve fit the sketch i.e. Select Sketch and click on ToCurveFit
Obviously my algorithm is not right, anybody interested in wading in? Maybe @jxnd would like to comment?
keithsloan52
Veteran
Posts: 2756
Joined: Mon Feb 27, 2012 5:31 pm

Re: Looking for help with curve fitting algorithm.

Post by keithsloan52 »

I think what is needed is on scanning the whole sketch is an algorithm to work out if the Sketches LineSegments form a straight line and which need to have a curve fit, obviously the current attempt does not get the cigar.
Post Reply