Menu

#63 Create a simplified model update fails badly

All
open
Mariusz
Update_2 (1)
2021-12-09
2021-12-09
David Smart
No

Hi Marni,
I saw the notice of the new feature. This morning, from w/in FreeCAD 0.19, it used the add-on manager to update PCB.
Upon restart, something went wrong.
It had no toolbars.
I selected the PCB from the pulldown menu, and even then, the PCB toolbars did not show up.
* I tried selecting other Workbenches and those toolbars appeared.

The report window shows what went wrong

08:42:02  cannot import name 'createBoxForModel' from 'command.PCBboundingBox' (C:\Users\David\AppData\Roaming\FreeCAD\Mod\pcb\command\PCBboundingBox.py)

In trying to help sort this out, I downloaded Update_2.zip (posted yesterday) and compared it to my active files - the source files are an exact match.

From the report, I looked into PCBboundingBox.py. I see there are 3 functions:
createBox
boundingBox
* boundingBoxFromSelection
but there is no createBoxForModel method.

After a search, I also found in PCBcreateSimplifiedModel.py:

[line 31] from command.PCBboundingBox import createBoxForModel
[line 49]         obj = createBoxForModel(i)

It looks like the 3 instances of 'createBox', in PCBboundingBox.py should be named to 'createBoxForModel'?
I applied that change locally, and when I restarted FreeCAD 0.19, my toolbars are restored and there is no error message in the Report view.

After this small code-change, FreeCAD & PCB work as they did before, and the new feature to create a simplified model is in the menu.


But, when I tried the "Create a simplified model" on a randomly selected, moderately complex, and incomplete design, and it failed, so perhaps my proposal is wrong.

09:35:13  Traceback (most recent call last):
09:35:13    File "C:\Users\David\AppData\Roaming\FreeCAD\Mod\pcb\PCBtoolBar.py", line 841, in createSimplifiedModelF
09:35:13      createSimplifiedModel()
09:35:13    File "C:\Users\David\AppData\Roaming\FreeCAD\Mod\pcb\command\PCBcreateSimplifiedModel.py", line 49, in createSimplifiedModel
09:35:13      obj = createBoxForModel(i)
09:35:13    File "C:\Users\David\AppData\Roaming\FreeCAD\Mod\pcb\command\PCBboundingBox.py", line 33, in createBoxForModel
09:35:13      if len(parts):
09:35:13  TypeError: object of type 'FeaturePython' has no len()

I also tried this command on a simple, and complete design, and it too failed with the same report view message.

Discussion

  • Mariusz

    Mariusz - 2021-12-09

    Hi,
    thanks for the info - it should work now. I forgot to upload new version of "PCBboundingBox.py" :).

     
  • David Smart

    David Smart - 2021-12-09

    Updated from the addon manager, restarted, Confirmed working - menus, toolbars, and the new feature!

    Thanks!

     

Anonymous
Anonymous

Add attachments
Cancel