FreeCAD / FreeCAD

This is the official source code of FreeCAD, a free and opensource multiplatform 3D parametric modeler.
https://www.freecad.org
Other
17.75k stars 3.78k forks source link

Materials tool crashes on Arch workbench #13821

Closed furgo16 closed 1 week ago

furgo16 commented 2 weeks ago

Is there an existing issue for this?

Problem description

Steps to reproduce

  1. Create a new document
  2. Switch to the Arch workbench
  3. Click on the Material Tools (Arch_MaterialTools) icon
  4. Material tools don't load, the user is presented with this error
12:00:06  pyException: Traceback (most recent call last):
  File "/usr/share/freecad-daily/Mod/Arch/ArchMaterial.py", line 481, in setEdit
    self.taskd = _ArchMaterialTaskPanel(vobj.Object)
  File "/usr/share/freecad-daily/Mod/Arch/ArchMaterial.py", line 556, in __init__
    self.fillMaterialCombo()
  File "/usr/share/freecad-daily/Mod/Arch/ArchMaterial.py", line 699, in fillMaterialCombo
    for f in os.listdir(p):
<class 'FileNotFoundError'>: [Errno 2] No such file or directory: '/usr/share/freecad-daily//Mod/Material/StandardMaterial'

I can reproduce this both with the PPA and snap package builds, as well as with a local built. So it seems it's not simply a packaging issue. It can also be reproduced with the BIM workbench.

It looks like the issue surfaces in this part of the code: https://github.com/FreeCAD/FreeCAD/blob/9bd19ff43a1c984d9d241f85c31c3d30be876d06/src/Mod/Arch/ArchMaterial.py#L689-L705

I believe the code is looking for the standard materials folder here: $RESOURCE_DIR/Mod/Material/StandardMaterial/

But the new Material workbench revamp has changed that location to: $RESOURCE_DIR/Mod/Material/Resources/Materials/Standard/

Full version info

OS: Ubuntu 22.04.4 LTS (ubuntu:GNOME/ubuntu)
Word size of FreeCAD: 64-bit
Version: 0.22.0dev.37096 (Git)
Build type: Release
Branch: main
Hash: af2b8b661f711f8512d63345e4ffe321e292ddbb
Python 3.10.12, Qt 5.15.3, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
Locale: C/Default (C)
Installed mods: 
  * OpenTheme 2024.4.20
  * BIM 2021.12.0
  * parts_library

Subproject(s) affected?

Arch

Anything else?

No response

Code of Conduct

maxwxyz commented 2 weeks ago

@davesrocketshop FYI

yorikvanhavre commented 2 weeks ago

I'll attack this (compatibility with new Materials system) as soon as #13783 (BIM migration) is done. |since the arch materials system is (currently) mostly self-contained, it shouldn't be much work to have it back working. Then we see about integrating things better

furgo16 commented 1 week ago

I've submitted a draft PR that addresses this in the meantime: https://github.com/FreeCAD/FreeCAD/pull/13830