Can't use named constraints in 0.20 202112202219
Forum rules
and Helpful information
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!
Also, be nice to others! Read the FreeCAD code of conduct!
-
- Veteran
- Posts: 5513
- Joined: Thu Apr 05, 2018 1:53 am
Re: Can't use named constraints in 0.20 202112202219
Interestingly, the Animator macro is able to find the named constraints and animate them via python.
Re: Can't use named constraints in 0.20 202112202219
As promised I carried out the Git Bisect work and determined the regression was caused by git commit 2db73c0. I'm presently recompiling the very latest master to ensure the issue is still present, I'm struggling to understand how it would be fixed without changing the ObjectIdentifier.cpp but C++ is by no means my strong point.
Re: Can't use named constraints in 0.20 202112202219
Thanks! To be clear: You don't have to remove the prefixes manually, if you use "Copy command" in the Python console's context menu.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Can't use named constraints in 0.20 202112202219
As I assumed updating to the latest master hasn't fixed the issue.
OS: Linux Mint 19.3 (X-Cinnamon/cinnamon)
Word size of FreeCAD: 64-bit
Version: 0.20.26761 (Git)
Build type: Release
Branch: master
Hash: b0fc0ab0f4cfea326e047ac3166426e98d5e115f
Python version: 3.6.9
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedKingdom (en_GB)
Is it a real regression or has this shone a light on something else being incorrect?
OS: Linux Mint 19.3 (X-Cinnamon/cinnamon)
Word size of FreeCAD: 64-bit
Version: 0.20.26761 (Git)
Build type: Release
Branch: master
Hash: b0fc0ab0f4cfea326e047ac3166426e98d5e115f
Python version: 3.6.9
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedKingdom (en_GB)
Sorry to trouble you Werner, but could you please have a look at the report at the start of this topic with relation to git commit 2db73c0wmayer wrote: ping
Is it a real regression or has this shone a light on something else being incorrect?
-
- Veteran
- Posts: 2190
- Joined: Tue Jan 03, 2017 10:55 am
Re: Can't use named constraints in 0.20 202112202219
Thanks @realthunder
Re: Can't use named constraints in 0.20 202112202219
Sorry for the regression and thanks for the fix!
Recently we have seen this one crash reported by chrisb where chennes has found the reason for and provided a fix: git commit b1beadd2e95b442
Nobody of the Linux testers could reproduce the crash because when assigning a null pointer to a std::string it throws an exception (a sub-type of std::exception) instead of causing a segmentation fault. After studying the error analysis I could reproduce the problem and also realized why the exception didn't show up. The calling instance used a catch(...) block that silently suppressed any kind of exception without reporting it. This makes it nearly impossible to find possible bugs inside the invoked functions in a try/catch(...) block.
In general, catch(...) blocks must be used with care because using them just out of laziness they harm rather than help.
Before committing my change I have checked the commit when the catch(...) has been added if there is an explanation for it. Because I didn't find any hint and neither by doing some simple tests nor by running the unit tests it entered the catch(...) block I decided to remove it.
After applying the PR we also have to write a unit test to avoid such a regression in the future.
Re: Can't use named constraints in 0.20 202112202219
This is a short example that can be used for the unit tests:
git commit 53f24f4bc2
Code: Select all
doc = App.newDocument()
sketch = doc.addObject('Sketcher::SketchObject','Sketch')
geoList = []
geoList.append(Part.LineSegment(App.Vector(0,5,0),App.Vector(5,5,0)))
geoList.append(Part.LineSegment(App.Vector(5,5,0),App.Vector(5,0,0)))
geoList.append(Part.LineSegment(App.Vector(5,0,0),App.Vector(0,0,0)))
geoList.append(Part.LineSegment(App.Vector(0,0,0),App.Vector(0,5,0)))
sketch.addGeometry(geoList,False)
conList = []
conList.append(Sketcher.Constraint('Coincident',0,2,1,1))
conList.append(Sketcher.Constraint('Coincident',1,2,2,1))
conList.append(Sketcher.Constraint('Coincident',2,2,3,1))
conList.append(Sketcher.Constraint('Coincident',3,2,0,1))
conList.append(Sketcher.Constraint('Horizontal',0))
conList.append(Sketcher.Constraint('Horizontal',2))
conList.append(Sketcher.Constraint('Vertical',1))
conList.append(Sketcher.Constraint('Vertical',3))
sketch.addConstraint(conList)
del geoList, conList
length = sketch.addConstraint(Sketcher.Constraint('Distance',0,6.0))
height = sketch.addConstraint(Sketcher.Constraint('Distance',3,5.0))
sketch.renameConstraint(length, u'Length')
sketch.setExpression('Constraints[{}]'.format(height), u'.Constraints.Length')
Re: Can't use named constraints in 0.20 202112202219
It doesn't appear to work in this build, has it been merged?
OS: Debian GNU/Linux 10 (buster) (XFCE/lightdm-xsession)
Word size of FreeCAD: 64-bit
Version: 0.20.26762 (Git)
Build type: Release
Branch: master
Hash: 1653d26ffa0b35d57fc3325c18bf5b7bad515703
Python version: 3.7.3
Qt version: 5.11.3
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
OS: Debian GNU/Linux 10 (buster) (XFCE/lightdm-xsession)
Word size of FreeCAD: 64-bit
Version: 0.20.26762 (Git)
Build type: Release
Branch: master
Hash: 1653d26ffa0b35d57fc3325c18bf5b7bad515703
Python version: 3.7.3
Qt version: 5.11.3
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."