|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
2 S1 y6 _( ?/ F7 {9 J
" ?/ A" a2 }6 C* u+ K9 r2 M6 X4 e, U' l( [- N; B9 f$ e. c) E
创建一个选择feature的功能,当用户选择的是sphere的时候,让用户选择更改球的直径!
- O4 g6 Z: Y4 \( T
9 H3 l! e4 |$ D9 BSession *theSession = Session::GetSession();1 t* a. n1 n/ @, @, D
UI *theUI = UI ::GetUI();& l/ |8 e% P p7 p% p& H0 m
Part *workPart (theSession->Parts()->Work());% n, s; Q d) c( t& z6 S n
% t8 \) D) v1 g6 N: J* l- ]- V // initialize the select
# ]. S9 y3 I, B' I( g std::vector <Selection::MaskTriple> masks(1);
% Y& Z/ D8 I8 j! ]: N5 T Selection::MaskTriple mask;
- O( i0 \; k2 w$ A. u+ Z8 F! U mask.Type=UF_feature_type;
6 t/ F& W, k" c, |9 ` mask.Subtype =0;" @/ S" Y _' R6 e- i2 E1 X9 ? G
mask.SolidBodySubtype=0;- ?) V# Z+ `* N e" L( {9 [
masks.push_back(mask);
$ O+ k' Z/ G) _% N0 O/ A //masks[0] = {{UF_feature_type,0,0}};2 S8 b" {) N- y3 ]" e
TaggedObject *object;- G" j: F' B/ n, Z# R+ B. u- Q; \0 w5 k
std::stringstream ss;
8 m$ M: i, t# @ ?' Y2 {9 v5 ` Point3d cursor;
& X5 ~( ?8 G" V# T K) m Selection::SelectionScope scope = Selection::SelectionScopeUseDefault;
& S- W9 W ?$ R- U2 T Selection::SelectionAction action = Selection::SelectionActionClearAndEnableSpecific;4 L0 ?6 H i' D- m
Selection::Response res;
9 b' ?+ G3 p+ D1 h Features::Feature * getFeature = NULL;+ E; Z6 d3 J; N- u% H6 e) I
res = theUI->SelectionManager()->SelectTaggedObject("select a feature:","feature select",scope,action,false,false,masks,&object,&cursor);
; h7 u0 V( t o& e4 A8 b( ] if(res == Selection::ResponseObjectSelected || res == Selection::ResponseObjectSelectedByName)2 m; ~+ g' [6 a/ \
{0 i7 k; M! w- X9 H' y
// get the information# i6 G4 Y$ r9 p4 a
getFeature = dynamic_cast<Features::Feature *>(object);
0 c, W9 y) o6 N s) l) g4 w; b( P( ^9 \) l: _
theSession->ListingWindow()->WriteLine("the select feature type is : " +getFeature->FeatureType() + "\n");" r }) I2 o3 \) z3 i) @
& N5 f- I1 j: O" c- ^& H if (!strcmp(getFeature->FeatureType().GetUTF8Text(),"SPHERE"))
, v9 ~* w$ B1 a$ n2 V. n" q: ] {
- v% Z* F( n. T% t# O$ p' L Features::Sphere *getSphere = dynamic_cast<Features::Sphere *>(getFeature);) F9 y9 [; J2 g0 m
std::vector<Expression *> exp = getSphere->GetExpressions();2 p7 g9 W- {5 ^6 o& R5 l
ss << exp.size() <<endl;
, |/ u( y+ B- ~, V theSession->ListingWindow()->WriteLine("the expression number is : " + ss.str() );; B7 V. Y& Y8 S$ g% S
for(unsigned int i =0 ; i< exp.size();i++)7 f. \7 S& k+ i9 C( Q+ R/ r
{
9 I5 Z, r" U8 |& b. n3 j# Y; e. J' U theSession->ListingWindow()->WriteLine("The expressions are : " + exp[i]->Equation()+"\n");
s. s% a# Q$ f/ O/ Y) Z" [$ {1 i' m }
! T3 F* e4 E6 {/ N s3 f Session::UndoMarkId undomark = theSession->SetUndoMark(Session::MarkVisibilityVisible,"change the exp");" ^' D5 u2 [+ W- y
exp[0]->SetRightHandSide("400");
3 \: i/ G4 b6 Y, f theSession->UpdateManager()->DoUpdate(undomark);
2 E& o: m! x# a. h) O. C8 \5 t* B theSession->ListingWindow()->WriteLine("The expressions are : " + exp[0]->Equation()+"\n");
) \8 u" R& P8 w% b% h }
: Y9 t {7 x5 d7 C/ I }
* ~0 d* [/ z) ~- M7 g0 Q
, U3 y5 m9 i+ c7 N( ^" l2 k2 [+ a/ Z: r* e+ m& u7 {9 C) @
|
|