请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
【PLM之家-NX9.0二次开发实例视频】16 Block UI创建block特征
}9 W8 D( N; G% M2 q9 }本视频分四部分:
9 J% W# z, d0 R' K0 UPLM之家-NX9.0二次开发实例 16 使用Block Styler创建Block(1)UI设计
1 ?2 J: j4 N9 bPLM之家-NX9.0二次开发实例 16 使用Block Styler创建Block(2)代码模版分析2 B# r- [% T9 e8 g; q: q" R
PLM之家-NX9.0二次开发实例 16 使用Block Styler创建Block(3)特征创建
/ u" |0 D, D8 gPLM之家-NX9.0二次开发实例 16 使用Block Styler创建Block(4)创建完成
9 D5 K# Y2 y! T$ Y8 `2 P. @内容:通过使用Block Styler界面进行block UI创建 目的:熟悉BlockStyler界面的使用和C ++ code生成代码,以及如何对Block Styler的double类型进行取值;熟悉通过NXOpen C++的方式创建特征!
Block Styler创建block特征
0 T3 i! k7 d, O6 m% l* f
" i w1 E x4 a使用新的Block Styler UI 的方式创建UI,直接,方便,快捷,在UI设计的时候,方便快捷,同时可以对UI的很多属性直接在界面上进行设定(当然,你也可以通过代码,简单的set属性进行设置)。$ z, a7 |; {' |5 k9 g7 _( ?7 G: K) b
1 s! [6 K5 b* H% m* G在对不同的控件进行参数定义的时候,可以参考Block UI的参考手册!
6 V6 H0 P3 H% e2 {$ }( \2 s3 D我们在后期的视频教程中,无例外的话,均使用最新的Block UI进行交互对话框设计!3 N9 U5 f0 X( O: N. d$ {, n
6 X M. J) ]. \0 F
关键代码分享: q$ V$ g6 y) s" _ G4 E
, M% T3 [$ p1 @- //get the session
) H6 w$ ?9 T, E! q; B0 f - Part *workPart(theSession->Parts()->Work());
+ X1 f9 ~# l- `. ]3 k- @ - NXString length,width,height;0 C7 W8 D; N2 M
- //get the block UI values5 j2 i/ x" J, T( {- B
2 S* E% n! C% Q) ^# K T$ N; ?- Point3d origin = this->pointorigin->GetProperties()->GetPoint("Point");
' J, w2 N8 N9 Y( e# R- v - double lengthValue = this->doubleLength->GetProperties()->GetDouble("Value");! O: d: \; \2 J4 |5 u
- double widthValue=this->doubleWidth->GetProperties()->GetDouble("Value");
( G: }( h s9 N a% y - double heightValue=this->doubleheight->GetProperties()->GetDouble("Value");
' t9 Q# Y6 W" P' o7 N) N6 @
" E+ t- [- j: u, ~2 }1 F5 C- // convert double to string
/ K. w: p' p# ~+ N$ I( x - std::stringstream slength;
; A3 o: k/ n- Q7 E* a0 | - slength << lengthValue;
8 U3 g+ k4 Y Q1 \ - length = slength.str();. V y: q5 Q, R. P+ A& G1 U
% \# l; ?% B3 M8 h7 o- std::stringstream swidth;
! l( T/ m: D$ R" X/ y7 t: y - swidth << widthValue;3 {' B7 | \& k" w7 @' b9 r
- width = swidth.str();
2 t/ j$ p$ H1 s - 6 `! e8 p' ~' H$ u
- std::stringstream sheight;
6 o+ n: I% {) C5 Y - sheight << heightValue;
. J( K t6 C! x y4 \: V. d5 z/ Z - height = sheight.str();( |( J' O' C% T/ o2 V6 l# }8 h3 I
- 2 E1 L8 Y }- R: t0 j- C
- Features::Feature *null_block_feature(NULL);
* U0 `- G' |6 c0 ]* Y( T4 j2 E - Features::BlockFeatureBuilder *blockFeatureBuilder;
; j$ t3 Y7 o& o0 I3 }/ U2 V - blockFeatureBuilder = workPart->Features()->CreateBlockFeatureBuilder(null_block_feature);
0 J2 T/ }! C8 E' K3 f; j - //parameters settings4 G& a3 h( s0 O7 Z
- blockFeatureBuilder->SetOriginAndLengths(origin,length,width,height);
9 T; v* z- h' U4 [- | - //commit
3 F+ [' Z- g/ o H# v - blockFeatureBuilder->CommitFeature();
6 g' F# |% |0 o1 O, S" R. Q - //destory; c: r& q% c) i& q* l+ [8 z
- blockFeatureBuilder->Destroy();
- v* |- ]5 M8 Q- N
复制代码
) Z+ Q3 r5 B1 ?4 w! Y. H
' l9 q, ]3 S# ~, T6 n* C* K高清视频分享:# `3 z% F6 U2 a t8 c
. Z l6 P4 L8 Y5 c5 k `% r
# D4 z; w& \% g# E- g9 y9 T: {1 { |