mwganson / ThreadProfile

Create 2d thread profile for sweeping along helix in Part or Part Design workbenches
GNU Lesser General Public License v2.1
38 stars 8 forks source link

selecting Thread Profile workbench: cannot import name '_ViewProviderWire' from 'Draft' #28

Open stepheneb opened 3 years ago

stepheneb commented 3 years ago

FC: 0.19, ThreadProfile workbench 1.69 (more details at bottom)

  1. Load this file) https://github.com/stepheneb/freecad-and-thread-profile-issue/blob/master/filter-tester-b1.FCStd
  2. Make body p40 active
  3. Switch to ThreadProfile workbench

May be related: https://forum.freecadweb.org/viewtopic.php?f=23&t=56711&p=490392#p490392

17:27:14  Traceback (most recent call last):
  File "/Users/stephen/Library/Preferences/FreeCAD/Mod/ThreadProfile/ThreadProfileCmd.py", line 43, in <module>
    from Draft import _DraftObject, getParam, _ViewProviderWire, formatObject, select
<class 'ImportError'>: cannot import name '_ViewProviderWire' from 'Draft' (/Applications/cad/FreeCAD.app/Contents/Resources/Mod/Draft/Draft.py)
17:27:15  Traceback (most recent call last):
  File "/Applications/cad/FreeCAD.app/Contents/Resources/Mod/Draft/draftviewproviders/view_wire.py", line 94, in attach
    self.symbol = gui_utils.dim_symbol()
  File "/Applications/cad/FreeCAD.app/Contents/Resources/Mod/Draft/draftutils/gui_utils.py", line 208, in dim_symbol
    marker = coin.SoSphere()
<class 'NameError'>: name 'coin' is not defined
17:27:15  Traceback (most recent call last):
  File "/Applications/cad/FreeCAD.app/Contents/Resources/Mod/Draft/draftviewproviders/view_wire.py", line 141, in onChanged
    super(ViewProviderWire, self).onChanged(vobj, prop)
  File "/Applications/cad/FreeCAD.app/Contents/Resources/Mod/Draft/draftviewproviders/view_base.py", line 293, in onChanged
    if self.texture:
<class 'AttributeError'>: 'ViewProviderWire' object has no attribute 'texture'
17:27:15  Traceback (most recent call last):
  File "/Applications/cad/FreeCAD.app/Contents/Resources/Mod/Draft/draftviewproviders/view_wire.py", line 141, in onChanged
    super(ViewProviderWire, self).onChanged(vobj, prop)
  File "/Applications/cad/FreeCAD.app/Contents/Resources/Mod/Draft/draftviewproviders/view_base.py", line 293, in onChanged
    if self.texture:
<class 'AttributeError'>: 'ViewProviderWire' object has no attribute 'texture'
17:27:15  Traceback (most recent call last):
  File "/Applications/cad/FreeCAD.app/Contents/Resources/Mod/Draft/draftviewproviders/view_wire.py", line 131, in onChanged
    if self.symbol:
<class 'AttributeError'>: 'ViewProviderWire' object has no attribute 'symbol'
17:27:15  Traceback (most recent call last):
  File "/Applications/cad/FreeCAD.app/Contents/Resources/Mod/Draft/draftviewproviders/view_wire.py", line 94, in attach
    self.symbol = gui_utils.dim_symbol()
  File "/Applications/cad/FreeCAD.app/Contents/Resources/Mod/Draft/draftutils/gui_utils.py", line 208, in dim_symbol
    marker = coin.SoSphere()
<class 'NameError'>: name 'coin' is not defined
17:27:15  Traceback (most recent call last):
  File "/Applications/cad/FreeCAD.app/Contents/Resources/Mod/Draft/draftviewproviders/view_wire.py", line 141, in onChanged
    super(ViewProviderWire, self).onChanged(vobj, prop)
  File "/Applications/cad/FreeCAD.app/Contents/Resources/Mod/Draft/draftviewproviders/view_base.py", line 293, in onChanged
    if self.texture:
<class 'AttributeError'>: 'ViewProviderWire' object has no attribute 'texture'
17:27:15  Traceback (most recent call last):
  File "/Applications/cad/FreeCAD.app/Contents/Resources/Mod/Draft/draftviewproviders/view_wire.py", line 141, in onChanged
    super(ViewProviderWire, self).onChanged(vobj, prop)
  File "/Applications/cad/FreeCAD.app/Contents/Resources/Mod/Draft/draftviewproviders/view_base.py", line 293, in onChanged
    if self.texture:
<class 'AttributeError'>: 'ViewProviderWire' object has no attribute 'texture'
17:27:15  Traceback (most recent call last):
  File "/Applications/cad/FreeCAD.app/Contents/Resources/Mod/Draft/draftviewproviders/view_wire.py", line 131, in onChanged
    if self.symbol:
<class 'AttributeError'>: 'ViewProviderWire' object has no attribute 'symbol'
17:27:15  Traceback (most recent call last):
  File "/Applications/cad/FreeCAD.app/Contents/Resources/Mod/Draft/draftviewproviders/view_wire.py", line 141, in onChanged
    super(ViewProviderWire, self).onChanged(vobj, prop)
  File "/Applications/cad/FreeCAD.app/Contents/Resources/Mod/Draft/draftviewproviders/view_base.py", line 293, in onChanged
    if self.texture:
<class 'AttributeError'>: 'ViewProviderWire' object has no attribute 'texture'
17:27:15  Traceback (most recent call last):
  File "/Applications/cad/FreeCAD.app/Contents/Resources/Mod/Draft/draftviewproviders/view_wire.py", line 141, in onChanged
    super(ViewProviderWire, self).onChanged(vobj, prop)
  File "/Applications/cad/FreeCAD.app/Contents/Resources/Mod/Draft/draftviewproviders/view_base.py", line 293, in onChanged
    if self.texture:
<class 'AttributeError'>: 'ViewProviderWire' object has no attribute 'texture'
17:27:15  AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
17:27:15  AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
17:27:15  AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
17:27:15  AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.

OS: macOS 10.16 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)

stepheneb commented 3 years ago

Here is a pull request (approved but the travis build failed) for the Draft workbench that might fix this issue.

https://github.com/FreeCAD/FreeCAD/pull/4661

In the mean time if I open FC with none of my files that cause this issue loaded and then select the Draft workbench before opening one my files that use the ThreadProfile workbench this problem does not occur.

mwganson commented 3 years ago

I am unable to recreate the error you mentioned. I am also using the same version of FreeCAD (except on windows instead of mac). I get the attachment engine warnings only, but not the other errors.

Try to open the python console and enter this:

from Draft import _ViewProviderWire

If you get an error like the one you mentioned, try this instead:

from draftviewproviders.view_wire import ViewProviderWire as _ViewProviderWire

and see if that is error free.

OS: Windows 10 (10.0) 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: English/United States (en_US)

stepheneb commented 3 years ago

Interesting data ...

First tests by starting FC with without loading any of my files and running from Draft import _ViewProviderWire in the python console, then quitting and trying a variation:

FC starts up with this workbench selected:

With FC not running if I load any of a number of similar files I get the errors listed above in the report window.

I'll see what is the minimal file I can make that generates this issue.

luzpaz commented 2 years ago

@stepheneb can you recreate this with FreeCAD v0.20 ?