点击查看详细介绍

使用Block UI创建圆柱体的特征实例代码

nxopen 11年前 9824 56

购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008  QQ号:85585969  


本例为圆柱体的特征创建,以及使用Block UI中的点,矢量构造器进行获取用户的输入,通过使用表达式控件获取圆柱体的直径和高度值,从而创建一个圆柱体的过程。

特征的创建方法基本上相同,通常情况下,创建一个空的特征,构建一个feature *** uilder,通过这个featurebuilder进行相关值的指定,最后通过commit进行特征或者对象的创建!


以下位核心部分代码参考:

//get the UI &#118alues;
NXString diameterString,heightString;
std::stringstream ssdia,ssheight;
// get vector
BlockStyler::PropertyList *vectorProperty = vector0->GetProperties();
Vector3d vec = vectorProperty->GetVector("Vector");
delete vectorProperty;
vectorProperty = NULL; // get point
BlockStyler::PropertyList *pointProperty = point0->GetProperties();
Point3d point = pointProperty->GetPoint("Point");
delete pointProperty;
pointProperty = NULL; // get diameter
BlockStyler::PropertyList *diaProperty = expressionDia->GetProperties();
double dia = diaProperty->GetDouble("&#118alue");
delete diaProperty;
diaProperty = NULL;
//get height
BlockStyler::PropertyList *hProperty = expressionH->GetProperties();
double height = hProperty->GetDouble("&#118alue");
delete hProperty;
hProperty = NULL; //convert &#118alues to string
ssdia << dia;
diameterString = ssdia.str(); ssheight << dia;
heightString = ssdia.str(); //create cylinder feature;
Part *workPart(theSession->Parts()->Work());
Part *displayPart(theSession->Parts()->Display());
Features::Feature *nullFeatures_Feature(NULL);

●●●请先 登陆注册 后查看●●●

cylinderBuilder1->Height()->SetRightHandSide(heightString);
cylinderBuilder1->SetDirection(vec);
cylinderBuilder1->SetOrigin(point);
cylinderBuilder1->CommitFeature();
cylinderBuilder1->Destroy();

1

最新回复 (56)
  • 591xx 11年前
    1

    好资料就得学习学习!

  • jimk 11年前
    2

    学习一下,谢谢

  • yuhuimoon 10年前
    3

    学习一下,多谢楼主的分享

  • SNFGDGVJX 10年前
    4

    学习一下,多谢楼主的分享

  • 88hwp 10年前
    5

    44444444444444444444444444444

  • yuleihz 10年前
    6

    好资料就得学习学习!

  • pengfujun VIP会员 10年前
    7

    学习一下,多谢楼主的分享

  • zjb460515213 10年前
    8

    对于新手非常有用,新手学习,谢谢分享

  • buzhidaohuy 9年前
    9

    学习学习。。。。。。。。。。。

  • fabyerse123 9年前
    10

    回复才能看`````````````

  • raohongdi86 VIP会员 9年前
    11

    学习。。。。。。。。。。

  • application 9年前
    12

    回复才能看`````````````

  • F1606476 9年前
    13

    士大夫撒旦发射点发撒打发士大夫

  • 奔跑中原 9年前
    14

    6666666666666666666666666666666666666666666

  • taokit 9年前
    15

    good studing, day day up!

请登录后发表新帖