PLM之家PLMHome-国产软件践行者

[二次开发源码] NX二次开发源码分享:NXOpen C++创建圆柱体特征

[复制链接]

2013-11-4 12:06:33 3862 0

admin 发表于 2013-11-4 12:06:33 |阅读模式

admin 楼主

2013-11-4 12:06:33

请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!

您需要 登录 才可以下载或查看,没有账号?注册

x
NX二次开发源码分享:NXOpen C++创建圆柱体特征7 G3 I( `* r+ K9 j) h: \
  1. : O' t. L+ u$ y" a. |
  2. <P> </P>
复制代码

  1. ' Q0 `( t' b& c+ @- s
  2. <P>void CreateCylinder_UsingUDB::CreateCylinder()
    ( k1 @- B, y+ j3 H! j6 N
  3. {) X' ^3 y2 h: ?- T: z- c
  4. Part* workPart(theSession->Parts()->Work());</P>0 o2 C0 H. ^7 k# B
  5. <P>Features::CylinderBuilder* cylinderBuilder1 = NULL;+ |8 v( ~0 n5 R, \4 W: t
  6. cylinderBuilder1 = workPart->Features()->CreateCylinderBuilder(NULL);</P>
    ) j/ c4 q" t9 O9 g/ u/ i/ O
  7. <P>//Get the point
    # z* T  `- \- k7 a7 t) d# r
  8. PropertyList* pointPropertyList = point0->GetProperties();% m- b( G: z0 O3 c. m
  9. Point3d originPoint = pointPropertyList->GetPoint("Point");" K! t. H/ ?$ J; Z
  10. delete pointPropertyList;/ ~  p& V( |+ X% }: T+ Y- x
  11. pointPropertyList = NULL;</P>
    4 I1 e$ u/ L, A  W3 ]0 E/ m  G
  12. <P>//Get the direction
    3 j% X' {; O; `2 `0 ?2 {
  13. PropertyList* vectorPropertyList = vector0->GetProperties();0 W3 n5 |( g# m) y
  14. Vector3d direction = vectorPropertyList->GetVector("Vector");
    2 {1 J2 n4 l# [9 X! n
  15. delete vectorPropertyList;  e- r$ \* M+ x3 J4 ]
  16. vectorPropertyList = NULL;</P>
    . Q( f/ X/ k! c) }6 z* d4 b& J
  17. <P>Direction* direction1 = NULL;( Q" ?, K$ K9 a, H/ S/ S8 o
  18. direction1 = workPart->Directions()->CreateDirection(originPoint, direction, SmartObject::UpdateOptionWithinModeling);</P>
    + ]# `( E' I, a' ^
  19. <P>//Set diameter and height
    , E2 Z( j8 u. U1 R
  20. std::stringstream diameterValue;2 {( k% f- C3 ^4 v
  21. diameterValue << diameter->GetValue();: k. W" Y2 l" d
  22. std::stringstream heightValue;# I4 [4 q5 V# y. p& ?( `
  23. heightValue << height->GetValue();</P>, h& ^, d+ B# F; W$ c
  24. <P>cylinderBuilder1->Diameter()->SetRightHandSide(diameterValue.str());
    4 E- ?3 z  x- g% W
  25. cylinderBuilder1->Height()->SetRightHandSide(heightValue.str());</P>, w& k' U+ R, G/ `
  26. <P>//Set the axis3 a  S: `6 ]# o% H3 B5 w
  27. Axis* axis1 = NULL;
    ; a1 m' k; J" c2 H
  28. axis1 = cylinderBuilder1->Axis();1 {" I; i- B; N5 p
  29. axis1->Point()->SeTCoordinates(originPoint);
    / Q; `4 \* m+ X3 V: n
  30. axis1->SetDirection(direction1);</P>: i3 ?0 Y: w" e" F, ]
  31. <P>//Commit) Q) ?/ v! b) a! R0 z" \
  32. cylinderBuilder1->Commit();
    & \2 K; H; {% `$ l# s
  33. cylinderBuilder1->Destroy();
    ' y* x' S) j# {
  34. cylinderBuilder1 = NULL;
    6 b7 b# h1 X' J8 R
  35. }
    * j- b6 n! r' \* E
  36. </P>
复制代码
, {. a+ k0 D9 {$ |- c' a
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 注册

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了