Deleting constraint causes warning: Delete: Selection not restricted to one sketch and its subelements

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!
chrisb
Veteran
Posts: 54311
Joined: Tue Mar 17, 2015 9:14 am

Deleting constraint causes warning: Delete: Selection not restricted to one sketch and its subelements

Post by chrisb »

I get a warning if I delete the point-on-object constraint in the attached sketch:

Delete: Selection not restricted to one sketch and its subelements

OS: macOS High Sierra (10.13)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.21329 (Git)
Build type: Release
Branch: master
Hash: 2330eef823b32ac412d839031cc174353a76b013
Python version: 3.8.2
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: C/Default (C)
Attachments
warning.FCStd
(3.32 KiB) Downloaded 42 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
wmayer
Founder
Posts: 20324
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Deleting constraint causes warning: Delete: Selection not restricted to one sketch and its subelements

Post by wmayer »

I don't get this warning.

The relevant code is

Code: Select all

void ViewProviderSketch::deleteSelected()
{
    std::vector<Gui::SelectionObject> selection;
    selection = Gui::Selection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId());

    // only one sketch with its subelements are allowed to be selected
    if (selection.size() != 1) {
        Base::Console().Warning("Delete: Selection not restricted to one sketch and its subelements");
        return;
    }

    // get the needed lists and objects
    const std::vector<std::string> &SubNames = selection[0].getSubNames();

    if(SubNames.size()>0) {
        App::Document* doc = getSketchObject()->getDocument();

        doc->openTransaction("delete sketch geometry");

        onDelete(SubNames);

        doc->commitTransaction();
    }
}
For me the size of "selection" is always 1 so it doesn't print the warning.
Syres
Veteran
Posts: 2902
Joined: Thu Aug 09, 2018 11:14 am

Re: Deleting constraint causes warning: Delete: Selection not restricted to one sketch and its subelements

Post by Syres »

chrisb wrote: Mon Jun 01, 2020 10:02 am I get a warning if I delete the point-on-object constraint in the attached sketch
You must have some serious static causing these faults :D

But seriously I can't replicate the error using:

OS: Windows 7 SP 1 (6.1)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.21325 (Git)
Build type: Release
Branch: master
Hash: 2cb9b147f13419f019f9808ace21d3d2ceae99c5
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United Kingdom (en_GB)
chrisb
Veteran
Posts: 54311
Joined: Tue Mar 17, 2015 9:14 am

Re: Deleting constraint causes warning: Delete: Selection not restricted to one sketch and its subelements

Post by chrisb »

I have retried with a plain vanilla config and still get the warning. It doesn't matter if I select the constraint in 3D view or in the constraints list.

The warning does not occur on my Ubuntu box, but it occured in these versions as well, so it was present since quite some time. Can another Mac user check this?

OS: macOS High Sierra (10.13)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.21125 (Git)
Build type: Release
Branch: master
Hash: 40600a55c2fe71ff589be677f6e427ccc937d003
Python version: 3.8.2
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: C/Default (C)

OS: macOS 10.13
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16146 (Git)
Build type: Release
Branch: (HEAD detached at 0.18.4)
Hash: 980bf9060e28555fecd9e3462f68ca74007b70f8
Python version: 3.6.7
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
perot
Posts: 146
Joined: Wed Aug 30, 2017 5:40 pm

Re: Deleting constraint causes warning: Delete: Selection not restricted to one sketch and its subelements

Post by perot »

Sorry for bringing up this thread again. But I get this warning all the time. Has this issue been addressed?

Very often when I try to delete some constraint after the solver points out some redundancy, I cannot delete this constraint, and when trying keep getting this warning. The only way to get rid of the constraint is leaving the sketch editor (ESC key) and re-enter it, then I can delete it fine.

Cheers Peter

Code: Select all

OS: Windows 7 SP 1 (6.1)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.23578 (Git)
Build type: Release
Branch: master
Hash: 50c3cbf00579dc4941ca743c25720d016b0453ce
Python version: 3.8.6
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: German/Germany (de_DE)
User avatar
chennes
Veteran
Posts: 3914
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Deleting constraint causes warning: Delete: Selection not restricted to one sketch and its subelements

Post by chennes »

I have a vague sense that we did get this worked out in the end -- it was something like the selection system was getting confused, and the current selection somehow set to something that was not the sketch? I don't remember when that was, though -- is there a newer version you can update to and re-test?
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
edwilliams16
Veteran
Posts: 3193
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: Deleting constraint causes warning: Delete: Selection not restricted to one sketch and its subelements

Post by edwilliams16 »

OS: macOS High Sierra (10.13)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24267 (Git)
Build type: Release
Branch: master
Hash: b2ca86d8d72b636011a73394bf9bcdedb3b109b7
Python version: 3.8.8
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: C/Default (C)

I get the warning deleting either in the list or by selecting in the view. The constraint is successfully deleted.
User avatar
chennes
Veteran
Posts: 3914
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Deleting constraint causes warning: Delete: Selection not restricted to one sketch and its subelements

Post by chennes »

edwilliams16 wrote: Fri Mar 19, 2021 7:31 pm Version: 0.19.24267 (Git)
OK, so much for that! The fix I'm thinking about was before that commit, so must not address this issue.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
JankoHrasko
Posts: 14
Joined: Sun Jan 29, 2023 1:23 pm

Re: Deleting constraint causes warning: Delete: Selection not restricted to one sketch and its subelements

Post by JankoHrasko »

Hi all,
sorry to reopen this discussion, but somebody found the solution to this warning?

I am on two mac intel & M1 with three different version of Freecad and this alert is coming every-time when one element (any) from sketch is deleting.

Is it something dangerous?

I uninstall and reinstall Freecad with the same result.

one of the versions:

Code: Select all

OS: macOS 10.16
Word size of FreeCAD: 64-bit
Version: 0.20.2.29603 (Git)
Build type: Release
Branch: (HEAD detached at 0.20.2)
Hash: 930dd9a76203a3260b1e6256c70c1c3cad8c5cb8
Python 3.10.8, Qt 5.15.4, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
Locale: C/Default (C)
Installed mods: 
  * Movie 2023.6.10
  * ProDarkThemePreferencePack 1.0.0
  * A2plus 0.4.60i
  * fasteners 0.4.24
  * ExtremeProLight 1.6.0
  * ExplodedAssembly
  * Help 1.0.3
  * Assembly4 0.12.4
  * Assembly3 0.11.4
thanks for your help!
TheMarkster
Veteran
Posts: 5513
Joined: Thu Apr 05, 2018 1:53 am

Re: Deleting constraint causes warning: Delete: Selection not restricted to one sketch and its subelements

Post by TheMarkster »

Update to the latest version and see if it has been fixed. If there has been a recent fix it will never get back ported to 0.20.
Post Reply