PLM之家-NX9.0 二次开发实例视频32 NXOpen C++创建拉伸特征
PLM之家-NX9.0 二次开发实例视频32 NXOpen C++创建拉伸特征内容:
通过草图创建拉伸操作
目的:
在NX中,使用NXOpen C++可以很方便的进行JA的录制,草图的拉伸可以通过JA生成代码,此处拉伸草图的方向为草图的法相方向。需要用户输入拉伸的起始值和结束值。草图创建过程中主要是对section进行定义,在定义的时候需要考虑到选择意图selectionRule的定义。
关键代码分享:
<font size="5">
</font>
<font size="5">void lesson32_createExtrude::createExtrude(Sketch *sketch)
{
Features::Feature *nullFeatures_Feature(NULL);
Features::ExtrudeBuilder *extrudeBuilder1;
extrudeBuilder1 = workPart->Features()->CreateExtrudeBuilder(nullFeatures_Feature);
// set parameters
// create section Start
Section * section;
section = workPart->Sections()->CreateSection();
extrudeBuilder1->SetSection(section);
CurveFeatureRule *curveFeatureRule1;
std::vector<Features::Feature *> Rulefeatures(1);
Rulefeatures = sketch->Feature();
curveFeatureRule1 = workPart->ScRuleFactory()->CreateRuleCurveFeature(Rulefeatures);
std::vector<SelectionIntentRule *> rules(1);
rules = curveFeatureRule1;
NXObject *nullNXObject(NULL);
Point3d helpPoint1(0, 0, 0);
section->AddToSection(rules, nullNXObject, nullNXObject, nullNXObject, helpPoint1, Section::ModeCreate, false);
// create section End
Direction *direction;
direction = workPart->Directions()->CreateDirection(sketch,SenseForward,SmartObject::UpdateOptionWithinModeling);
extrudeBuilder1->SetDirection(direction);
// get the UI value
double startValue = this->expExtrudeStart->GetProperties()->GetDouble("Value");
double endValue = this->expExtrudeEnd->GetProperties()->GetDouble("Value");
stringstream s_startValue,s_endValue;
s_startValue <<startValue;
s_endValue <<endValue;
extrudeBuilder1->Limits()->StartExtend()->SetValue(s_startValue.str());
extrudeBuilder1->Limits()->EndExtend()->SetValue(s_endValue.str());
// commit feature
extrudeBuilder1->CommitFeature();
extrudeBuilder1->Destroy();
}</font>
PLM之家NX9.0二次开发视频教程 32 NXOpen C++创建拉伸草图(1)项目创建
http://player.youku.com/player.php/sid/XMzA5NDAzNTg2NA==/v.swf
PLM之家NX9.0二次开发视频教程 32 NXOpen C++创建拉伸草图(2)创建过程分析
http://player.youku.com/player.php/sid/XMzA5NDAzNjM3Mg==/v.swf
PLM之家NX9.0二次开发视频教程 32 NXOpen C++创建拉伸草图(3)拉伸创建完成
http://player.youku.com/player.php/sid/XMzA5NDA0MTYxNg==/v.swf
期待 ing 已经更新了 谢谢分享 voila ,so beautiful 好视频,顶起来 学习学习学习 怎么没B语言呀。 正在学习,学习。