PLM之家-NX9.0 二次开发实例视频33 NXOpen C++创建旋转特征
PLM之家-NX9.0 二次开发实例视频33 NXOpen C++创建旋转特征内容:
通过草图创建旋转操作
目的:
在NX中,使用NXOpen C++可以很方便的进行JA的录制,草图的旋转可以通过JA生成代码,此处旋转草图的轴通过界面选取,可以设置旋转的角度。代码需要显式设定公差选项SetTolerance(0.001)
PLM之家-NX9.0二次开发实例33 NXOpen C++创建旋转草图(1)创建项目
PLM之家-NX9.0二次开发实例33 NXOpen C++创建旋转草图(2)代码分析
PLM之家-NX9.0二次开发实例33 NXOpen C++创建旋转草图(3)截面代码定义
PLM之家-NX9.0二次开发实例33 NXOpen C++创建旋转草图(4)UI关联
关键代码分享:
void lesson33_createRevolve::createRevolve(Sketch *sketch)
{
Features::Feature *nullFeatures_Feature(NULL);
Features::RevolveBuilder *revolveBuilder1;
revolveBuilder1 = workPart->Features()->CreateRevolveBuilder(nullFeatures_Feature);
revolveBuilder1->SetTolerance(0.001);
Section *section1;
section1 = workPart->Sections()->CreateSection(0.00095, 0.001, 0.05);
revolveBuilder1->SetSection(section1);
std::vector<Features::Feature *> features1(1);
features1 = sketch->Feature();
CurveFeatureRule *curveFeatureRule1;
curveFeatureRule1 = workPart->ScRuleFactory()->CreateRuleCurveFeature(features1);
std::vector<SelectionIntentRule *> rules1(1);
rules1 = curveFeatureRule1;
NXObject *nullNXObject(NULL);
Point3d helpPoint1(0, 0, 0);
section1->AddToSection(rules1, nullNXObject, nullNXObject, nullNXObject, helpPoint1, Section::ModeCreate, false);
revolveBuilder1->SetSection(section1);
// get UI value
vector<TaggedObject*> selectedObjects = this->axis0->GetProperties()->GetTaggedObjectVector("SelectedObjects");
Axis *axis1 = dynamic_cast<Axis *>(selectedObjects);
revolveBuilder1->SetAxis(axis1);
double startValue = this->expStartAngle->GetProperties()->GetDouble("Value");
double endValue = this->expStartAngle1->GetProperties()->GetDouble("Value");
stringstream s_startValue,s_endValue;
s_startValue <<startValue;
s_endValue <<endValue;
revolveBuilder1->Limits()->StartExtend()->Value()->SetRightHandSide(s_startValue.str());
revolveBuilder1->Limits()->EndExtend()->Value()->SetRightHandSide(s_endValue.str());
Features::Feature *feature1;
feature1 = revolveBuilder1->CommitFeature();
revolveBuilder1->Destroy();
section1->Destroy();
}
PLM之家NX9.0二次开发视频教程 33 NXOpen C++创建旋转草图(1)创建项目
http://player.youku.com/player.php/sid/XMzA5NDA0MTcxMg==/v.swf
PLM之家NX9.0二次开发视频教程 33 NXOpen C++创建旋转草图(2)代码分析
http://player.youku.com/player.php/sid/XMzA5NDA0MjM2OA==/v.swf
PLM之家NX9.0二次开发视频教程 33 NXOpen C++创建旋转草图(3)截面代码定义
http://player.youku.com/player.php/sid/XMzA5NDA1MjQ0OA==/v.swf
PLM之家NX9.0二次开发视频教程 33 NXOpen C++创建旋转草图(4)UI关联
http://player.youku.com/player.php/sid/XMzA5NDA0Njk1Ng==/v.swf
看看想想,学习学习 好好学习天天向上 好东西啊!! 谢谢老大了,学习了! 在找35的视频.... 好视频,顶起来 学习学习。。。 正在学习中,谢谢。