marmni / FreeCAD-PCB

FreeCAD-PCB
106 stars 26 forks source link

FreeCAD v1.0RC2 - lots of errors and no parts show on the PCB #78

Open Wiredhome opened 1 week ago

Wiredhome commented 1 week ago

I don't have an idea of how much changed in this new release candidate, so I don't have an idea of how much it takes to get FreeCAD working in it.

When I loaded an Eagle .BRD file, this is the last lines of the report view:

Importing layer 'Modules': 
    Layer is empty
    done
Total time: 56[s]
19:31:20  Running the Python command 'cmdPartAssignModel' failed:
Traceback (most recent call last):
  File "C:\Users\David\AppData\Roaming\FreeCAD\Mod\pcb\.\PCBcommands.py", line 60, in Activated
    dial = dodajElement()
           ^^^^^^^^^^^^^^
  File "C:\Users\David\AppData\Roaming\FreeCAD\Mod\pcb\.\command\PCBassignModel.py", line 890, in __init__
    self.modelsList.reloadList()
  File "C:\Users\David\AppData\Roaming\FreeCAD\Mod\pcb\.\command\PCBassignModel.py", line 835, in reloadList
    for i in self.sql.getAllModelsByCategory(0):
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\David\AppData\Roaming\FreeCAD\Mod\pcb\.\PCBdataBase.py", line 712, in getAllModelsByCategory
    return self.session.query(Models).filter(Models.categoryID == categoryID)
           ^^^^^^^^^^^^^^^^^^

'NoneType' object has no attribute 'query'Unhandled unknown exception caught in GUIApplication::notify.

Any chance this is easily resolvable?

marmni commented 2 days ago

Hi, I see a few errors/issues in the PCB module in FreeCAD v1, but overall the PCBs load. freecad_v1

Wiredhome commented 12 hours ago

My original post was poor - sorry about that. On that PC, I had installed FC 1.0.0RC2 over top of FC 0.21.2. I don't know if that contributed to what I saw - which was a rendered PCB, but no parts.

I moved to another PC, which I verified works fine with 0.21.2, and then installed FC 1.0.0RC2 into a separate path and tested it. Now I have results that match marmni.

FC 0.21.2 image

FC 1.0.0RC2 image

Here's the top lines followed by a break and then the bottom lines of the report view `09:20:37 The file was created in Eagle 7.7.0. 09:20:37 Read database 09:20:44
Initializing Generate board: done Generate holes: Part::FeaturePython: Link(s) to object(s) 'PCB_Holes' go out of the allowed scope 'Board'. Instead, the linked object(s) reside within 'N/A'. 09:20:46 done Importing parts: Package 'B12H1UYG-20D000134U1930' will be used for the element D1 (instead of 2-SMD_RA_LED). 09:20:46 Package 'B12H1USD-20D000234U1930' will be used for the element D3 (instead of 2-SMD_RA_LED). 09:20:46 Package 'B12H1UYG-20D000134U1930' will be used for the element D2 (instead of 2-SMD_RA_LED). 09:20:46 Package 'TP-Yellow' will be used for the element TP5 (instead of TP). 09:20:46 Package 'TP-Black' will be used for the element TP6 (instead of TP). 09:20:46 Package 'TP-Black' will be used for the element TP4 (instead of TP). 09:20:46 Package 'TP-Red' will be used for the element TP7 (instead of TP). 09:20:46 Package 'B12H1USD-20D000234U1930' will be used for the element D4 (instead of 2-SMD_RA_LED). 09:20:46 Package 'TP-Violet' will be used for the element MDC (instead of TP). 09:20:46 Package 'TP-White' will be used for the element MDIO (instead of TP). 09:20:46
C3 (C0402): pyException: Traceback (most recent call last): File "C:\Users\David\AppData\Roaming\FreeCAD\Mod\pcb.\PCBobjects.py", line 363, in onChanged vp.setEditorMode("ShapeColor", 2) <class 'AttributeError'>: Property container has no property 'ShapeColor' 09:20:46 pyException: Traceback (most recent call last): File "C:\Users\David\AppData\Roaming\FreeCAD\Mod\pcb.\PCBobjects.py", line 363, in onChanged vp.setEditorMode("ShapeColor", 2) <class 'AttributeError'>: Property container has no property 'ShapeColor' 09:20:46 pyException: Traceback (most recent call last): File "C:\Users\David\AppData\Roaming\FreeCAD\Mod\pcb.\PCBobjects.py", line 363, in onChanged vp.setEditorMode("ShapeColor", 2) <class 'AttributeError'>: Property container has no property 'ShapeColor' 09:20:46 pyException: Traceback (most recent call last): File "C:\Users\David\AppData\Roaming\FreeCAD\Mod\pcb.\PCBobjects.py", line 363, in onChanged vp.setEditorMode("ShapeColor", 2) <class 'AttributeError'>: Property container has no property 'ShapeColor' 09:20:46 pyException: Traceback (most recent call last): File "C:\Users\David\AppData\Roaming\FreeCAD\Mod\pcb.\PCBobjects.py", line 363, in onChanged vp.setEditorMode("ShapeColor", 2) <class 'AttributeError'>: Property container has no property 'ShapeColor' 09:20:46 done C37 (C0603): pyException: Traceback (most recent call last): File "C:\Users\David\AppData\Roaming\FreeCAD\Mod\pcb.\PCBobjects.py", line 363, in onChanged vp.setEditorMode("ShapeColor", 2) <class 'AttributeError'>: Property container has no property 'ShapeColor'


