Zolko-123 / FreeCAD_Assembly4

Assembly 4 workbench for FreeCAD
GNU Lesser General Public License v2.1
280 stars 76 forks source link

Mirror ASM4 object --> configuration cannot be saved #474

Closed zisoft closed 3 months ago

zisoft commented 6 months ago

I use the ASM4 mirror command quite often, as well as configurations to create exploded views of my assemblies.

Now I ran into a problem when the mirrored object itself is a subassambly (another ASM4 object). When I try to save a configuration an error is thrown:

Traceback (most recent call last):
  File "/Users/mario/Library/Application Support/FreeCAD/Mod/Assembly4/./configurationEngine.py", line 324, in onOK
    SaveConfiguration( confName, confDescr )
  File "/Users/mario/Library/Application Support/FreeCAD/Mod/Assembly4/./configurationEngine.py", line 419, in SaveConfiguration
    SaveSubObjects(conf, assy)            
  File "/Users/mario/Library/Application Support/FreeCAD/Mod/Assembly4/./configurationEngine.py", line 428, in SaveSubObjects
    SaveObject(conf, obj)
  File "/Users/mario/Library/Application Support/FreeCAD/Mod/Assembly4/./configurationEngine.py", line 467, in SaveObject
    offset = obj.AttachmentOffset
AttributeError: 'FeaturePython' object has no attribute 'AttachmentOffset'

It works if I give the mirror an attachment offset (just by clicking "Edit placement of a part").

I could fix it by inserting

Asm4.makeAsmProperties(obj)

at line 212 in file makeArrayCmd.py. Now the mirror automatically gets the AttachmentOffset property, but I'm not sure if this would be the correct solution?

Zolko-123 commented 3 months ago

I applied your fix but I forgot to thank-you. This can be closed