请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
【PLM之家-NX9.0二次开发实例视频】16 Block UI创建block特征: a% }' P+ y6 ~5 C7 w8 t- N
本视频分四部分:: L6 ~3 g- X8 y7 C H
PLM之家-NX9.0二次开发实例 16 使用Block Styler创建Block(1)UI设计/ A, F% r {+ }9 ]1 o
PLM之家-NX9.0二次开发实例 16 使用Block Styler创建Block(2)代码模版分析
) R; o" f( E% K* H5 X/ ~PLM之家-NX9.0二次开发实例 16 使用Block Styler创建Block(3)特征创建7 T/ C* y# H" U
PLM之家-NX9.0二次开发实例 16 使用Block Styler创建Block(4)创建完成
3 b" }5 d+ |- Y. z* _内容:通过使用Block Styler界面进行block UI创建 目的:熟悉BlockStyler界面的使用和C ++ code生成代码,以及如何对Block Styler的double类型进行取值;熟悉通过NXOpen C++的方式创建特征!
Block Styler创建block特征
5 ]) d7 ^* V, D& S2 c$ ^3 n
7 ^2 d9 p J4 u8 ? X
使用新的Block Styler UI 的方式创建UI,直接,方便,快捷,在UI设计的时候,方便快捷,同时可以对UI的很多属性直接在界面上进行设定(当然,你也可以通过代码,简单的set属性进行设置)。
0 \( }8 c; z) E U% p( G6 a5 j; ?+ x
9 q' q8 L" \0 r7 s1 e在对不同的控件进行参数定义的时候,可以参考Block UI的参考手册!
5 b- n3 P& g0 z; j2 ]+ T+ ]) Q我们在后期的视频教程中,无例外的话,均使用最新的Block UI进行交互对话框设计!: W' Z# C$ S5 V7 z! j) G* J0 x
, X# E, g; R- T) M) I ?
关键代码分享:- E; Q7 p1 L- h9 X: y- x/ b% ]
( v" `' ^0 \% r
- //get the session- i5 E# Y/ G8 v$ _0 V8 E
- Part *workPart(theSession->Parts()->Work());% }- U( w, I6 E' e2 C; r. L
- NXString length,width,height;
, _# C( J$ ]+ _. d - //get the block UI values
9 c" ^( T7 y* I+ L& I+ ? - % x6 H4 s5 u( t% R0 R; W4 b( Z5 F
- Point3d origin = this->pointorigin->GetProperties()->GetPoint("Point");' s- S( x2 ^3 [' f- F
- double lengthValue = this->doubleLength->GetProperties()->GetDouble("Value");+ g! m% q" X* i$ \9 @0 y, Q
- double widthValue=this->doubleWidth->GetProperties()->GetDouble("Value");
) y/ o( s- h- }& y, M - double heightValue=this->doubleheight->GetProperties()->GetDouble("Value");# w1 b3 o, x6 D/ I' S' t
( Z0 Y$ x3 {/ q' a) t% I3 ~- // convert double to string
/ f# J+ o& S) {& C8 N( a - std::stringstream slength;! E" F) X+ q! V
- slength << lengthValue;. t1 @1 B+ p5 i9 |
- length = slength.str();/ ]* A" W' }0 J. j7 P0 w0 ?& P
) { }) e# A; _/ p" ^/ C; H- std::stringstream swidth;
+ x, f- I$ D* s z$ L - swidth << widthValue;5 X8 [1 N& a p* E# q5 ]& c& [$ N
- width = swidth.str();, m8 C3 s4 E/ ~
1 F9 M6 @+ H/ D7 E4 u/ x3 r) r' i) l/ [4 h- std::stringstream sheight;
- d, y' V2 c# h. h" } - sheight << heightValue;/ C0 r* J& Z+ k! i% P
- height = sheight.str();
. H$ q+ \# s& y$ q" k; z - 3 E! |9 H$ f2 X* k% |4 R, _
- Features::Feature *null_block_feature(NULL);
/ m$ s9 e* B$ v/ }% w4 Y% m - Features::BlockFeatureBuilder *blockFeatureBuilder;2 p# h, e- o9 u$ f4 H: `/ x
- blockFeatureBuilder = workPart->Features()->CreateBlockFeatureBuilder(null_block_feature);- f. P8 {2 `( ?+ N" ^
- //parameters settings9 o7 H ~5 s$ G3 H, h- O W" Y
- blockFeatureBuilder->SetOriginAndLengths(origin,length,width,height);1 \# {3 Y& a1 ?5 r0 I7 a9 A
- //commit 9 Y" ~2 K+ x0 V, U2 z
- blockFeatureBuilder->CommitFeature();4 ~ F7 B" S( Q$ [; E8 l
- //destory
9 J9 }7 X8 o7 V s! U! o - blockFeatureBuilder->Destroy();/ Q) ?7 h6 F3 Y
复制代码 / q& w, f: I9 L- i9 b* b
! d( s6 T O) r4 f) R
高清视频分享:
" H6 N% D9 C! X O$ g/ w9 {- ^& s, o+ p& @* S5 P9 ^$ V
$ q3 I7 c: z+ g+ J |