GetWorkPlaneName GetOccurrenceName

Top  Previous  Next

These two functions are useful when your constraints do not work:

 

CString GetWorkPlaneName(CComPtr<WorkPlane>& pWorkPlaneA)

{

   CString csWPName;

 

   if (pWorkPlaneA != nullptr) {

       csWPName = CString(pWorkPlaneA->Name.GetBSTR());

   }

 

   return csWPName;

}

 

/**********************************************************************************************/

 

// This actually gets the name of the document being referenced by the occurrence

// It could be something like "3312345.IPT"

CString GetOccurrenceName(CComPtr<ComponentOccurrence>& pOcc)

{

   CString csOccName ;

 

   if (pOcc != nullptr) {

       CComPtr<ReferencedFileDescriptor> pRefFileDesc = pOcc->ReferencedFileDescriptor ;

       CComBSTR bstrAName;

       pRefFileDesc->get_DisplayName (&bstrAName) ;

       csOccName = CString (bstrAName) ;

   }

 

   return csOccName;

}

 

/**********************************************************************************************/

 

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