请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【PLM之家-NX9.0二次开发实例视频】16 Block UI创建block特征) C" ]# B/ B `+ g% d$ o/ Z
本视频分四部分:( N( [ h8 k! Q8 z' M0 s8 B
PLM之家-NX9.0二次开发实例 16 使用Block Styler创建Block(1)UI设计. Z4 r! `9 E! X! K$ Y# |" @
PLM之家-NX9.0二次开发实例 16 使用Block Styler创建Block(2)代码模版分析
2 U) l% f: f' c2 Y8 r! c4 d2 ZPLM之家-NX9.0二次开发实例 16 使用Block Styler创建Block(3)特征创建7 ^: W/ `& I9 C$ v
PLM之家-NX9.0二次开发实例 16 使用Block Styler创建Block(4)创建完成
) }, }6 c. Y. B/ s5 U内容:通过使用Block Styler界面进行block UI创建 目的:熟悉BlockStyler界面的使用和C ++ code生成代码,以及如何对Block Styler的double类型进行取值;熟悉通过NXOpen C++的方式创建特征!
Block Styler创建block特征
/ Y0 v% j" M* r$ y- X! b9 l! Y9 {1 T5 u$ K* M8 R$ r
使用新的Block Styler UI 的方式创建UI,直接,方便,快捷,在UI设计的时候,方便快捷,同时可以对UI的很多属性直接在界面上进行设定(当然,你也可以通过代码,简单的set属性进行设置)。
d& C+ H# f3 S" i1 g; Q7 a E4 r ) |; u$ Z8 Z8 \. q( p
在对不同的控件进行参数定义的时候,可以参考Block UI的参考手册!) U3 J8 Y8 Q0 X+ o) _, z" B
我们在后期的视频教程中,无例外的话,均使用最新的Block UI进行交互对话框设计!
% U" [8 i, [9 N" ~4 M
+ ?8 G( L6 L$ X: {. o, T; d( ?关键代码分享:) }9 {, p# z. l
$ d0 Y% l2 Q0 y. M+ {
- //get the session9 F5 X9 x6 P* \, t* w9 ]- Z( E
- Part *workPart(theSession->Parts()->Work());3 V( _& k" V5 X! d
- NXString length,width,height;
7 b7 G; v$ r: s1 D. A. B - //get the block UI values5 l9 C7 k) ?. Z# M, a$ X
6 O& B8 P; y+ J- Point3d origin = this->pointorigin->GetProperties()->GetPoint("Point");& M) N$ `" a! {* M* S# k' x
- double lengthValue = this->doubleLength->GetProperties()->GetDouble("Value");# h" [& [# u& N8 b
- double widthValue=this->doubleWidth->GetProperties()->GetDouble("Value");9 Z( ?! r% B' J$ K+ e
- double heightValue=this->doubleheight->GetProperties()->GetDouble("Value");
8 }* r6 f0 L$ U$ ?* c2 k0 A% X
! c, E3 R4 S0 `# L" W& I- // convert double to string3 }* a9 Z5 x8 f6 y0 N
- std::stringstream slength;
7 g2 }7 Q r9 ]+ H. g" r6 n1 n - slength << lengthValue;
% j& Z# f! c+ x, H/ ^ - length = slength.str();
- k- C4 ]+ X2 e# G - ; w; j3 p8 w8 N% o
- std::stringstream swidth;3 B/ i- k! d2 x* G5 v" Y
- swidth << widthValue;
- q; y1 W% C0 E7 S) V6 _6 Y$ O - width = swidth.str();! B1 B1 _- V9 `6 n
! p6 O; g$ }7 K A& O1 h! v- std::stringstream sheight;; _9 O+ ]! E! ]" n y0 G
- sheight << heightValue;
7 |; {: X9 n% p3 d4 ` - height = sheight.str();
3 j. d2 q/ j, P$ ?2 z - - F7 U \% t* ]6 w* Z
- Features::Feature *null_block_feature(NULL);2 a6 O v1 K4 |& z/ ]' e
- Features::BlockFeatureBuilder *blockFeatureBuilder;
; W ]) l% R/ u1 l; R C1 H - blockFeatureBuilder = workPart->Features()->CreateBlockFeatureBuilder(null_block_feature);
# k! I2 L8 y$ r+ K - //parameters settings
. A! R+ e) i3 a) q, J4 K$ N - blockFeatureBuilder->SetOriginAndLengths(origin,length,width,height);
; W$ c& x m# x# \. u - //commit 1 c" E( `3 v5 l9 c! Y ^( t4 d
- blockFeatureBuilder->CommitFeature();/ w) H& n3 @( ~0 G; N, ^
- //destory
- R* }7 g# S& S - blockFeatureBuilder->Destroy();
& e6 _5 i1 p" [ }
复制代码 4 w8 ^0 K. a# U% d; ?" S6 f
9 O6 r3 h3 ^$ Q
高清视频分享:, J8 M' v2 `( x+ K g, h2 g! s
- v6 |* {5 w. b1 ]5 j
: K2 \5 ^6 G: n. P9 `- {6 B/ D |