PLM之家精品课程培训

PLM之家精品课程培训

联系电话:18301858168   |   QQ咨询:939801026
NX二次开发培训

NX二次开发培训

UFUN/NXOpen C++和实战案例

适合初级入门或想深入了解二次开发的工程师,本培训结合ufun,NXOpen C++,大量的实例及官方内部的开发技术。
公众号二维码

关注公众号

点击扫描二维码免费在线高清教程

课程详情
Catia二次开发培训

Catia二次开发培训

市场需求大,掌握核心技术前景广阔

Catia二次开发的市场需求大,人才稀缺。掌握开发技能潜力巨大,随着经验积累将在汽车、航空等领域有所作为。
B站二维码

在线原创B站视频

点击关注工业软件传道士主页

课程详情
Teamcenter培训

Teamcenter培训

全方位培训,从基础应用到高级开发全覆盖

涵盖用户应用基础培训、管理员基础培训、管理员高级培训及二次开发培训等全方位内容,由多年经验讲师打造。
QQ群二维码

加入同行交流

点击扫描二维码加入QQ群

课程详情
×

PLM之家plmhome公众号

课程涵盖: PLM之家所有原创视频

×

关注B站视频

所有高清视频一览无余,全部在线播放学习

×

加入PLM之家QQ群

同行交流,疑问解答,更多互助

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

[二次开发源码] UG NX 二次开发源码分享:遍历所有的实体得到边面特征信息

[复制链接]

2013-11-4 16:53:51 6146 0

admin 发表于 2013-11-4 16:53:51 |阅读模式

admin 楼主

2013-11-4 16:53:51

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

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

x
UG NX 二次开发源码分享:遍历所有的实体得到边面特征信息
* m4 v4 c; q8 V0 S" k
7 Z  y; c$ ]( L
. h8 x+ o$ o+ S6 a  theSession->ListingWindow()->Open();
1 o' V  n; p  b2 v6 M2 H  theSession->ListingWindow()->WriteLine("Get information from all bodies\n");
5 K1 ~- {% K6 E. V  u' r     std::vector<Body *> bodies;+ @) w+ e* S) x  a5 K2 z9 t8 t. O
  BodyCollection *bodyColl = workPart->Bodies();
  K7 P( y' B/ ^4 w, t  for(it = bodyColl->begin();it!=bodyColl->end();++it)
3 A- O1 D. g) |( S& _  U5 K  {
( V2 G" l2 o7 [0 d( n   bodies.push_back(*it);
) S: T$ F0 ~+ I+ g1 R- N3 ]  }
7 w# T0 I' J. O: o1 l$ c  ss <<"Bodies count = " << bodies.size()<< "\n";/ Q3 w8 ]+ k# L+ n9 T/ b7 n
   std::vector <Edge *> edges;
* @5 r4 r) p. s! R  B) I2 l   std::vector <Edge *> totalEdges;: u& B, b2 \( M- m7 P- [! A
   std::vector <Face *> faces;
+ }- r% n, u# U( A. _! M6 z   std::vector <Face *> totalfaces;
% m7 |( \" x; c. s: B   std::vector <Features::Feature *> Features;
* i2 y6 m# c; m( Y( k+ a5 ?; W) @   std::vector <Features::Feature *> totalFeature;- e# _$ @9 ?$ l# v& X6 ^. N* c
   Point3d vertex1,vertex2;5 Z# i& M0 Y/ C' \1 S; s9 c
   for (unsigned int i = 0; i< bodies.size();++i)
2 A; T% X% l  w. B  h, |   {
, s) M3 q7 `3 x% X) m9 v    edges = bodies->GetEdges();; G3 B; U  }$ R! _) N2 c
    faces = bodies->GetFaces();
5 H4 ^# N( S1 o8 U1 O+ D) N, L9 h& V    Features = bodies->GetFeatures();
. q: `: m. o9 x8 R( Z4 T     for(unsigned int j =0;j < edges.size(); j++)
( T& S2 I- ^/ v1 k  I( t2 G     {
5 N8 p( A+ z& T# U: e; s/ h5 Q     totalEdges.push_back(edges[j]);
/ X" a; h% Q+ g1 \% Z5 L     }/ F4 v$ y" b2 n/ a! }5 P" _& p; r
     for(unsigned int j =0;j < faces.size(); j++)8 r& K# h, D# O5 b' P7 n/ L" W
     {
) f+ J9 R2 O7 U: h9 i- z     totalfaces.push_back(faces[j]);$ q/ C: G# `, z2 }$ |; A
     }; i3 u3 d/ Q# C$ U5 J1 @- b# Q+ S
      for(unsigned int j =0;j < Features.size(); j++)
: N$ y0 B. m/ c5 p/ q5 N0 ^. s9 \1 L     {
: d" C5 u/ ]- n3 h     totalFeature.push_back(Features[j]);
8 R& n4 a9 }2 X7 T     }
: C) s6 k/ g1 e5 V- x) P      
8 M1 Q9 f$ V$ s  ]4 o+ ^, N3 G5 i   }
2 G& j1 `) x8 I  O4 q8 @    ss <<"edges count = " << totalEdges.size()<< "\n";  y) [0 }  t; f6 @- q
   for(unsigned int j =0;j < totalEdges.size(); j++)4 L7 Y3 G7 q0 S( E
     {   
8 z6 {# X7 B* |3 j) @6 F      totalEdges[j]->GetVertices(&vertex1,&vertex2);
$ Z5 M3 T4 _5 R5 q7 h       ss <<"edges tag: " <<  totalEdges[j]->GetBody()->GetTag()<<"\t";5 ]9 j4 Y  L4 L, w4 b8 i
       ss <<"edges vertex 1: "<<"("<<vertex1.X<<","<<vertex1.Y<<","<<vertex1.Z<<")"<<"\t";
3 h' i6 R6 H" p; {, f8 T2 ]       ss <<"edges vertex 2: "<<"("<<vertex2.X<<","<<vertex2.Y<<","<<vertex2.Z<<")"<<"\n";8 p% Z# M) f& D+ q% M  B
     }# e, G, h. g# V& u! `4 `- o
   ss <<"faces count = " << totalfaces.size()<< "\n";& j- ]2 \" J7 P
    for(unsigned int j =0;j < totalfaces.size(); j++)/ U5 H7 u& q/ z0 R
    {  
1 K: G6 n3 a  @! R     ss <<"Face tag: " << totalfaces[j]->Tag()<<"\t";0 T/ I, E7 U8 S
     ss <<"Face Type: " << totalfaces[j]->SolidFaceType()<<"\t";. c' k4 d1 r% G5 D, E2 `  M' _
     ss <<"Face Name: " <<totalfaces[j]->Name().GetUTF8Text()<<"\n";
