|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
* m$ B, a9 ^1 j3 y, t
0 x" {* e* A7 ?0 Y$ t3 }; k8 \
3 B/ Y0 q$ ~9 B: D B" q
创建一个选择feature的功能,当用户选择的是sphere的时候,让用户选择更改球的直径!' B5 c! Z( e- B3 X0 N& u
! N$ D, ?3 K7 `# q
Session *theSession = Session::GetSession();
2 H7 L! g+ s, Q UI *theUI = UI ::GetUI();
( X( c$ j2 t+ M- h, |, c Part *workPart (theSession->Parts()->Work());
4 R8 t) m5 x1 w$ l2 [% [
: r6 S! s: o! X7 s, M; {1 n- G( _ // initialize the select " R- M% a2 A, ?- k1 S' k
std::vector <Selection::MaskTriple> masks(1);
% r$ l6 Q4 `" O) X Selection::MaskTriple mask;
& ^6 t F" k0 |6 C; O mask.Type=UF_feature_type;
0 [0 O3 J+ o" Q% f2 N. B( s7 H- y. B mask.Subtype =0;
. x! x5 ?, d) |# ?% U! [! C mask.SolidBodySubtype=0;
8 c: ]0 R' H3 @8 T masks.push_back(mask);
5 Y' W9 ]5 B, Q4 e, `$ \* F //masks[0] = {{UF_feature_type,0,0}};/ {/ C6 \+ H2 J4 }5 b
TaggedObject *object;
) l8 L( Y) n) w! | std::stringstream ss;' s5 T K# X- k# F- [9 z! o& V9 a
Point3d cursor;
# b$ Q7 d) x1 o8 p! J, ]1 K Selection::SelectionScope scope = Selection::SelectionScopeUseDefault;4 v$ s0 Z: C7 W0 p" Z
Selection::SelectionAction action = Selection::SelectionActionClearAndEnableSpecific;
6 E# D* z/ R/ @8 } Selection::Response res;
4 N# n3 S' j: n+ c Features::Feature * getFeature = NULL;% B6 J$ s: T* F
res = theUI->SelectionManager()->SelectTaggedObject("select a feature:","feature select",scope,action,false,false,masks,&object,&cursor);
& t/ q6 A3 G2 I7 j5 G5 I+ @ if(res == Selection::ResponseObjectSelected || res == Selection::ResponseObjectSelectedByName); x4 P, G' A2 a, y
{
7 `' J: ?5 w8 o9 c( p1 [2 J // get the information3 H; `( G; A2 ^* x' v) U
getFeature = dynamic_cast<Features::Feature *>(object);
, P# P c) n1 |6 \7 B% m
0 D$ l3 _% ^9 v- `1 \2 g. e0 t theSession->ListingWindow()->WriteLine("the select feature type is : " +getFeature->FeatureType() + "\n");* E* e. Q6 r8 u2 @0 e
& E4 N4 R4 x5 L5 x! ~
if (!strcmp(getFeature->FeatureType().GetUTF8Text(),"SPHERE"))! }! I n/ e5 _7 _4 Q
{
. v/ [ U7 ?, c9 k Features::Sphere *getSphere = dynamic_cast<Features::Sphere *>(getFeature);
6 G* c$ ?" z: b# u std::vector<Expression *> exp = getSphere->GetExpressions();# b: L( ]9 O% | Z1 G* s$ L0 I
ss << exp.size() <<endl;( s" p6 I9 C' O" C5 A* g& S8 S' x
theSession->ListingWindow()->WriteLine("the expression number is : " + ss.str() );. {6 n3 j/ z4 j( x% V: g
for(unsigned int i =0 ; i< exp.size();i++)6 p. f2 e' O$ h8 D2 N1 B1 l
{
. P/ J. m o% | theSession->ListingWindow()->WriteLine("The expressions are : " + exp[i]->Equation()+"\n");
* s- X2 e" X; _6 ]8 q }" y v1 l q& n% r' H& p6 `' K
Session::UndoMarkId undomark = theSession->SetUndoMark(Session::MarkVisibilityVisible,"change the exp");
/ ~' c5 o1 M( s exp[0]->SetRightHandSide("400");- Q, Q6 Y) n2 C. P% L1 D4 p
theSession->UpdateManager()->DoUpdate(undomark);
3 m$ \% `# y1 l2 M theSession->ListingWindow()->WriteLine("The expressions are : " + exp[0]->Equation()+"\n");
& i; \2 j/ e5 U8 E! M }
5 M# e5 v+ e r) a' Z F/ e: U: s3 ? }
) w* P9 [0 e2 x! x
; D: ?: M+ D0 Q7 y- v
% F/ ~2 N4 _/ E |
|