PLM之家精品课程培训,联系电话:18301858168 QQ: 939801026

  • NX二次开培训

    NX二次开培训

    适合初级入门或想深入了解二次开发的工程师,本培训结合ufun,NXOpen C++,大量的实例及官方内部的开发技术对于老鸟也值得借鉴!.

    NX CAM二次开发培训报名 NX二次开发基础培训报名
  • PLM之家Catia CAA二次开发培训

    Catia二次开发培训

    Catia二次开发的市场大,这方面开发人才少,难度大。所以只要你掌握了开发,那么潜力巨大,随着时间的积累,你必将有所用武之地!

  • PLM之Teamcenter最佳学习方案

    Teamcenter培训

    用户应用基础培训,管理员基础培训,管理员高级培训,二次开发培训应有尽有,只要你感兴趣肯学习,专业多年经验大师级打造!

  • PLM之Tecnomatix制造领域培训

    Tecnomatix培训

    想了解制造领域数字化吗?想了解工厂,生产线设计吗?数字化双胞胎,工业4.0吗?我们的课程虚位以待!

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

[二次开发源码] NX二次开发源码分享:报告当前工作部件的所有属性

[复制链接]

2019-4-25 18:49:57 3724 1

admin 发表于 2014-11-4 20:48:40 |阅读模式

admin 楼主

2014-11-4 20:48:40

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

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

x

7 `! x3 Y# M& q; v; H0 t# t9 a+ |" z3 GNX二次开发源码分享:报告当前工作部件的所有属性
  v5 w) c& C+ ]$ b1 m- U9 e主要是用过workPart->GetUserAttributes()获取属性信息;/ F% ]  m4 _& O% Y
  1. void MyClass::do_it()' ?* ?4 R% B' z& T/ _/ `& X) s
  2. {0 W$ [! C7 N4 i( P, {) O; F: N2 ^
  3.     stringstream out;
    5 A7 ~! ~- a3 g& z3 T
  4.     std::vector<NXOpen::NXObject::AttributeInformation> infos = workPart->GetUserAttributes();# n/ w1 G: g0 B4 y* S! C
  5.     out.str(""); out.clear();
    * ]8 D( Z# a8 \% x
  6.     out << "\nAttributes found: " << infos.size() << endl;  J0 O' l8 }5 i1 v
  7.     print(out.str().c_str());' D/ J6 O  x$ O6 @
  8. , N3 _1 s' O( Q: C/ m
  9.     for (unsigned int ii=0; ii<infos.size(); ii++)( _  z5 k' I6 p- J, r
  10.     {
    3 |' M+ @9 r" t# ~9 t4 t
  11.         out.str(""); out.clear();) u. H# \8 P. U- ^6 J
  12.         out << "\nAttribute: " << infos[ii].Title.GetText() << endl;: t" d' q& ?: R, u! `* Y3 h
  13. " C& I0 t+ V. b  {+ ?5 s5 j. ^
  14.         out << " Array: " << infos[ii].Array << endl;/ C' t0 e+ A' X8 |! v" H$ V
  15.         if( infos[ii].Category.GetText() )
    / V7 s4 \- z9 s( t
  16.             out << " Category: " << infos[ii].Category.GetText() << endl;
    4 L! R5 ]! e7 m7 C" T
  17.         else
    % i  ~& j7 k+ x1 o! F
  18.             out << " Category: NULL"  << endl;
    ' X, [6 I, o% C. o: j
  19.         out << " Inherited: " << infos[ii].Inherited << endl;
    & F' s; e+ E/ E" O$ P
  20.         out << " Locked: " << infos[ii].Locked << endl;/ `: O+ p1 r5 O, n$ ~
  21.         out << " OwnedBySystem: " << infos[ii].OwnedBySystem << endl;6 j- l9 K# k+ e* V
  22.         out << " PdmBased: " << infos[ii].PdmBased << endl;
    : y$ {9 y* ?8 [1 r% m
  23.         out << " Required: " << infos[ii].Required << endl;
    4 r: A! e2 z  u9 \! q
  24.         out << " Type: " << infos[ii].Type << endl;8 B, n+ O+ x* r; J) L" P! s
  25.         out << " Unset: " << infos[ii].Unset << endl;/ D, F; v0 ^# r" s- @: }. j8 l* f
  26. & h! E, p+ s! p8 s1 t( X/ j7 `
  27.         swiTCh ( infos[ii].Type ); i4 h# ?6 t3 O# p( {$ a6 E9 }0 f
  28.         {% I$ y- ]6 P0 d; H; O
  29.         case NXObject::AttributeTypeInvalid:! k* |; M$ R& _; \. @1 m
  30.             out << " Type is invalid." << endl;
    0 o% U: A! ?& c
  31.             break;
    & R* s! {  B0 ~& T
  32.         case NXObject::AttributeTypeBoolean:
    6 d, o/ R, ?2 [+ |
  33.             out << " BooleanValue: " << infos[ii].BooleanValue << endl;
      N- }. s# M1 _% T2 y
  34.             break;" B/ R7 r0 r* }$ B0 t: I  o
  35.         case NXObject::AttributeTypeInteger:
    8 b& s+ b; ]  n7 L
  36.             out << " IntegerValue: " << infos[ii].IntegerValue << endl;+ u( s! ?8 v" S1 U* F" m
  37.             break;+ M" k( A+ |. A5 i$ f
  38.         case NXObject::AttributeTypeReal:2 M; y: F: D8 ?6 k: Y
  39.             out << "RealValue: " << infos[ii].RealValue << endl;
    + f& |- N( M8 n. o5 M9 i
  40.             break;
    5 s: K9 q6 m7 g" q5 M% _/ ]* V. D
  41.         case NXObject::AttributeTypeString:0 Q- t6 Z3 G4 c1 t# I* l
  42.             out << " StringValue: " << infos[ii].StringValue.GetText() << endl;. E  _( U2 p+ W! v& n) K1 _
  43.             break;# n; k( `4 D% ?* [. }9 S& K
  44.         case NXObject::AttributeTypeTime:5 e2 n% U. h- v! o  o. q3 |
  45.             out << " TimeValue: " << infos[ii].TimeValue.GetText() << endl;
      p' Y" h' D& q- M$ s  Z& ~( }- ^
  46.             break;; G: Q& b4 U7 r/ ]
  47.         }4 L1 j* x4 z& {2 M& m1 i; I
  48. 3 F$ p8 }  C; U( a/ z
  49.         print(out.str().c_str());
    6 f4 S' V# H- Q- J- m& |% G
  50.     }5 F; B/ B1 z6 W% i; v& {

  51. 5 v5 J" Y: x9 L  m& Q5 K* Z0 d8 E
  52. }
    . y- [1 p% i9 V- l$ ]- p8 Z$ ~5 R
复制代码

( d" N0 i; r7 `" o4 j/ Y' l  g7 h* ^# o, N
  E5 @/ `* ]& k: ^4 l
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.diantuankj.com/ doTeam.tech
回复

使用道具 举报

全部回复1

593232280 发表于 2019-4-25 18:49:57

593232280 沙发

2019-4-25 18:49:57

有用的,解决
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.diantuankj.com/ doTeam.tech
回复 支持 反对

使用道具 举报

发表回复

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

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

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

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

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

    我知道了