I found this API online, but I can't get it to work with SolidWorks 2012 or in my assembly for some reason. I've played around with it, but no luck. I get no errors when it runs, but it doesn't ever flip the reference plane that I made.
I am trying to select a plane FrontOffsetPlane and have it flip the mate direction.
If anyone can tell me what I'm doing wrong, I would be very appreciative. Thanks!
Here is my current code:
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Dim boolstatus As Boolean
'This sets the handle for the plane and gets back it's definition.
Set PlaneFeature = Part.FeatureByName("FrontOffsetPlane")
Set PlaneObject = PlaneFeature.GetSpecificFeature
Set Plane_DEF = PlaneFeature.GetDefinition
'This turns on the access to the feature (rolling back)
Plane_DEF.AccessSelections Part, Nothing
Flip = Plane_DEF.ReverseDirection
Debug.Print Flip
'This finds out what flip is and changes it
If Flip Then
Flip = False
Else
Flip = True
End If
Debug.Print Flip
'This re-enters the infor into the feature definition, updates the feature definition and then closes the access (rolls down).
Plane_DEF.ReverseDirection = Flip
boolstatus = PlaneObject.ModifyDefinition(Plane_DEF, Part, Nothing)
Plane_DEF.ReleaseSelectionAccess
Part.EditRebuild3
End Sub
SolidworksApi macros