New "validate sketch" tool

Info about new community or project announcements, implemented features, classes, modules or APIs. Might get technical!
PLEASE DO NOT POST HELP REQUESTS OR OTHER DISCUSSIONS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

New "validate sketch" tool

Post by NormandC »

This is a new tool Werner (wmayer) added today following a discussion in the German forum. (Werner, I am very sorry for displaying such a horrendous command of German, but I blame Google Translate. ;) )

It is mostly useful for imported 2D geometry (DXF, maybe SVG if no bezier curves are present?) which has been converted to a sketch. The current problem is that Draft's "Draft to Sketch" tool cannot add any constraints, not even coincident constraints on vertices. This can cause problems with Part Design features.

The "validate sketch tool" can add coincident constraints to points that share the same coordinates.

Use
  1. Select a sketch (do not go into edit mode)
  2. go to Part Design --> Validate sketch...
  3. Click on the "Fix" button
    Image
  4. Click OK
  5. Done!
I have no idea what "Find" does, I tried it and there was no output in the report view.

I am now wondering if this tool could be eventually expanded to calculate and add more constraints? Like horizontal and vertical constraints, maybe others. This could be very useful for importing 2D geometry in the long run...

Thanks Werner!

Werner asks himself: Oh noes! What have I done?!? (as goes the saying, no good deed goes unpunished! :mrgreen:)
wmayer
Founder
Posts: 20324
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: New "validate sketch" tool

Post by wmayer »

I have no idea what "Find" does, I tried it and there was no output in the report view.
I implemented this tool to add the missing coincident constraints to the sketch in the referenced forum thread. Since the sketch there has ~150 curve elements and doing even only a slight change requires almost a minute for a recompute. So, it was totally infeasible to do this manually. That's why I started to develop this tool to fix the sketch in one go.

However, the tool is far away from being finished and that's why the "Find" doesn't do anything and I wanted to announce this feature when it was more mature.
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: New "validate sketch" tool

Post by NormandC »

Sorry! :oops:
wmayer
Founder
Posts: 20324
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: New "validate sketch" tool

Post by wmayer »

No problem ;)
wmayer
Founder
Posts: 20324
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: New "validate sketch" tool

Post by wmayer »

The tool has improved now. The Find button checks for missing coincident constraints and report how many of them are missing and additionally highlights the vertexes graphically. The Fix button adds the missing constraints.
User avatar
quick61
Veteran
Posts: 3803
Joined: Sat Aug 24, 2013 2:49 am
Location: u.S.A.

Re: New "validate sketch" tool

Post by quick61 »

wmayer wrote:
I have no idea what "Find" does, I tried it and there was no output in the report view.
I implemented this tool to add the missing coincident constraints to the sketch in the referenced forum thread. Since the sketch there has ~150 curve elements and doing even only a slight change requires almost a minute for a recompute. So, it was totally infeasible to do this manually. That's why I started to develop this tool to fix the sketch in one go.

However, the tool is far away from being finished and that's why the "Find" doesn't do anything and I wanted to announce this feature when it was more mature.
After giving it a try, I can see why maybe wmayer wanted to wait a bit. Works on the more simpler polylines but seems to fail on more complex drawings. Attached are a few sketches pulled from an imported .dxf file. The two parts on top were run through the Validate sketch tool, the two on the bottom are raw / untouched. Only one of the polylines is resolved. (Sketch011)

The message when the "fix" fails is -

Code: Select all

Updating geometry: Error build geometry(6): Both points are equal
Invalid solution from DogLeg solver.
Updating geometry: Error build geometry(6): Both points are equal
Invalid solution from LevenbergMarquardt solver.
Updating geometry: Error build geometry(6): Both points are equal
Invalid solution from BFGS solver.
Solving the sketch failed
That being said, this should be a great tool and one that is surly needed. Please keep up the good work and maybe post back when there are improvements. Really looking forward to this one.

Mark
Attachments
Validate.fcstd
(46.59 KiB) Downloaded 203 times
This post made with 0.0% Micro$oft products - GOT LINUX?
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: New "validate sketch" tool

Post by NormandC »

Then maybe I could move this topic to the Developers's corner and create a new topic in Feature Announcements only when this tool is considered stable enough?

That way people won't throw themselves at this tool yet, or the ones reading about it in Developers corner will know to expect an experimental tool. ;)
wmayer
Founder
Posts: 20324
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: New "validate sketch" tool

Post by wmayer »

That's only a matter of using a good tolerance. In the first approach it was set to 0.1 which appeared to be too high. Now it's set to 0.001 and this works much better.OpenCascade's internal tolerance is 1.e-7 but this is too strict. So, the one I chose seems to be a good balance.

With this change I was able to fix all the sketches in the Validate project. But note, you have to go though all sketches in edit mode and remove all coincident constraints because some of them are wrong. Afterwards you can use the validate tool and all sketches seem fine.
User avatar
quick61
Veteran
Posts: 3803
Joined: Sat Aug 24, 2013 2:49 am
Location: u.S.A.

Re: New "validate sketch" tool

Post by quick61 »

wmayer wrote:That's only a matter of using a good tolerance. In the first approach it was set to 0.1 which appeared to be too high. Now it's set to 0.001 and this works much better.OpenCascade's internal tolerance is 1.e-7 but this is too strict. So, the one I chose seems to be a good balance.

With this change I was able to fix all the sketches in the Validate project. But note, you have to go though all sketches in edit mode and remove all coincident constraints because some of them are wrong. Afterwards you can use the validate tool and all sketches seem fine.
That's good news. Glad to hear it was a simple fix. I'll take it the new tolerance value will be in tomorrows build and will check it out then. Thank's again for making up this tool. Very handy.

Mark
This post made with 0.0% Micro$oft products - GOT LINUX?
logari81
Posts: 658
Joined: Mon Jun 14, 2010 6:00 pm

Re: New "validate sketch" tool

Post by logari81 »

wmayer wrote:That's only a matter of using a good tolerance. In the first approach it was set to 0.1 which appeared to be too high. Now it's set to 0.001 and this works much better.OpenCascade's internal tolerance is 1.e-7 but this is too strict. So, the one I chose seems to be a good balance.
actually the tolerance should be relative to the size of the sketch. e.g. a quotient of the bounding box or a quotient of the length of the lines that the connected points belong to.
Post Reply