使用NXOpen C++创建和编辑特征的详细过程,一看就会!
Create a New Feature 创建NXfeature的标准过程
1.Create an instance of the builder object for the desired feature type providing a null object as input.
创建一个builder实例,null作为输入
2.Edit the properties of the builder object to set the feature parameters and options.
编辑创建的builder,设置一些参数或者选项
3.Use the Commit method of the builder object to create an instance of the feature.The Commit method will return the new feature object.
使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象
4.Use the Destroy method of the builder object to delete the builder object.
使用destory方法删除builder对象。
编辑特征也是同样的操作过程!
代码举例:
Session *NXSession = Session::GetSession();
Part *workPart (NXSession->Parts()->Work());
Feature *nullFeature (NULL);
Point3d origin = new Point3d(0.0, 0.0, 0.0);
//**************************************************************************
//CREATE BLOCK 创建方块
BlockFeatureBuilder *newBlock = NULL;
newBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature);
newBlock->SetOriginAndLengths(origin, "50", "80", "100");
Feature *blockFeature = newBlock->CommitFeature();
newBlock->Destroy();
//**************************************************************************
//EDIT BLOCK 编辑方块
BlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature);
oldBlock->SetOriginAndLengths(origin, "100", "20", "50");
oldBlock->CommitFeature();
oldBlock->Destroy();
页:
[1]