DeepSOIC / Part-o-magic

Experiment on FreeCAD-wide automation of Part container management. For FC v0.17-0.18
Other
12 stars 4 forks source link

XRay error on sketches #40

Open leoheck opened 4 years ago

leoheck commented 4 years ago

With a sketch selected and clicking in the X-Ray button gives me this error message:

{'sclassname': 'N4Base10ValueErrorE', 'sErrMsg': "'Shaded' is not part of the enumeration", 'sfile': '', 'iline': 0, 'sfunction': '', 'swhat': "'Shaded' is not part of the enumeration", 'btranslatable': False, 'breported': True}

This is the traceback:

Traceback (most recent call last):
  File "/home/lheck/.FreeCAD/Mod/Part-o-magic/PartOMagic/Gui/AACommand.py", line 129, in Activated
    self.RunOrTest(b_run= True)
  File "/home/lheck/.FreeCAD/Mod/Part-o-magic/PartOMagic/Gui/View/XRay.py", line 50, in RunOrTest
    XRay(selobj.Object)
  File "/home/lheck/.FreeCAD/Mod/Part-o-magic/PartOMagic/Gui/View/XRay.py", line 21, in XRay
    tv.modifyVPProperty(obj, 'DisplayMode', 'Shaded')
  File "/usr/share/freecad-daily/Mod/Show/mTempoVis.py", line 262, in modifyVPProperty
    self.modify(VProperty(doc_obj, prop_name, new_value), mild_restore)
  File "/usr/share/freecad-daily/Mod/Show/mTempoVis.py", line 160, in modify
    detail.apply_data(detail.data)
  File "/usr/share/freecad-daily/Mod/Show/SceneDetails/VProperty.py", line 48, in apply_data
    setattr(self.doc.getObject(self.objname).ViewObject, self.propname, val)
ValueError: {'sclassname': 'N4Base10ValueErrorE', 'sErrMsg': "'Shaded' is not part of the enumeration", 'sfile': '', 'iline': 0, 'sfunction': '', 'swhat': "'Shaded' is not part of the enumeration", 'btranslatable': False, 'breported': True}

I suppose it shouldn't show an error. It should just do nothing or toggle it on its father's feature. What do you think?

OS: Ubuntu 19.10 (ubuntu:GNOME/ubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.
Build type: Release
Python version: 3.7.3
Qt version: 5.12.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United States (en_US)
DeepSOIC commented 4 years ago

BTW, what do you think should actually happen? (apart from not getting an error message) Should the sketch be hidden? Should it remain visible but become unpickable? Should nothing happen at all?

leoheck commented 4 years ago

Ah, I didn't see your question, thanks for asking me.

I think that the sketch should not be the priority for the X-Ray view, so it could ignore it even if it is visible. However, this action could be propagated to the parent body. OR if this is such a hard to implement feature or if you think it is not a good solution to propagate the behavior to is parent, but just removing the error pop up and doing nothing would be a good solution here. And also a simple message in the Report View saying that this is not something applicable to the sketch would be nice too.