'How to create a "flip offset" reference plane with Solidworks VBA/API

I am trying to create two parallel reference planes equidistant from the origin. I am able to create the positive plane with:

Dim swDoc As SldWorks.ModelDoc2
Dim distance As Double
Dim BoolStatus As Boolean
Dim swLeftFace As SldWorks.RefPlane
Dim swRightFace As SldWorks.RefPlane

BoolStatus = swDoc.Extension.SelectByID2("Right Plane", "PLANE", 0, 0, 0, False, 0, Nothing, swSelectOption_e.swSelectOptionDefault)
Set swRightFace = swDoc.FeatureManager.InsertRefPlane(swRefPlaneReferenceConstraints_e.swRefPlaneReferenceConstraint_Distance, distance, 0, 0, 0, 0)

However, I cannot create the negative plane. When "distance" is negative, it is evaluated as 0. This creates a plane coincident with the origin. I have tried a few variations with "swRefPlaneReferenceConstraint_OptionFlip" constraint, but the documentation is very poor and it either:

Fails to create a plane

BoolStatus = swDoc.Extension.SelectByID2("Right Plane", "PLANE", 0, 0, 0, False, 0, Nothing, swSelectOption_e.swSelectOptionDefault)
Set swLeftFace = swDoc.FeatureManager.InsertRefPlane(swRefPlaneReferenceConstraints_e.swRefPlaneReferenceConstraint_OptionFlip, distance, 0, 0, 0, 0)

or creates a plane with a positive offset, coincident with the first reference plane. This occurs for X=-1, X=0, and X=1.

BoolStatus = swDoc.Extension.SelectByID2("Right Plane", "PLANE", 0, 0, 0, False, 0, Nothing, swSelectOption_e.swSelectOptionDefault)
Set swRightFace = swDoc.FeatureManager.InsertRefPlane(swRefPlaneReferenceConstraints_e.swRefPlaneReferenceConstraint_Distance, distance, 0, 0, 0, 0)
BoolStatus = swDoc.Extension.SelectByID2("Right Plane", "PLANE", 0, 0, 0, False, 0, Nothing, swSelectOption_e.swSelectOptionDefault)
Set swLeftFace = swDoc.FeatureManager.InsertRefPlane(swRefPlaneReferenceConstraints_e.swRefPlaneReferenceConstraint_Distance, distance, swRefPlaneReferenceConstraints_e.swRefPlaneReferenceConstraint_OptionFlip, X, 0, 0)


Solution 1:[1]

The options need to be added like this:

Set swRightFace = swDoc.FeatureManager.InsertRefPlane(swRefPlaneReferenceConstraints_e.swRefPlaneReferenceConstraint_Distance + swRefPlaneReferenceConstraints_e.swRefPlaneReferenceConstraint_OptionFlip, distance, 0, 0, 0, 0)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 JeromeP