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

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

Open
stepheneb opened this issue Mar 23, 2021 · 4 comments

Comments

@stepheneb
Copy link

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
Copy link
Author

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

FreeCAD/FreeCAD#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
Copy link
Owner

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
Copy link
Author

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:

  • Draft, no error
  • Part Design, no error
  • Start, no error

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
Copy link
Contributor

luzpaz commented Aug 27, 2022

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

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

No branches or pull requests

3 participants