New automatic tool to convert STL back to parametric sketches
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: New automatic tool to convert STL back to parametric sketches
I should mention, that this was only a test, because I had the model at hand. It exists already in FreeCAD. So you can use it, of course, to improve your algorithm, but you don't have to convert it for me.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: New automatic tool to convert STL back to parametric sketches
Now it's updated with the new version that seems to work with the big model.
Instead of converting all sketches it can find, instead, you now have to select the plane to sketch.
You'll click on the "Select plane to sketch" button and then on the plane in the 3D view and it'll sketch the plane (visible in the "Sketches" tab).
From there you can export SVG and FreeCAD sketches.
I'm still not completely satisfied with the FreeCAD exporter, since for some sketches, FreeCAD does not succeed solving the constraints the tool has generated (you need to delete some constraint and replace by other until FreeCAD finally accept them). At least, it's finding by itself all the diameters, angles, length, direction and so on (so the most tedious tasks, IMHO).
Available here for testing
Instead of converting all sketches it can find, instead, you now have to select the plane to sketch.
You'll click on the "Select plane to sketch" button and then on the plane in the 3D view and it'll sketch the plane (visible in the "Sketches" tab).
From there you can export SVG and FreeCAD sketches.
I'm still not completely satisfied with the FreeCAD exporter, since for some sketches, FreeCAD does not succeed solving the constraints the tool has generated (you need to delete some constraint and replace by other until FreeCAD finally accept them). At least, it's finding by itself all the diameters, angles, length, direction and so on (so the most tedious tasks, IMHO).
Available here for testing
- adrianinsaval
- Veteran
- Posts: 5553
- Joined: Thu Apr 05, 2018 5:15 pm
Re: New automatic tool to convert STL back to parametric sketches
What constrains are giving you trouble? and what error message do you get?
Re: New automatic tool to convert STL back to parametric sketches
I don't know what are the constraint that fail. The error message is "Solver failed".
There isn't any over contraint, or missing constraint.
In fact, I'm building everything from few constraints: length, angle, same position, and diameter + angles.
Theorically, this should work to completely define a sketch, but FreeCAD solver is mystified by those (I guess the OCC solver does not succeed finding a numerical solution that's matching my own solution).
See the example file, double click on the sketch to edit it. You'll see all constraints and they all are fine, but the solver does not converge. You can remove one or two and it'll then say the sketch is under constrained but if you try to add them back, it's failing again to converge.
To actually have FreeCAD accept it, I need to convert some constraint to "easier" constraint, like "horizontal line" or "vertical line" or "symmetry" and remove the angle constraint between segments for example. Yet, as soon as you have multiple circle/arc, it's hard to get it right.
There isn't any over contraint, or missing constraint.
In fact, I'm building everything from few constraints: length, angle, same position, and diameter + angles.
Theorically, this should work to completely define a sketch, but FreeCAD solver is mystified by those (I guess the OCC solver does not succeed finding a numerical solution that's matching my own solution).
See the example file, double click on the sketch to edit it. You'll see all constraints and they all are fine, but the solver does not converge. You can remove one or two and it'll then say the sketch is under constrained but if you try to add them back, it's failing again to converge.
To actually have FreeCAD accept it, I need to convert some constraint to "easier" constraint, like "horizontal line" or "vertical line" or "symmetry" and remove the angle constraint between segments for example. Yet, as soon as you have multiple circle/arc, it's hard to get it right.
- Attachments
-
- sketch_1.FCStd
- (3.44 KiB) Downloaded 27 times