Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Part: Part.CompoundTools.Explode.explodeCompound access a property of... #4501

Merged
merged 1 commit into from Feb 21, 2021

Conversation

luzpaz
Copy link
Contributor

@luzpaz luzpaz commented Feb 21, 2021

...a sometimes null object with an error

Python code, file src/Mod/Part/CompoundTools/Explode.py
The explodeCompound function can be called in a context without assigning the ViewObject property, for example from a command line script.

The error that is fixed by this patch.

Traceback (most recent call last):
  ...
  File "/opt/freecad/Mod/Part/CompoundTools/Explode.py", line 23, in explodeCompound
    cf.ViewObject.DontUnhideOnDelete = True
AttributeError: 'NoneType' object has no attribute 'DontUnhideOnDelete']

Patch submitted by marioamb.
Fix 0004421
https://tracker.freecadweb.org/view.php?id=4421

...a sometimes null object with an error

Python code, file `src/Mod/Part/CompoundTools/Explode.py`
The `explodeCompound` function can be called in a context without assigning the `ViewObject` property, for example from a command line script.

The error that is fixed by this patch. 
```
Traceback (most recent call last):
  ...
  File "/opt/freecad/Mod/Part/CompoundTools/Explode.py", line 23, in explodeCompound
    cf.ViewObject.DontUnhideOnDelete = True
AttributeError: 'NoneType' object has no attribute 'DontUnhideOnDelete']
```

Patch submitted by marioamb.  
Fix FreeCAD#4421  
https://tracker.freecadweb.org/view.php?id=4421
@luzpaz
Copy link
Contributor Author

luzpaz commented Feb 21, 2021

Note: have not tested this patch, but it looks correct. Please review.

Copy link
Member

@chennes chennes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a failing example to test it on, but the code change itself is basically as safe as safe can be, simply adding a check against None before accessing the structure. If it fixes the submitter's bug, it looks good to me.

@wwmayer wwmayer merged commit 110860f into FreeCAD:master Feb 21, 2021
@luzpaz luzpaz deleted the Ticket4421 branch February 21, 2021 11:27
howetuft pushed a commit to howetuft/FreeCAD that referenced this pull request Feb 21, 2021
…rameter

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

This specific constraint removes the free parameter of the previous implementation. This solves:
https://tracker.freecadweb.org/view.php?id=4501

fixes FreeCAD#4501

However, this implementation of equal size produces zero gradients when coordinates of lines are aligned,
e.g. vertical or horizontal. These zero gradients, which are mathematically right ruin the diagnosis, which
regards corresponding elements as fully constraint (because they are locked from a solver point of view), when
they are simply locked, but are movable and constrainable. For this, when the rightful gradient is small enough
(<1e-10) it is substituted by a surrogate gradient of 1e-10, which solves the problem with the diagnose, which
treats as zero only values under 1e-13 (pivot threshold used in QR decomposition).

This special behaviour fixes the wrong detection here:
https://forum.freecadweb.org/viewtopic.php?f=8&t=53466&start=40#p464168

It also fixes this one:
https://forum.freecadweb.org/viewtopic.php?p=468585#p468587
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants