Sketcher sidebar becomes (somewhat) unresponsive

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!
User avatar
chennes
Veteran
Posts: 3909
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Sketcher sidebar becomes (somewhat) unresponsive

Post by chennes »

This is the first time I've used a self-compiled version of FreeCAD, so I don't know if the problem is with my compilation, or is an actual bug. When I generate a sketch with a redundant constraint, the sidebar that shows the solver results, constraints list, etc. stops working correctly. For example, the "Click to select" (the redundant constraint) button does nothing. Clicking in the GUI to select the constraint works, but then right-clicking and choosing delete does nothing. Pressing delete on the keyboard (after selecting the constraint) does nothing, but does give a message in Report View: "Delete: Selection not restricted to one sketch and its subelements". At no point after adding a constraint does the Python console show anything happening. If I close the sketch and re-open it, everything is back to working like normal (e.g. I can click to select the constraint, delete it, etc.).

Steps to reproduce:
  1. Open FreeCAD
  2. Switch to Sketcher
  3. New sketch, default settings
  4. Draw an arbitrary rectangle
  5. Draw a second rectangle that shares one vertex with the original
  6. Add a Coincident constraint to make the rectangles share a second, adjacent vertex (e.g. one whole edge). Now one of the Vertical constraints is redundant.
  7. Click the "click to select" text in the Solver messges sidebar. For me, nothing happens.
  8. Right click on the offending constraint (#16) and choose "Delete"-- for me, nothing happens.
  9. Select the constraint in the Constraints window
  10. Press Delete on the keyboard - for me, nothing happens except the message in the Report view.
FreeCAD Version:
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22865 (Git)
Build type: Debug
Branch: master
Hash: 3c307b7a3c222d66cb70695cdcf79606553fcb91
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United States (en_US)

I've got the log data, but I don't know what (if anything) is relevant, so here's my best guess, starting with the failed solve.

Code: Select all

Log: 83.9922 <App> Document.cpp(3785): Failed to recompute Unnamed#Sketch: Sketch with redundant constraints
Please remove the following redundant constraint:
16

Log: 83.9951 <App> Document.cpp(3540): Recompute time: 0.0513949s
Log: 83.9952 Tree.cpp(801): delay update status
Log: 83.9953 Tree.cpp(801): delay update status
Log: 83.9954 <App> Document.cpp(3553): Recompute total time: 0.0519006s
Log: Recompute failed! Please check report view.
Log: 83.9976 Tree.cpp(2344): begin update status
Log: 83.9977 Tree.cpp(2405): update item status
Log: 83.9997 Tree.cpp(2499): done update status
Log: 84.002 Selection.cpp(1108): Add Selection Unnamed#Sketch. (0, 0, 0)
Log: 84.1165 Tree.cpp(801): delay update status
Log: <App> AutoTransaction.cpp(175): close transaction 'Delete constraint' 0
Wrn: QWindowsWindow::setGeometry: Unable to set geometry 200x60+1548+942 on QWidgetWindow/'QMessageBoxClassWindow'. Resulting geometry:  706x178+1548+942 (frame: 11, 45, 11, 11, custom margin: 0, 0, 0, 0, minimum size: 353x89, maximum size: 353x89).
Log: 84.2252 MainWindow.cpp(1362): update actions
Log: 84.2435 Tree.cpp(2344): begin update status
Log: 84.2446 Tree.cpp(2405): update item status
Log: 84.2461 Tree.cpp(2499): done update status
Log: 85.9746 Selection.cpp(1608): Clear selection
Log: 85.9762 Tree.cpp(3238): [ComboView] delete object Unnamed#Sketch
Log: 85.9765 Tree.cpp(4375): [ComboView] Delete item: 0, Unnamed#Sketch
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
chrisb
Veteran
Posts: 54201
Joined: Tue Mar 17, 2015 9:14 am

Re: Sketcher sidebar becomes (somewhat) unresponsive

Post by chrisb »

chennes wrote: Mon Oct 26, 2020 10:04 pm This is the first time I've used a self-compiled version of FreeCAD, so I don't know if the problem is with my compilation, or is an actual bug.
This is very easy to find out: try the official version and return if the behaviour persists.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: Sketcher sidebar becomes (somewhat) unresponsive

Post by GeneFC »

I tried with the latest precompiled version, and I could not find any problems like the ones described. I was able to delete the redundant constraint with every method I tried. No issues at all.

OS: Windows 7 SP 1 (6.1)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22846 (Git)
Build type: Release
Branch: master
Hash: 1f46b72491a0008384a6db4f2615a656249f6f08
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United States (en_US)

Gene
User avatar
chennes
Veteran
Posts: 3909
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Sketcher sidebar becomes (somewhat) unresponsive

Post by chennes »

OK, I just tried with the latest precompiled from GitHub and I do see the same problem:

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22846 (Git)
Build type: Release
Branch: master
Hash: 1f46b72491a0008384a6db4f2615a656249f6f08
Python version: 3.8.6
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/United States (en_US)

So while it's not my compilation, based on GeneFC's comment, it seems it's my machine, at any rate.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: Sketcher sidebar becomes (somewhat) unresponsive

Post by GeneFC »

It is certainly possible that I did not follow every keystroke that you did. I tried, but there may have been something different. I am not saying that there is no bug, but I did not see one.

Gene
User avatar
chennes
Veteran
Posts: 3909
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Sketcher sidebar becomes (somewhat) unresponsive

Post by chennes »

It doesn't seem to be specific to that exact set of steps: anytime I create a sketch with a redundant constraint, the sidebar stops responding correctly until I close the sketch and open it back up. Here's a video of the set of steps I went through (hopefully the places I click are obvious!).
phpBB [video]
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
chennes
Veteran
Posts: 3909
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Sketcher sidebar becomes (somewhat) unresponsive

Post by chennes »

I figured out what is going on: basically, those buttons don't work when there is an active operation.

Under the hood, what is happening is when the UI click on the "click to select" text line gets dispatched off to runCommandByName(), the check isActive() on line 402 of Command.cpp is coming back false. That function in turn is a virtual, actually represented by CmdSketcherSelectRedundantConstraints::isActive() in this case. That function is calling isSketcherAcceleratorActive() in CommandSketcherTools.cpp. In that function, line 65 is a conditional whose condition is evaluating to false:

Code: Select all

if (static_cast<SketcherGui::ViewProviderSketch*>(doc->getInEdit())
                ->getSketchMode() == ViewProviderSketch::STATUS_NONE) {
}
That conditional is false because the mode in my case is STATUS_SKETCH_UseHandler -- I am in the middle of setting up constraints, and want to pop over and clean up the extras as I go. I don't know what drives that conditional's requirement: presumably it makes sense for other operations? I also don't know where to go from here. Is there a code path that can execute a command like this that doesn't go through the check that's failing? For example, by having CmdSketcherSelectRedundantConstraints::isActive() do something other than call isSketcherAcceleratorActive()? Or, if that's not possible, is there a way to indicate to a user that those features are disabled until you click Stop?
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: Sketcher sidebar becomes (somewhat) unresponsive

Post by GeneFC »

OK, I figured out why my observations are different from yours.

I always use the recommended order outlined in

https://wiki.freecadweb.org/Sketcher_Co ... Coincident

Namely, pick the points first and then select the coincident operation. The opposite order usually works, but it does leave the operation active. As you discovered only one operation can be active at a time.

The bug, if there is one, is that the warning message should not offer the option to select the redundant constraint without cancelling the continuing operation.

Gene
User avatar
chennes
Veteran
Posts: 3909
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Sketcher sidebar becomes (somewhat) unresponsive

Post by chennes »

GeneFC wrote: Tue Oct 27, 2020 3:42 am The bug, if there is one, is that the warning message should not offer the option to select the redundant constraint without cancelling the continuing operation.
That makes sense to me: basically any operation that requires a check through isSketcherAcceleratorActive() should be visually disabled when Mode is not STATUS_NONE (e.g. in my case, when a Constraint operation is selected). Obviously for some buttons this is already happening: when you select one of the Constraint buttons, the B Spline tools get disabled.

All that said, it may be that some of those operations should actually work just fine when in some other mode, but I don't know the codebase so I have no idea how to evaluate that.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
chrisb
Veteran
Posts: 54201
Joined: Tue Mar 17, 2015 9:14 am

Re: Sketcher sidebar becomes (somewhat) unresponsive

Post by chrisb »

chennes wrote: Tue Oct 27, 2020 4:48 am basically any operation that requires a check through isSketcherAcceleratorActive() should be visually disabled when Mode is not STATUS_NONE (e.g. in my case, when a Constraint operation is selected).
I don't think that the solver messages should be disabled, although it could be workaround. It should behave in the same way as when selecting a different geometric constraint or a geometric element creation icon: the previously selected function is cancelled immediately.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply