Reversing Reference plane direction (API)
Reversing Reference plane direction (API)
(OP)
Does anyone know how to change the direction of a reference plane. I have a reference plane (say "Plane4") that I would like to reverse direction. It will always be this plane so I would prefer to reference it directly eg SelectByID.
I can't even find any help by recording a macro of the process, as when run it creates a new plane instead of modifying it.
I can't even find any help by recording a macro of the process, as when run it creates a new plane instead of modifying it.






RE: Reversing Reference plane direction (API)
Feature.GetDefinition
RefPlaneFeatureData.AccessSelections
RefPlaneFeatureData::ReverseDirection
RefPlaneFeatureData::ReleaseSelectionAccess
From Help > SolidWorks API Help Topics, look under:
SolidWorks Objects
Feature Objects
Reference Geometry
RefPlaneFeatureData
DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
RE: Reversing Reference plane direction (API)
My only hint, use Set lots!
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
'This sets the handle for the plane and gets back it's definition.
Set PlaneFeature = Part.FeatureByName("Insert your plane name here")
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
'This finds out what flip is and changes it
If flip Then
flip = False
Else
flip = True
End If
'This re-enters the infor into the feature definition, updates the feature definition and then closes the access (rolls down).
Plane_DEF.ReverseDirection = flip
PlaneObject.ModifyDefinition Plane_DEF, Part, Nothing
Plane_DEF.ReleaseSelectionAccess
End Sub
RE: Reversing Reference plane direction (API)