Creating Reference Planes

Hi, this has me stumped.

I'm trying to use a macro to create a place concident to a 3D sketch and perpendicular to another plane.

Here's the code fragment

    

                Dim skSegment As Object

                Dim myRefPlane As refplane

                skmanager.insert3dsketch(True)

                sksegment = skmanager.createline(1, 1, 1, 2, 2, 2)                                                                            ' create a line in the 3D sketch

                skmanager.insert3dsketch(True)

                boolstatus = swExt.SelectByID2("", "EXTSKETCHSEGMENT", 1.5, 1.5, 1.5, False, 0, Nothing, 0)        ' select the line segment by picking at it's mid point

                boolstatus = swExt.SelectByID2("Right", "PLANE", 0, 0, 0, True, 0, Nothing, 0)                                  ' select the right plane

                myRefPlane = part.FeatureManager.InsertRefPlane(4, 0, 2, 0, 0, 0)                                          ' create a place concident to the line and perpendicular to the right plane

It all appears to work, right up to the point where it creates the plane, where it doesn't appear to do anything.  If I step through the code, the sketch and plane highlight and boolstatus returns true, so I believe they're being selected correctly.

The above code fragment is based in part on a recorded macro, the interesting thing is, if I replay the macro it doesn't work either !

SolidworksApi macros