Create Slot Tool: Unpredictable Behavior?

About the development of the Part Design module/workbench. PLEASE DO NOT POST HELP REQUESTS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Create Slot Tool: Unpredictable Behavior?

Post by bejant »

Part 1:

Part Design WB -> Flile -> New -> Create Sketch,
Choose X-Y Plane
Select the Create Slot tool

Usually this results in Solver message = "Sketch contains redundant constraints. Please delete the following redundant constraint: 8."
(Constraint 8 is a Tangent Constraint)

Depending on where I start / end the slot I may get Conflicting Constraint(s):
8;
9;
8 and 9 concurrently.

==================
Part 2:

Sometimes when selecting the first point to create a slot, then not releasing the LMB and dragging to create the second point, creating the slot aborts. Editing aborts, nothing is in the 3D window, but the empty sketch exists.

==================
Part 3:

Is the intent to allow the user the ability to Pad a Slot into a solid?
If so, would "Slot" more appropriately be named "Oval"?

=================
OS: Ubuntu 12.04.4 LTS
Platform: 32-bit
Version: 0.14.3646 (Git)
Branch: master
Hash: 6a212b32f61eee1c792fa21f6fdf2d0ccda96503
Python version: 2.7.3
Qt version: 4.8.1
Coin version: 3.1.3
SoQt version: 1.5.0
OCC version: 6.7.0
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Create Slot Tool: Unpredictable Behavior?

Post by wmayer »

Usually this results in Solver message = "Sketch contains redundant constraints. Please delete the following redundant constraint: 8."
I have seen this, too. Often if you just delete the required constraints, move the slot a little bit and re-add the deleted constraints the solver doesn't complain any more.
Sometimes when selecting the first point to create a slot, then not releasing the LMB and dragging to create the second point, creating the slot aborts. Editing aborts, nothing is in the 3D window, but the empty sketch exists.
Not sure if it's the same but when just clicking (press and release) in the 3d view, moving the mouse and clicking somewhere else an error message appears in the 3d view:
Unhandled exception in ViewProvider::eventCallback: ('unexpected EOF while parsing', ('<string>', 1, 150, 'App.ActiveDocument.Sketch.addGeometry(Part.ArcOfCircle(Part.Circle(App.Vector(-33.444721,10.000000,0),App.Vector(0,0,1),1.#QNAN0),0.000000,3.141593))\n'))
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: Create Slot Tool: Unpredictable Behavior?

Post by bejant »

wmayer wrote:I have seen this, too. Often if you just delete the required constraints, move the slot a little bit and re-add the deleted constraints the solver doesn't complain any more.
I guess I didn't explain very well - I didn't have any difficulty doing as Solver instructed. The issue is that the Create Slot Tool itself creates redundant constraints when the Slot is the only item in the Sketch...

===================
wmayer wrote:error message appears in the 3d view
I got a different error message:
"Unhandled exception in ViewProvider::eventCallback: name 'nan' is not defined"
The Create Sketch Tool is still active as indicated by the cursor but the plane grid and axes are no longer visible; just a blank background. After trying some more, the Sketch is still in edit mode but none of the Sketcher Geometries tools will work (not just the Create Oval Tool). Even after closing the empty Sketch and then re-opening it to edit again the plane grid and axes aren't shown and the Sketcher Geometries tools can't be used, so that empty Sketch is useless and must be deleted.

===================

Regarding the term "Slot", it implies a subtractive or negative space but a Slot Sketch could also be made into a solid by using Pad so it's kind of counter-intuitive. After thinking about it a little more, the term "Oval" is ambiguous (an oval could be racetrack shaped or egg shaped), it seems the correct term is "obround"...
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Create Slot Tool: Unpredictable Behavior?

Post by wmayer »

I guess I didn't explain very well - I didn't have any difficulty doing as Solver instructed. The issue is that the Create Slot Tool itself creates redundant constraints when the Slot is the only item in the Sketch...
No, no, I understood what you said. For most slots I get the solver warning of one or two redundant constraints. When I remove these constraints, move the slot a little bit around and then re-insert the constraints the solver silently accepts it. IMO here the solver fails because from a mathematical point of view I can't detect any redundancy -- the tangency constraints are all needed.

In the past logari81 (the author of the solver) mentioned that e.g. edge tangency constraints are bad constraints. But in this case at this stage I don't see a better alternative. So, I did some experiments and changed the source code to first set the tangency constraints and afterwards the coincidences. This seems to have solved the issue.
I got a different error message:
"Unhandled exception in ViewProvider::eventCallback: name 'nan' is not defined"
The Create Sketch Tool is still active as indicated by the cursor but the plane grid and axes are no longer visible; just a blank background. After trying some more, the Sketch is still in edit mode but none of the Sketcher Geometries tools will work (not just the Create Oval Tool). Even after closing the empty Sketch and then re-opening it to edit again the plane grid and axes aren't shown and the Sketcher Geometries tools can't be used, so that empty Sketch is useless and must be deleted.
Somewhere in the draw handler of the slot an invalid floating number is generated. In your case it's "nan" (not-a-number) and in my case it's "#QNAN0". In both cases the generated and executed Python code fails. In your case 'nan' is unknown and in my case the '#' makes the rest of the code to be handled as a comment hence the "unexpected EOF while parsing". But the reason is the same in both cases.

I solved this by putting the relevant code into a try/catch block to handle the raised exception and abort the pending command. You still get the error message (which is good I think because then the user gets a hint that something went wrong) but it does not mess up the view frustum any more. The view camera still jumps to an odd place but after leaving the slot command you can do a "view all" and everything is normal again.
Regarding the term "Slot", it implies a subtractive or negative space but a Slot Sketch could also be made into a solid by using Pad so it's kind of counter-intuitive. After thinking about it a little more, the term "Oval" is ambiguous (an oval could be racetrack shaped or egg shaped), it seems the correct term is "obround"...
From a German <=> English dictionary the term slot is also suggested.
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Create Slot Tool: Unpredictable Behavior?

Post by jmaustpc »

wmayer wrote: Regarding the term "Slot", it implies a subtractive or negative space but a Slot Sketch could also be made into a solid by using Pad so it's kind of counter-intuitive. After thinking about it a little more, the term "Oval" is ambiguous (an oval could be racetrack shaped or egg shaped), it seems the correct term is "obround"...


From a German <=> English dictionary the term slot is also suggested.
In English a 'slot" is a void/hole/valley, (an absence of material) its a good name for the tool if you are going to pocket the sketch, but, as bejant says, it is not appropriate if you are going to use the "slot" profile for a "Pad". In that case it would be a knob, protrusion, lump etc. :)

If it just produces a profile which can be used for anything then perhaps changing its name to a description of that profile would be more logical. Naming with the profile description like the other tools, would also be more consistent, e.g. Arc, Circle, rectangle.
User avatar
shoogen
Veteran
Posts: 2823
Joined: Thu Dec 01, 2011 5:24 pm

Re: Create Slot Tool: Unpredictable Behavior?

Post by shoogen »

I'm not a native English speaker. I don't like the word slot, since is does not describe if there is a radius, and if, where it is located.
You could manufacture a slot with a circular saw or with and endmill. They will both have radii, but the word slot does not tell you where.
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: Create Slot Tool: Unpredictable Behavior?

Post by bejant »

wmayer, thanks for the explanation (so I could understand it this time) and the fix :)
Post Reply