Plane object, getting its geometry

Top  Previous  Next

Here is how to get it from a proxy inside an assembly, but you can use a similar function for a real WorkPlane.

 

// This will get you the point and the normal which define the workplane

void GetWorkPlaneProxyData(CVec& vecRoot, CVec& vecNormal, CComPtr<WorkPlaneProxy>& pWorkPlaneProxy)

{

   double RootCoords[3];

   SAFEARRAY* pRootArray = CreateSafeDoubleArray(3, RootCoords) ;

 

   double NormalCoords[3];

   SAFEARRAY* pNormArray = CreateSafeDoubleArray(3, NormalCoords) ;

 

   pWorkPlaneProxy->Plane->GetPlaneData(&pRootArray,&pNormArray);

 

   for (LONG i = XI ; i <= ZI; i++) {

       LONG rgIndex = i;

       double Root = 0;

       SafeArrayGetElement(pRootArray, &rgIndex, &Root);

       vecRoot.SetVal(i, Root);

 

       double Norm = 0;

       SafeArrayGetElement(pNormArray, &rgIndex, &Norm);

       vecNormal.SetVal(i, Norm);

   }

 

   SafeArrayDestroy(pRootArray);

   SafeArrayDestroy(pNormArray);

}

 

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