【PLM之家-NX9.0二次开发实例视频】17 Block Styler创建圆柱体...
【PLM之家-NX9.0二次开发实例视频】17 Block UI创建圆柱体特征
本视频主要讲解,圆柱体的特征创建,以及使用Block UI中的点,矢量构造器进行获取用户的输入,通过使用表达式控件获取圆柱体的直径和高度值,从而创建一个圆柱体的过程!
视频中设计到控件的使用,赋值,对话框UI的创建。
特征的创建方法基本上相同,通常情况下,创建一个空的特征,构建一个featuresbuilder,通过这个featurebuilder进行相关值的指定,最后通过commit进行特征或者对象的创建!
视频分三部分:
PLM之家-NX9.0二次开发实例 17 Block UI创建圆柱体特征(1)对话框设计
PLM之家-NX9.0二次开发实例 17 Block UI创建圆柱体特征(2)获取UI值
PLM之家-NX9.0二次开发实例 17 Block UI创建圆柱体特征(3)程序创建完成
关键代码分享:
<p>
//get the UI values;
NXString diameterString,heightString;
std::stringstream ssdia,ssheight;
// get vector
BlockStyler::PropertyList *vectorProperty = vector0->GetProperties();
Vector3d vec = vectorProperty->GetVector("Vector");
delete vectorProperty;
vectorProperty = NULL;</p><p>// get point
BlockStyler::PropertyList *pointProperty = point0->GetProperties();
Point3d point = pointProperty->GetPoint("Point");
delete pointProperty;
pointProperty = NULL;</p><p>// get diameter
BlockStyler::PropertyList *diaProperty = expressionDia->GetProperties();
doubledia = diaProperty->GetDouble("Value");
delete diaProperty;
diaProperty = NULL;</p><p>
//get height</p><p>BlockStyler::PropertyList *hProperty = expressionH->GetProperties();
doubleheight = hProperty->GetDouble("Value");
delete hProperty;
hProperty = NULL;</p><p>//convert values to string
ssdia << dia;
diameterString = ssdia.str();</p><p>ssheight << dia;
heightString = ssdia.str();</p><p>//create cylinder feature;</p><p>
Part *workPart(theSession->Parts()->Work());
Part *displayPart(theSession->Parts()->Display());</p><p> Features::Feature *nullFeatures_Feature(NULL);
Features::CylinderBuilder *cylinderBuilder1;
cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(nullFeatures_Feature);</p><p> cylinderBuilder1->Diameter()->SetRightHandSide(diameterString);
cylinderBuilder1->Height()->SetRightHandSide(heightString);
cylinderBuilder1->SetDirection(vec);
cylinderBuilder1->SetOrigin(point);</p><p> cylinderBuilder1->CommitFeature();
cylinderBuilder1->Destroy();
</p>
高清教程见楼下.
PLM之家NX9.0二次开发视频教程 17 Block UI创建圆柱体特征(1)对话框设计
http://player.youku.com/player.php/sid/XMzA4NDQyMDU0NA==/v.swf
PLM之家NX9.0二次开发视频教程 17 Block UI创建圆柱体特征(2)获取UI值
http://player.youku.com/player.php/sid/XMzA4NDQyNTM0NA==/v.swf
PLM之家NX9.0二次开发视频教程 17 Block UI创建圆柱体特征(3)程序创建
http://player.youku.com/player.php/sid/XMzA4NDQyODc0NA==/v.swf 已经看到这一集了 加油 等着视频上传啊 啊啊啊啊啊啊啊啊啊啊啊啊 啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊 已经更新了!! 楼主辛苦啦.谢谢楼主 楼主辛苦啦.谢谢楼主 我想问一下为什么我选择体,得不到Body啊