Very Weird Sketcher Behavior

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
cflin
Posts: 56
Joined: Sun May 14, 2017 10:21 pm

Very Weird Sketcher Behavior

Post by cflin »

In the recent versions of FC17 I've been observing some very weird behavior with sketcher. I think that sketcher erroneously declares the design overconstrained when the last of three points with 2 degrees of freedom is constrained and also has problems with graphics. Full details below. If this turns out to be (a) bug(s), I am not sure how to convert this posting to a bug posting. I did check the forums to make sure I am not repeating here things that have already been posted, but did not find anything similar.

I took the STEP file of a bolt (hopefully attached to this posting). I initiated a sketch attached on the flat annular region of the head. Then, I picked two non-consecutive edges of the inscribed regular hexagon for "attach to external geometry." At that point, the sketch was still empty, but with the two edges attached for external geometry. I then created three random points on the sketch, with the intend to attach a coincidence constraint to an endpoint of one of the external edges to each of them. (That would define the circle circumscribed to the regular hexagon; I could then use that circle for other things.) So far, so good: Two non-consecutive external edges selected, three points on the sketch, 6 degrees of freedom (DOF)—I guess two DOF per point.

I constrained the first point to coincide to an end point of one of the external edges; the number of DOF dropped from 6 to 4 (as it should). I similarly constrained the second sketcher point (to a different endpoint); the # of DOF dropped to 2, as it should. When I tried to finally constrain the third point, FC told me that the sketch would get over-constrained and did not do anything! There just got to be a bug in the code somewhere!

Just for kicks, I took a different path: Instead of binding the sketch to the flat annulus of the head, I just bound to it to the XY plane. To see the head of the bolt, I had to view the sketch from the bottom; fine. When I selected an edge for external-geometry binding, the pixels of the head of the bolt started flickering, and the flickering pf those pixels continued, albeit with less severity, after I got out of sketcher and even after I shut down that sheet! I had totally kill FC for the flickering to stop! I did not use any strace of gdb to analyze the problem, but from the looks of it, I think sketcher has some very serious issues, which may also include memory leaks.

Here are the details of my FreeCAD installation as of this typing (but this has been occurring in the past few versions of FC17 as well):

OS: Ubuntu 16.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.11122 (Git)
Build type: None
Branch: master
Hash: a0da4b16a8768779ce32480046d3c0109595d5e5
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
Attachments
bolt.step
(40.91 KiB) Downloaded 51 times
chrisb
Veteran
Posts: 54213
Joined: Tue Mar 17, 2015 9:14 am

Re: Very Weird Sketcher Behavior

Post by chrisb »

cflin wrote:I am not sure how to convert this posting to a bug posting. I did check the forums to make sure I am not repeating here things that have already been posted, but did not find anything similar.
What you did is perfect. Bugs should be discussed here before creating a bug report, as you can see here: https://forum.freecadweb.org/viewtopic.php?f=3&t=5236.

You attached only the step file, not the FreeCAD file. Could you please attach the *.FCStd file, preferably in the state with the two DOFs, i.e. just before the problem occurs.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
cflin
Posts: 56
Joined: Sun May 14, 2017 10:21 pm

Re: Very Weird Sketcher Behavior

Post by cflin »

Sure. (Dumb of me not to post the fcstd file!) Here it is. I just verified that when I try to constrain the third point (make it coincident with one of the endpoints of the remaining edge), I get an over constrained sketch. This time the bolt's view did not disappear from the sketch.
Attachments
bolt.fcstd
(14.81 KiB) Downloaded 32 times
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Very Weird Sketcher Behavior

Post by Kunda1 »

Very Weird Sketchy Sketcher Behavior
FTFY 8-)
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
cflin
Posts: 56
Joined: Sun May 14, 2017 10:21 pm

Re: Very Weird Sketcher Behavior

Post by cflin »

LOL, not far from the truth!

On a more serious note, I opened the fcstd file I submitted to this thread (after having shut it down). When I got into the sketch, it was difficult to find it so I can center it to the display and when I finally did, only the external-geometry edges were visible. After some zooming in and out, the hexagonal pattern was not visible, but the circular edges were.

Very sketchy behavior indeed!
chrisb
Veteran
Posts: 54213
Joined: Tue Mar 17, 2015 9:14 am

Re: Very Weird Sketcher Behavior

Post by chrisb »

Somehow you have created two cumbersome bsplines and with the last coincidence you probably tried to do something to a control point of a bspline. Delete the splines in the Elements list to the left, and it should work as expected.

If you want a circle through the three external points you can do it directly: Create a circle and add three point-on-line constraints.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
cflin
Posts: 56
Joined: Sun May 14, 2017 10:21 pm

Re: Very Weird Sketcher Behavior

Post by cflin »

I, too, wondered about the bsplines. The bsplines were generated when I picked two sides of the regular hexagon for external-geometry reference. If I delete them, I delete the external geometry references. How else can I constrain the points each to a vertex of the external regular hexagon? And why did referencing two sides of the regular hexagon for external geometry generate bsplines? Could it be because the original file was in STEP format?

Thank you for responding, BTW.
cflin
Posts: 56
Joined: Sun May 14, 2017 10:21 pm

Re: Very Weird Sketcher Behavior

Post by cflin »

I guess I answered my own question. I was able to pick individual vertices of the regular hexagon for external geometry reference. I was under the mistaken impression that only edges can be picked for external reference. I deleted the bsplines (this made the sketch unconstrained with 6 DOF, as expected), picked three external vertices for references, constrained each point to one of those vertices, and now I have a fully constrained sketch.

I am still baffled by why sketcher generated bsplines and why constraining the first two points worked without a problem, reducing the DOF by 2 each time and the process failed with the third point.

Again, thank you for your advice.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Very Weird Sketcher Behavior

Post by abdullah »

cflin wrote:I am still baffled by why sketcher generated bsplines and why constraining the first two points worked without a problem, reducing the DOF by 2 each time and the process failed with the third point.
If you can reproduce the sketcher generating bsplines on its own volition, that is indeed a bug to report :D
chrisb
Veteran
Posts: 54213
Joined: Tue Mar 17, 2015 9:14 am

Re: Very Weird Sketcher Behavior

Post by chrisb »

I attach my file here, it creates a circle directly from the three exeternal points. I don't know how the bspline where created, possibly a click at the wrong position? but I guess that you cannot set the control points at arbitrary positions, I will play a bit with the bsplines and report back if I can find something.
Attachments
bolt_cb.fcstd
(15.26 KiB) Downloaded 42 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply