首页 > 其他 > 详细

NXOpen 创建工程图

时间:2021-03-28 13:01:52      阅读:41      评论:0      收藏:0      [点我收藏+]

VS2010 NX8.5

 

UF_initialize();

char msg[256];
int ModuleId = 0;
int button_id1 = 0;

UF_ask_application_module(&ModuleId);//获取当前所在的模块

FileNew *fileNewDrawing;
fileNewDrawing = theSession->Parts()->FileNew();
fileNewDrawing->SetTemplateFileName("A3_YN_horizontal.prt");//模板名称
fileNewDrawing->SetApplication(FileNewApplicationDrafting);
fileNewDrawing->SetUnits(Part::UnitsMillimeters);
fileNewDrawing->SetRelationType("");
fileNewDrawing->SetUsesMasterModel("Yes");
fileNewDrawing->SetTemplateType(FileNewTemplateTypeItem);
fileNewDrawing->SetNewFileName("D:\Alan-work\YN35678-2-001_dwg1.prt");//设置新建加工图的全路路径
fileNewDrawing->SetMasterFileName("YN35678-2-001");//要创建图纸的部件
fileNewDrawing->SetUseBlankTemplate(false);
fileNewDrawing->SetMakeDisplayedPart(true);
NXObject *nXObject1;
nXObject1 = fileNewDrawing->Commit();

workPart = theSession->Parts()->Work();
displayPart = theSession->Parts()->Display();

fileNewDrawing->Destroy();

Drawings::DrawingSheet *drawingSheet1(dynamic_cast<Drawings::DrawingSheet *>(workPart->DrawingSheets()->FindObject("SHT1")));
drawingSheet1->Open();

workPart->Drafting()->SetTemplateInstantiationIsComplete(true);

if ( ModuleId != 1)
{
theUI->MenuBarManager()->ApplicationSwitchRequest("UG_APP_DRAFTING");//切换到工程图模块
}

UF_terminate();

 

技术分享图片

NXOpen 创建工程图

原文:https://www.cnblogs.com/hqsalanhuang/p/14587841.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!