Hide a sketch in a part

Top  Previous  Next

You can yse this function:

 

 

void HidePartSketchByName (CComPtr<PartComponentDefinition>& pPartCompDef, const wchar_t* const pszName)

{

   // Get the list of sketches...

   CComPtr<PlanarSketches> pSketchesList ;

   HRESULT hRes = pPartCompDef->get_Sketches(&pSketchesList) ;

   if (FAILED(hRes)) {

       ShowCOMError(hRes,L"HPSBN (%s) get_Features failed",pszName);

       return ;

   }

 

   CComPtr<PlanarSketch> pSketch  ;

   hRes = pSketchesList->get_Item (CComVariant(pszName),&pSketch) ;

   if (FAILED(hRes)) {

       gLogger.Printf(ekLogMsg, L"HPSBN (%s) get_Item failed, sketch has already been deleted maybe", pszName);

       return ;

   }

 

   pSketch->put_Visible (VARIANT_FALSE) ;

}

 

 

 

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