2 Replies Latest reply on Jul 18, 2017 2:05 PM by Matt Fisher

    Propagating new custom property in mirrored parts via macro

    Matt Fisher

      I have a situation where a new custom property is being added to our part files. Any existing mirrored part is not propagating the new property. I have found that if you edit the first feature in a mirrored part and click the check mark with the custom properties checkbox checked then the new property will propagate without having to re-mirror.

       

      The issue I'm having is that SolidWorks is crashing on swFeat.ModifyDefiniation. Any ideas?

       

                              ...

                              Set swCompModelDoc = swComp.GetModelDoc2

                              If swComp.IsMirrored <> 0 Then

                                  swComp.Select False

                                  swAss.EditPart

                                  swDoc.GraphicsRedraw2

                                  Set swFeat = swCompModelDoc.FirstFeature

                                  Do Until swFeat Is Nothing

                                      If swFeat.IsBase Then

                                          Set mirrorFeatData = swFeat.GetDefinition

                                          mirrorFeatData.AccessSelections swCompModelDoc, Nothing

                                          'mirrorFeatData.ReleaseSelectionAccess

                                          swFeat.ModifyDefinition mirrorFeatData, swCompModelDoc, Nothing

                                          Set mirrorFeatData = Nothing

                                          Exit Do

                                      End If

                                      Set swFeat = swFeat.GetNextFeature

                                  Loop

                                  swAss.EditAssembly

                                  swDoc.ClearSelection

                              End If