09:22:16 pyException: Traceback (most recent call last): File "C:\Users\David\AppData\Roaming\FreeCAD\Mod\pcb.\PCBobjects.py", line 363, in onChanged vp.setEditorMode("ShapeColor", 2) <class 'AttributeError'>: Property container has no property 'ShapeColor' 09:22:16 pyException: Traceback (most recent call last): File "C:\Users\David\AppData\Roaming\FreeCAD\Mod\pcb.\PCBobjects.py", line 363, in onChanged vp.setEditorMode("ShapeColor", 2) <class 'AttributeError'>: Property container has no property 'ShapeColor' 09:22:16 done** 09:22:16 Object not found: b'R5' RES 10K0 1% [Package: R0603, Library: USBtoT1] 09:22:16 Object not found: b'TP2' TPTP06R [Package: TP06R, Library: USBtoT1] 09:22:16 Object not found: b'TP3' TPTP06R [Package: TP06R, Library: USBtoT1] 09:22:16 Object not found: b'T1' [Package: FIDUCIAL, Library: USBtoT1] 09:22:16 Object not found: b'T2' [Package: FIDUCIAL, Library: USBtoT1] 09:22:16 Object not found: b'T3' [Package: FIDUCIAL, Library: USBtoT1] 09:22:16 Object not found: b'R33' RES 200R 1% [Package: R0603, Library: USBtoT1] 09:22:16 ** 09:22:16
Importing layer 'Annotations': done Importing layer 'Top': done // and from here on it is fine `

As a simple test, I simply commented out PCBobjects.py", line 363, and then PCBobjects.py", line 464 and tested again with each FC version. I'm assuming that both FC version use the same FreeCAD-PCB version in the AppData folder.

After commenting those two lines, restarting each version of FC, the presentation appears identical to me. Meaning - I saw no change that could obviously trace to the vp.setEditorMode("ShapeColor", 2) statements.

I tried to hunt down the 'setEditorMode' API to see what is allowed and what isn't, but I guess this goes deep into FC itself. I tried searching the FC documentation and the wiki, but came up empty - is there a site where I can learn enough to maybe try to understand what is happening? Then maybe I could attempt to help with a change request.

thanks!

I just came across a report of what looks like this same issue: https://forum.freecad.org/viewtopic.php?style=3&t=86778

marmni commented 9 hours ago

Hi, ShapeColor/DiffuseColor is not supported in FC_v1. From this version FC uses Material() - that's why there are so many errors (most of them). Previously, to set the surface color, it was necessary to create a tuple with R/G/B values ​​and save it in ViewObject.DiffuseColor. Since FC_1, it is necessary to create a Material object (one material per surface or one for the entire object) -> ViewObject.ShapeAppearance parameter.

vp.setEditorMode("ShapeColor", 2) -this simply hides the parameter/attribute in the 3D window (value 2). In FC_v1 it will be vp.setEditorMode("ShapeAppearance", 2).

Many changes will be necessary to make the module fully functional. However, there is light at the end of the tunnel ;) fc_1

Wiredhome commented 2 hours ago

That's a very positive looking note!