6 [$ H* M3 t2 c8 m    }) ?& h) R  `" _: I( W
   ss <<"Features count = " << totalFeature.size()<< "\n";
: m, d( l  Y7 ^     for(unsigned int j =0;j < totalFeature.size(); j++)
7 E) @$ \; N  B5 [    {  
% ^6 H. P) I# g2 I" B     ss <<"features tag : " << totalFeature[j]->Tag()<<"\t";! Z: j/ O0 S3 B- ]( [
     ss <<"features Type: " << totalFeature[j]->FeatureType().GetUTF8Text()<<"\t";
( W* a6 a- Q" |& S9 ?& a' ^     ss <<"features Name: " <<totalFeature[j]->GetFeatureName().GetUTF8Text()<<"\n";
- J( q" h0 o, p( K! g    }
# D6 w8 U) ?. ]  theSession->ListingWindow()->WriteLine(ss.str());, x' o# F9 y6 s" U

- G8 b. K( r, W' s/ G( W$ C
. Q: ]1 `. f& B查询结果如下:
+ p( X; f  N$ [* |( ]) v! j6 z1 t, b: C

9 s$ U5 y0 I4 G1 j+ k1 j+ EGet information from all bodies0 u( Q4 m2 O. T9 [# r) \* Q$ B
CYLINDERBodies count = 70 a- s- P. j+ _, u% n. |6 e0 I
edges count = 22
' P9 e3 n1 K- c, i2 M' t. q* ^# Zedges tag: 41404 edges vertex 1: (100,0,0) edges vertex 2: (100,0,100)+ o/ ]; @2 W) l. r- H
edges tag: 41404 edges vertex 1: (100,0,0) edges vertex 2: (100,100,0)- n; G4 P! Y0 E$ X2 Y/ [/ `
edges tag: 41404 edges vertex 1: (0,100,0) edges vertex 2: (0,100,100)8 x$ B. |0 y0 P  K: N
edges tag: 41404 edges vertex 1: (100,100,0) edges vertex 2: (0,100,0)
# Z1 y6 i0 N4 I( A2 Xedges tag: 41404 edges vertex 1: (100,0,100) edges vertex 2: (0,0,100)
! |0 q& E6 m& v6 L% N: redges tag: 41404 edges vertex 1: (0,0,0) edges vertex 2: (100,0,0)
  d8 Z: ^0 K  ~edges tag: 41404 edges vertex 1: (100,100,0) edges vertex 2: (100,100,100)
9 G1 n+ ]" m$ C6 ?7 S; g9 oedges tag: 41404 edges vertex 1: (0,100,100) edges vertex 2: (100,100,100)
3 `5 c# Q7 G( _$ q" l2 g' }# Cedges tag: 41404 edges vertex 1: (0,0,100) edges vertex 2: (0,100,100)
, n$ E3 o) A, i4 u+ G9 l$ `edges tag: 41404 edges vertex 1: (100,100,100) edges vertex 2: (100,0,100)
! V( m9 i8 z2 B9 w. y& @& e: a( f% Tedges tag: 41404 edges vertex 1: (0,0,0) edges vertex 2: (0,0,100)- d9 t4 i7 H" z% S
edges tag: 41404 edges vertex 1: (0,100,0) edges vertex 2: (0,0,0)& ?1 L! w! n- e7 w) p8 c
edges tag: 40966 edges vertex 1: (50,0,100) edges vertex 2: (50,0,100)0 p, c" D2 j( E+ L
edges tag: 40966 edges vertex 1: (50,0,200) edges vertex 2: (50,0,200)
7 W1 }9 n" D1 `' H; h; }edges tag: 40977 edges vertex 1: (50,0,200) edges vertex 2: (50,0,200). @' D4 ?3 q3 O6 W
edges tag: 40977 edges vertex 1: (50,0,300) edges vertex 2: (50,0,300)
& x( `' p9 Z6 p) \* hedges tag: 37824 edges vertex 1: (50,0,300) edges vertex 2: (50,0,300)
  a! s- j  ~8 }4 _- Pedges tag: 37824 edges vertex 1: (50,0,400) edges vertex 2: (50,0,400)% V8 y! a% L, p7 _
edges tag: 41200 edges vertex 1: (50,0,400) edges vertex 2: (50,0,400)
+ |: k& r: u! p# o2 X! `' }edges tag: 41200 edges vertex 1: (50,0,500) edges vertex 2: (50,0,500)' }6 n' e" G/ k
edges tag: 41357 edges vertex 1: (150,100,200) edges vertex 2: (150,100,200)$ I& K0 v& t% Y6 H0 Y0 M  v0 U
edges tag: 41357 edges vertex 1: (150,100,100) edges vertex 2: (150,100,100)' B! i* c4 r. r; _
faces count = 22
( C- z4 k" D1 J. V  ZFace tag: 41407 Face Type: 4 Face Name: / c& \# v7 u7 ]/ J
Face tag: 41398 Face Type: 1 Face Name: / w& v4 |( x" L; _' l
Face tag: 41376 Face Type: 1 Face Name: & L& Z- E, t7 ?0 R' o
Face tag: 41391 Face Type: 1 Face Name:
3 a' _; x3 w) o* U( UFace tag: 41380 Face Type: 1 Face Name: $ z2 N% ]7 L' q% Z+ T7 C
Face tag: 41396 Face Type: 1 Face Name:
7 F  F" Q) ^9 G9 o) CFace tag: 41397 Face Type: 1 Face Name:
! f- T. `; \* a  |: _6 Q9 eFace tag: 40995 Face Type: 2 Face Name: / h1 v( u: s* }3 `. n- u# m
Face tag: 40965 Face Type: 1 Face Name: 2 ^$ l5 m/ L) h
Face tag: 40997 Face Type: 1 Face Name:
9 ~( i; z- l0 ?9 A4 ]  jFace tag: 41351 Face Type: 1 Face Name:   |- b" ~0 s. w1 e5 ^
Face tag: 41352 Face Type: 1 Face Name:
1 K& i) q  `) K, y; K6 SFace tag: 41353 Face Type: 2 Face Name: 1 g5 ~1 t/ _( f9 ?* j* m+ E- \
Face tag: 38479 Face Type: 1 Face Name: * I8 Z" X) C& ?8 t
Face tag: 38480 Face Type: 1 Face Name:
" ?/ o8 q; I2 u; u' QFace tag: 38481 Face Type: 2 Face Name:
3 x. |: S: |$ \2 p2 M5 hFace tag: 41207 Face Type: 1 Face Name: ) G9 ^" g* Q& s9 ^  Q  v
Face tag: 41203 Face Type: 1 Face Name:
& z! D7 L3 ?( z$ ^Face tag: 41158 Face Type: 2 Face Name: 1 ]' k3 p+ X& U7 w6 {: S) Z5 [
Face tag: 40987 Face Type: 2 Face Name: & @) D9 J1 M% x
Face tag: 41010 Face Type: 1 Face Name: , @& x# m- |5 ?! J, M, N1 A
Face tag: 41001 Face Type: 1 Face Name: , n2 B( f! l, g4 m9 T( H0 O" V' `+ n
Features count = 7; p" G( t. q8 \6 t! v0 P
features tag : 41280 features Type: SPHERE features Name: Sphere(17)
4 w& C; x( d# B7 Sfeatures tag : 41281 features Type: BLOCK features Name: Block(18)3 R, p) o% O% Z: c' k# V; v, N& p/ @
features tag : 41307 features Type: CYLINDER features Name: Cylinder(19)
$ V3 b1 K* M9 A; Rfeatures tag : 41314 features Type: CYLINDER features Name: Cylinder(20)
5 n6 ~9 |3 l6 jfeatures tag : 41322 features Type: CYLINDER features Name: Cylinder(21): ^& F! k9 ^( O7 {# S
features tag : 41330 features Type: CYLINDER features Name: Cylinder(22)
/ x- ^/ g, z  _features tag : 41338 features Type: CYLINDER features Name: Cylinder(23)6 r/ S) R3 @+ a  y9 p! U$ i

1 P( T% S" t2 R& S' G
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了