×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Reversing Reference plane direction (API)

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.

RE: Reversing Reference plane direction (API)

From the Feature, you'll use these methods:

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)

I've had a bit of a bash at this sort of thing for work. It sounds like you are having very similar problems with the incomprehensibly incomplete help files available. In truth I only got this going through trial and error!

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)

(OP)
Thankyou very much.  The solution works.  Who would have thought that so many set commands were required.  

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources