easyw / kicadStepUpMod

kicadStepUp: ECAD to MCAD FreeCAD WorkBench
486 stars 61 forks source link

3D model of the footprints not imported with "load board" function #140

Closed loiiiic closed 2 years ago

loiiiic commented 2 years ago

Hello,

When using the "Load board" function with a *.kicad_pcb file (KiCad 6), the 3D models of the components are not found. I get this error :

11:46:42  step-module-replaced Resistor_SMD.3dshapes/R_0805_2012Metric.wrl
11:46:42  model name R_0805_2012Metric
11:46:42  error missing "${KICAD6_3DMODEL_DIR}/Resistor_SMD.3dshapes/R_0805_2012Metric.wrl"
11:46:42  added 0 model(s)
11:46:42  running time: 0.117sec
11:46:42  missing models
11:46:42  "${KICAD6_3DMODEL_DIR}/Resistor_SMD.3dshapes/R_0805_2012Metric.wrl" (.stp or .step)
11:46:42  
11:46:42  searching path
11:46:42  /usr/share/kicad/3dmodels/

I set up the path like this in FreeCad:

path

If I copy the 3dmodels folder from /usr/share/kicad to /home/loiiiic/Documents/ and declare the paths below, it works. There is something I don't understand.

Capture 2

Thank you for your feedback.

easyw commented 2 years ago

@loiiiic 1) I'm not sure if it can be the culprit, but could you remove the last slash '/' at the end of the first field '/usr/share/kicad/3dmodels/' 2) it could be a permissions issue... can FC access and read those 3D models? (i.e. import a 3d model manually using FC?) or even better testing with some python command like:

import FreeCAD import ImportGui FreeCAD.newDocument("Unnamed") FreeCAD.ActiveDocument=FreeCAD.getDocument("Unnamed") ImportGui.insert('/usr/share/kicad/3dmodels/Resistor_SMD.3dshapes/R_0805_2012Metric.step',FreeCAD.ActiveDocument.Name)

loiiiic commented 2 years ago

Hi @easyw ,

Thank you for your quick answer.

  1. Same issue by removing the last slash.
  2. Good point. If I click on the three small dots to look for the path, the kicad folder is not present in the window:

Capture3

However, there are read rights on the folder 3dmodels:

ls -l
drwxr-xr-x  91 root root  4096 juin  24 14:50 3dmodels

This is what I get with the Python commands :

>>> import FreeCAD
>>> import ImportGui
>>> FreeCAD.newDocument("Unnamed")
<Document object at 0x55f6ce9dd020>
>>> # App.setActiveDocument("Unnamed")
>>> # App.ActiveDocument=App.getDocument("Unnamed")
>>> # Gui.ActiveDocument=Gui.getDocument("Unnamed")
>>> FreeCAD.ActiveDocument=FreeCAD.getDocument("Unnamed")
>>> ImportGui.insert('/usr/share/kicad/3dmodels/Resistor_SMD.3dshapes/R_0805_2012Metric.step',FreeCAD.ActiveDocument.Name)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
OSError: cannot read STEP file
easyw commented 2 years ago

@loiiiic this seems an issue in how FC can read the folders (is FC installed or AppImage or Flatpack?) or an issue in kicad installation process... Can you read/access the '/usr/share/kicad/3dmodels/Resistor_SMD.3dshapes/R_0805_2012Metric.step' i.e. in a text editor?

easyw commented 2 years ago

If I click on the three small dots to look for the path, the kicad folder is not present in the window

that is strange

can you i.e. ls /usr/share/kicad/3dmodels/Resistor_SMD.3dshapes/R_0805_2012Metric.step

loiiiic commented 2 years ago

@easyw

I can open /usr/share/kicad/3dmodels/Resistor_SMD.3dshapes/R_0805_2012Metric.step with a text editor.

Freecad was installed via Flatpak (version 0.20).

I just installed it via apt (version 0.19) and it works.

easyw commented 2 years ago

thanks for your feedback... it seems an issue of flatpack then may you try FC0.20 via AppImage? https://github.com/FreeCAD/FreeCAD/releases/download/0.20/FreeCAD-0.20.0-Linux-x86_64.AppImage

loiiiic commented 2 years ago

@easyw

It is working with the AppImage, I will stay with the AppImage.

Thank you for your help and for your addon! :-)