draft having problems initializing

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
iplayfast
Posts: 256
Joined: Sat Sep 07, 2019 6:55 am

draft having problems initializing

Post by iplayfast »

Lately I've been having a problem when I load the draft workbench. I've been trying to work through it, but ...
The offending code is Mod/Draft/draftguitools/gui_trackers.py around Line 976

Code: Select all

class gridTracker(Tracker):                                                     
    """A grid tracker."""                                                       
                                                                                
    def __init__(self):                                                         
                                                                                
        gtrans = Draft.getParam("gridTransparency",0)                           
        col = self.getGridColor()                                               
        if Draft.getParam("coloredGridAxes",True):                              
            red = ((1.0+col[0])/2,0.0,0.0)                                      
            green = (0.0,(1.0+col[1])/2,0.0)                                    
            blue = (0.0,0.0,(1.0+col[2])/2)                                     
        else:                                                                   
            red = col                                                           
            green = col                                                         
            blue = col                                                          
        pick = coin.SoPickStyle()                                               
        pick.style.setValue(coin.SoPickStyle.UNPICKABLE) <--------------here!
The error

Code: Select all

13:18:21  <built-in function SoFieldContainer_getField> returned a result with an exception set
13:18:21  Traceback (most recent call last):
  File "<string>", line 152, in Activated
  File "/home/chris/github/freecad-source/build/Mod/Draft/draftguitools/gui_snapper.py", line 1578, in show
    self.setTrackers()
  File "/home/chris/github/freecad-source/build/Mod/Draft/draftguitools/gui_snapper.py", line 1622, in setTrackers
    self.grid = trackers.gridTracker()
  File "/home/chris/github/freecad-source/build/Mod/Draft/draftguitools/gui_trackers.py", line 972, in __init__
    pick.style.setValue(coin.SoPickStyle.UNPICKABLE)
  File "/usr/lib/python3/dist-packages/pivy/coin.py", line 3989, in __getattr__
    field = self.getField(name)
  File "/usr/lib/python3/dist-packages/pivy/coin.py", line 3873, in getField
    return _coin.SoFieldContainer_getField(self, name)
    
Commenting out the line just leads to other errors with things trying to set values so I think this is the first indication of a bigger problem.

I compile freecad myself from the latest pull, and this issue has cropped up in the last month or so, (I rarely use Draft so perhaps longer). I might have messed things up by trying to compile realthunder's version which uses his own version of coin.
However, reinstalling coin and pivy from the default OS distub to overwrite my attempt has not changed anything. (so I'm confused)

I tried a git bisect but could not find a clean build from last summer, (still confused)

I tried a little test in python with the code causing the error. (taken from freecad-source/build/Mod/Draft/draftguitools/gui_trackers.py", line 972) and was able to recreate the error.

Code: Select all

python
Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pivy.coin as coin
>>> pick = coin.SoPickStyle()
>>> coin.SoPickStyle.UNPICKABLE
2
>>> pick.style.setValue(coin.SoPickStyle.UNPICKABLE)
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pivy/coin.py", line 3983, in __getattr__
    return SoBase.__getattribute__(self, name)
AttributeError: 'SoPickStyle' object has no attribute 'style'

During handling of the above exception, another exception occurred:

SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/pivy/coin.py", line 3989, in __getattr__
    field = self.getField(name)
  File "/usr/lib/python3/dist-packages/pivy/coin.py", line 3873, in getField
    return _coin.SoFieldContainer_getField(self, name)
SystemError: <built-in function SoFieldContainer_getField> returned a result with an exception set

Any ideas?

Code: Select all

OS: Linux Mint 21 (X-Cinnamon/cinnamon)
Word size of FreeCAD: 64-bit
Version: 0.21.0.31569 (Git)
Build type: Unknown
Branch: master
Hash: 3388854cbc63936071e8ec7021db30ce51eeb367
Python 3.10.6, Qt 5.15.3, Coin 4.0.1, Vtk 9.1.0, OCC 7.5.1
Locale: English/Canada (en_CA)
Installed mods: 
  * Plot 1.0.4
  * dummy.py
  * BOLTSFC
  * BIM 2021.12.0
  * CycloidGearBox
  * gbNov8.stl
  * workfeature
  * fcgear 1.0.0
  * parts_library
  * FreeCAD_assembly3 0.11.2
  * cycdisk.stl
  * CurvedShapes 1.0.4
  * Manipulator 1.4.9
  * gbNov8.FCStd
  * SelectorToolbar
  * EM
  * Assembly4 1.0.4
  * ThreadProfile 0.12.5
  * sheetmetal 0.2.60
  * pindisk.stl
  * testdisk.log
  * 3D_Printing_Tools
  * es.stl
  * kicadStepUpMod 10.16.8
  * ose-workbench-core
  * ExplodedAssembly
  * FCGear 1.0.0
  * OSE3dPrinter
  * RemBench
  * retr3d
  * A2plus 0.4.60h
  * LCInterlocking
  * Mechatronic
  * Design456 0.0.1
  * PieMenu
  * drivdisk.stl
  * Mechatronic1
  * symbols_library
  * Help 1.0.3
  * FeedsAndSpeeds 0.5.0
  * Pyramids-and-Polyhedrons
  * workfeature-macro
  * ose-piping-workbench
  * Nikra-DAP
  * fasteners 0.4.53
  * Lattice2 1.0.0
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: draft having problems initializing

Post by Roy_043 »

A www search throws up hits suggesting that the problem should have been fixed already. :mrgreen:
https://bugs.archlinux.org/task/73122
https://github.com/coin3d/pivy/issues/88

Can't confirm the issue:

Code: Select all

OS: Ubuntu 22.04.1 LTS (ubuntu:GNOME/ubuntu)
Word size of FreeCAD: 64-bit
Version: 0.21.0.31488 (Git)
Build type: Release
Branch: master
Hash: 3e58513c24e533326906be5c87c82aafe582c936
Python 3.10.8, Qt 5.15.4, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
Locale: English/United States (en_US)
User avatar
dpward
Posts: 27
Joined: Sun Jan 01, 2023 6:06 pm
Contact:

Re: draft having problems initializing

Post by dpward »

Fix released for pivy in Ubuntu 22.04.
https://bugs.launchpad.net/ubuntu/+sour ... ug/2000840
Post Reply