Skip to content

fix #658 Fail to import FCStd containing assembly workbench#659

Open
nodtem66 wants to merge 1 commit intokbwbe:masterfrom
nodtem66:nodtem66_issue658
Open

fix #658 Fail to import FCStd containing assembly workbench#659
nodtem66 wants to merge 1 commit intokbwbe:masterfrom
nodtem66:nodtem66_issue658

Conversation

@nodtem66
Copy link
Copy Markdown

A FCStd file may contain the assembly workbench which A2Plus fails to import.
This PR adds the exclusion rules in a2plib.filterShapeObs to filter assembly objects.

Detail

The testing FCStd file could be found here: Test_exclude_assembly.FCStd.txt
It contains a cube and an assembly, shown below.
image

Step to reproduce an error

  • A2Plus > Add a part from external file (a2p_ImportPart)
  • Select Test_exclude_assembly.FCStd
  • The report panel will show the error:
Running the Python command 'a2p_ImportPart' failed:
Traceback (most recent call last):
  File "C:\Users\User\AppData\Roaming\FreeCAD\v1-1\Mod\A2plus\.\a2p_importpart.py", line 725, in Activated
    importedObject = importPartFromFile(doc, filename)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Roaming\FreeCAD\v1-1\Mod\A2plus\.\a2p_importpart.py", line 372, in importPartFromFile
    topoMapper.createTopoNames()
  File "C:\Users\User\AppData\Roaming\FreeCAD\v1-1\Mod\A2plus\.\a2p_topomapper.py", line 640, in createTopoNames
    shapeCol = ob.Color
               ^^^^^^^^

'App.DocumentObject' object has no attribute 'Color'

Workaround

  1. My idea to fix this issue is using TypeId to filter out the assembly objects Assembly::AssemblyObject.
  2. Checking the TypeId == Assembly::* does not filter the Body002 and Body003 (which are App::Link in Assembly). We also need to check the parents of the objects. If any of them is Assembly, the object will be excluded.

Any feedback or comment is welcomed.

add the exclusion rules in `a2plib.filterShapeObs` to filter assembly objects.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant