admin 发表于 2017-10-23 14:14:41

NX二次开发源码分享:循环查找所有的图纸并更新视图


NX二次开发源码分享:循环查找所有的图纸并更新视图

NXOpen C++的方式,其实很简单,看看吧!


    //Getting Drawing sheets into collection of the workpart
    Drawings::DrawingSheetCollection *drawingsheets = workPart->DrawingSheets();
    Drawings::DrawingSheetCollection::iterator it;
    Drawings::DrawingSheet *mysheet;

    /*----------------------------------------------
   Here we loop through all the sheets in the part.
   For each sheet, we open the sheet, update all views in it,
   And then pop-up a message box listing the
   views on the sheet.This could be modified to plot out
   the sheets instead.
   ----------------------------------------------*/
    for(it=drawingsheets->begin();it!=drawingsheets->end();it++)
    {

      mysheet = *it;
      mysheet->Open();
      // ----------------------------------------------
      //   Menu: Edit->View->Update Views...
      // ----------------------------------------------
      theSession->;Parts()->Work()->DraftingViews()->UpdateViews(Drawings::DraftingViewCollection::ViewUpdateOptionAll,mysheet);

}
页: [1]
查看完整版本: NX二次开发源码分享:循环查找所有的图纸并更新视图