admin 发表于 2014-2-27 21:06:17

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();
}









admin 发表于 2014-2-27 21:06:24




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

shesng 发表于 2014-3-17 20:19:51

看看想想,学习学习

静水康桥 发表于 2014-4-13 12:43:38

好好学习天天向上

skyflyew 发表于 2014-4-15 17:42:41

好东西啊!!

☠寶∞爺☠ 发表于 2014-4-21 11:34:03

谢谢老大了,学习了!

等待花开 发表于 2014-4-22 10:51:19

在找35的视频....

东沟恋君 发表于 2014-4-23 19:20:24

好视频,顶起来

C_X_J 发表于 2014-4-25 09:26:14

学习学习。。。

★害虫★ 发表于 2014-5-5 18:55:37

正在学习中,谢谢。
页: [1] 2 3 4 5 6 7 8 9
查看完整版本: PLM之家-NX9.0 二次开发实例视频33 NXOpen C++创建旋转特征