|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
" ? M( d" M3 {, S* w, k6 h3 O& D7 L( s2 X9 p
& Q0 L/ N2 C7 Z! a1 e1 W" D9 k; F
创建一个选择feature的功能,当用户选择的是sphere的时候,让用户选择更改球的直径!' j% J, ]; e- e; ?5 Y# |
9 u8 s, W, G9 t2 _, lSession *theSession = Session::GetSession();- Y! {% H' C& Y( s" c
UI *theUI = UI ::GetUI();7 U3 y: T7 ^: R( G N9 |5 b, d0 d
Part *workPart (theSession->Parts()->Work());
( x+ Q' b& V' D4 O$ g
; @3 I6 N3 z# C4 V+ y# V, t7 R // initialize the select 9 v- l, y3 v" j2 o
std::vector <Selection::MaskTriple> masks(1);9 t+ c4 v" V# |$ r1 r
Selection::MaskTriple mask;' [' z% q; {; w: s0 A
mask.Type=UF_feature_type;
/ G# k& Q: C8 W8 B mask.Subtype =0;+ ?% j0 N7 H$ m' h& s1 g* ~# a
mask.SolidBodySubtype=0;4 p' C$ i7 m% ?# Y5 ^# b
masks.push_back(mask);; U% _. Y2 K) @- Y# w$ V9 h( A
//masks[0] = {{UF_feature_type,0,0}};1 O% r T% j" M, X. A4 w" v6 Q' h
TaggedObject *object;5 I8 A R# ?; R z8 a$ K
std::stringstream ss;3 D! L1 N5 B0 T+ _7 |( L. e
Point3d cursor;
" R" `5 c0 I' b0 Q( J; c% i Selection::SelectionScope scope = Selection::SelectionScopeUseDefault;
/ `7 c0 I% y/ q- u Selection::SelectionAction action = Selection::SelectionActionClearAndEnableSpecific;3 ]2 R- I5 @' U4 B0 @$ d- M
Selection::Response res;
4 ^, T! C! t( n! d& I: L: o& [; n$ {& w Features::Feature * getFeature = NULL;0 Z$ y& ^: D* A8 O
res = theUI->SelectionManager()->SelectTaggedObject("select a feature:","feature select",scope,action,false,false,masks,&object,&cursor);
# o- V+ r- y! k; d9 ~ if(res == Selection::ResponseObjectSelected || res == Selection::ResponseObjectSelectedByName)( i2 C, ^: j& |0 Z9 T' u; i. {- T1 P
{
! U7 X/ k# T1 [- S; K" h- g, [# z: ? // get the information
3 W8 T0 _6 k/ @6 f/ o getFeature = dynamic_cast<Features::Feature *>(object);6 {+ ?& O0 {, f9 H" d7 r
% Z; v+ A% {$ E theSession->ListingWindow()->WriteLine("the select feature type is : " +getFeature->FeatureType() + "\n");+ F6 p( W& h7 `9 w) J) i+ @2 W
- j- e2 y. g4 `
if (!strcmp(getFeature->FeatureType().GetUTF8Text(),"SPHERE"))
, D4 ]! e# s. Z; v/ G {
4 a Q' }2 T9 B5 L4 J( A$ W/ ~( a Features::Sphere *getSphere = dynamic_cast<Features::Sphere *>(getFeature);8 g: m: ?2 j) Y7 P- K2 \( H0 g Q
std::vector<Expression *> exp = getSphere->GetExpressions();* e5 x. E& ? e' @: I0 n! k
ss << exp.size() <<endl;
5 z, D6 y. Z$ m" ~7 I theSession->ListingWindow()->WriteLine("the expression number is : " + ss.str() );
# |% ?4 l) s9 U9 H8 m- A8 V8 G3 T7 Q for(unsigned int i =0 ; i< exp.size();i++)3 w* Z$ Y3 h, {2 k% w( d, i
{ " ?) A* u: O$ m' ~8 T7 y; J4 _# R
theSession->ListingWindow()->WriteLine("The expressions are : " + exp[i]->Equation()+"\n");
- D# A: |9 L j) e* O }! F6 a- y! R# o7 N& ~9 b; x
Session::UndoMarkId undomark = theSession->SetUndoMark(Session::MarkVisibilityVisible,"change the exp");
" W7 X5 H' I9 s6 w exp[0]->SetRightHandSide("400");3 C& ?; [$ w8 a+ \- _
theSession->UpdateManager()->DoUpdate(undomark);
1 o; m' Q2 N1 W, Z C, ?& s theSession->ListingWindow()->WriteLine("The expressions are : " + exp[0]->Equation()+"\n");; k* E: R6 X0 S
}+ S+ @4 O( ?# Y) c; s* A
}" C1 _" H# i$ P" Q4 k5 i7 `. g( Y
: k6 ~( s% I# R. L* C: G, h" W) H3 |" ?' p3 b
|
|