AddByPlaneAndOffset example

Top  Previous  Next

Here is an example of creating an offset workplane from a standard workplane, then setting it's name and making it visible in the assembly in which it exists:



       CComPtr<WorkPlanes> pWorkPlanesList;

       hRes = pPartCompDef->get_WorkPlanes(&pWorkPlanesList);


       CComPtr<WorkPlane> pCorpoCollXYWorkPlane;

       GetStdWorkPlaneByIndex(pCorpoCollXYWorkPlane, gikXYPlaneIndex, pPartCompDef);


       CComPtr<WorkPlane> pOffsetWorkPlane;


       const double kcmOffsetIn = 5.50; // 55mm


       hRes = pWorkPlanesList->AddByPlaneAndOffset(pCorpoCollXYWorkPlane,  // "starting" plane

                                                   CComVariant (55.0),     // how much to offset

                                                   VARIANT_FALSE,          // Construction?

                                                   &pOffsetWorkPlane);     // Return value of this call

       if (SUCCEEDED(hRes)) {

           // Set the name so it is easily found by other parts of the program...

           pOffsetWorkPlane->Name = L"TuboIntBase";


           // Export the feature so it is accessible in assemblies...

           pOffsetWorkPlane->Exported = VARIANT_TRUE;





Text, images and diagrams © 2021 Owen F. Ransen. All rights reserved. (But copy the source code as much as you want!)