This code crash systematically SolidWorks:
Dim swApp As SldWorks.SldWorks<br><br>Sub main()<br> Set swApp = Application.SldWorks<br><br> Dim swRootModel As SldWorks.ModelDoc2: Set swRootModel = swApp.ActiveDoc<br> Dim i As Integer<br> Dim swFeat As SldWorks.Feature<br> Dim swMirrorFeat As SldWorks.MirrorPartFeatureData<br><br> If swRootModel Is Nothing Then Exit Sub<br><br> For i = 0 To swRootModel.GetFeatureCount - 1<br> Set swFeat = swRootModel.FeatureByPositionReverse(i)<br><br> If Not swFeat Is Nothing Then<br> 'Debug.Print swFeat.Name & " [" & swFeat.GetTypeName & " / " & swFeat.GetTypeName2 & "]"<br> If swFeat.GetTypeName = "MirrorStock" Then<br> Debug.Print "[*] NAME: " & swFeat.Name<br><br> Set swMirrorFeat = swFeat.GetDefinition<br> If Not swMirrorFeat Is Nothing Then<br> Debug.Print " [*] AbsorbedSketches : " & swMirrorFeat.AbsorbedSketches<br> Debug.Print " [*] Axes : " & swMirrorFeat.Axes<br> Debug.Print " [*] CoordinateSystems : " & swMirrorFeat.CoordinateSystems<br> Debug.Print " [*] CosmeticThreads : " & swMirrorFeat.CosmeticThreads<br> Debug.Print " [*] CustomProperties : " & swMirrorFeat.CustomProperties<br> Debug.Print " [*] CutListProperties : " & swMirrorFeat.CutListProperties<br> Debug.Print " [*] DimXpertAnnotations : " & swMirrorFeat.DimXpertAnnotations<br> Debug.Print " [*] HoleWizardData : " & swMirrorFeat.HoleWizardData<br> Debug.Print " [*] ModelDimensions : " & swMirrorFeat.ModelDimensions<br> Debug.Print " [*] PathName : " & swMirrorFeat.PathName<br> Debug.Print " [*] Planes : " & swMirrorFeat.Planes<br> Debug.Print " [*] SheetMetalInformation: " & swMirrorFeat.SheetMetalInformation<br> Debug.Print " [*] SolidBodies : " & swMirrorFeat.SolidBodies<br> Debug.Print " [*] SurfaceBodies : " & swMirrorFeat.SurfaceBodies<br> Debug.Print " [*] UnabsorbedSketches : " & swMirrorFeat.UnabsorbedSketches<br> Debug.Print " [*] UnlockedProperties : " & swMirrorFeat.UnlockedProperties<br><br> 'swMirrorFeat.AbsorbedSketches = False<br> 'swMirrorFeat.Axes = False<br> 'swMirrorFeat.CoordinateSystems = False<br> 'swMirrorFeat.CosmeticThreads = False<br> 'swMirrorFeat.CustomProperties = False<br> 'swMirrorFeat.CutListProperties = False<br> 'swMirrorFeat.DimXpertAnnotations = False<br> 'swMirrorFeat.HoleWizardData = False<br> 'swMirrorFeat.ModelDimensions = False<br> 'swMirrorFeat.PathName<br> 'swMirrorFeat.Planes = False<br> 'swMirrorFeat.SheetMetalInformation = False<br> 'swMirrorFeat.SolidBodies<br> 'swMirrorFeat.SurfaceBodies = False<br> 'swMirrorFeat.UnabsorbedSketches = False<br> 'swMirrorFeat.UnlockedProperties<br><br> swMirrorFeat.AccessSelections swRootModel, Nothing<br> swFeat.ModifyDefinition swMirrorFeat, swRootModel, Nothing<br> swMirrorFeat.ReleaseSelectionAccess<br><br> 'swFeat.Select2 False, 0<br> 'Set swFeat = swRootModel.SelectionManager.GetSelectedObject6(1, -1)<br> 'Set swMirrorFeat = swFeat.GetDefinition<br> 'swMirrorFeat.AccessSelections swRootModel, Nothing<br> 'swFeat.ModifyDefinition swMirrorFeat, swRootModel, Nothing<br> 'swMirrorFeat.ReleaseSelectionAccess<br><br> Exit Sub<br> End If<br> End If<br> End If<br> Next i<br>End Sub<br><span class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span>The problem is this line:
swFeat.ModifyDefinition swMirrorFeat, swRootModel, Nothing<span class="line-numbers-rows"><span></span></span>There is a method to update Mirrored Part ?
Thanks.
SolidworksApi/macros