|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
, h3 L2 q2 y3 H# ]
5 n- C: o( I; {( q4 ?, X
' f% L: C- c4 q V9 v' h+ I* t创建一个选择feature的功能,当用户选择的是sphere的时候,让用户选择更改球的直径!
: L# {; X) E# S% n; x: B. W. ]! S( a
Session *theSession = Session::GetSession();
) u' M% D. ~1 E8 {% X) r UI *theUI = UI ::GetUI();
: `* u3 F' e) a( S9 a' i, ^ Part *workPart (theSession->Parts()->Work());6 _* k9 ] e/ t$ \# ]
3 z8 H, |* {6 l8 X- i
// initialize the select ; c6 r6 w* L" z4 l7 F
std::vector <Selection::MaskTriple> masks(1);& q" _0 S0 b* G; J5 u
Selection::MaskTriple mask;
4 K: [ f# H" ~2 y( A: y- x3 k0 l mask.Type=UF_feature_type;% y) u! j8 O8 b2 L
mask.Subtype =0;
* ? F3 A) X. r* _" f mask.SolidBodySubtype=0;) ^5 n/ P A _- x) r% Z/ v/ T
masks.push_back(mask);
* _- f, N8 A% Z h% M A9 Q) l //masks[0] = {{UF_feature_type,0,0}};7 ~$ j% e$ t5 l. s2 z% d f
TaggedObject *object;
' k- W- Y8 A# w- d5 q# { std::stringstream ss;" q9 l0 j2 a7 Q6 t( p9 N; ^* Y+ T1 l
Point3d cursor;) J6 s- e# F5 [; H2 u
Selection::SelectionScope scope = Selection::SelectionScopeUseDefault;8 E! S- D* F3 T
Selection::SelectionAction action = Selection::SelectionActionClearAndEnableSpecific;
4 W) P7 L) a+ l2 x. D- `5 r1 H) _ Selection::Response res;
3 t5 H$ S4 }! Y. v Features::Feature * getFeature = NULL;
8 d& T' q3 k+ ]/ p0 a/ b# R# \ res = theUI->SelectionManager()->SelectTaggedObject("select a feature:","feature select",scope,action,false,false,masks,&object,&cursor);7 ]; X& t! t- y
if(res == Selection::ResponseObjectSelected || res == Selection::ResponseObjectSelectedByName)
7 L8 w; e: v3 s, i$ \4 E( { {1 x3 C, ]+ N+ m) K7 s- ^
// get the information. G. B0 G# a, {* d3 A, r/ T
getFeature = dynamic_cast<Features::Feature *>(object);
6 Y" i. o% l r% V8 {6 x1 V9 V* w+ n; l
theSession->ListingWindow()->WriteLine("the select feature type is : " +getFeature->FeatureType() + "\n");
8 s, N4 Q L+ U5 f/ m" ~& e, ^/ s% M+ b' c
if (!strcmp(getFeature->FeatureType().GetUTF8Text(),"SPHERE"))
- I6 F! c3 C5 J/ \% j3 F {2 I: ?8 c$ ]! _& @1 [) e* e' Q
Features::Sphere *getSphere = dynamic_cast<Features::Sphere *>(getFeature);
, R6 e6 s: A8 \ w4 o) F: a: ^! X std::vector<Expression *> exp = getSphere->GetExpressions();
( D/ y7 f! }5 ^2 F4 p* `' [5 \ ss << exp.size() <<endl;
) N, T. K4 e5 G9 s9 F theSession->ListingWindow()->WriteLine("the expression number is : " + ss.str() ); @, ?8 W6 p& X; @+ {+ r
for(unsigned int i =0 ; i< exp.size();i++)9 C' X' M# h8 O% t+ z7 \0 @
{
: i3 }: }9 K6 D7 V# v theSession->ListingWindow()->WriteLine("The expressions are : " + exp[i]->Equation()+"\n");
3 w9 S& ~% m* Y N6 h0 M }4 f+ t: j- D% s* t$ N$ t
Session::UndoMarkId undomark = theSession->SetUndoMark(Session::MarkVisibilityVisible,"change the exp");0 M$ Z9 g0 f& }1 I
exp[0]->SetRightHandSide("400");
o" H" C8 p1 Y0 y# ^' y; i theSession->UpdateManager()->DoUpdate(undomark);) [* V3 i; {6 n; H& R7 s' J& G3 N, _0 S
theSession->ListingWindow()->WriteLine("The expressions are : " + exp[0]->Equation()+"\n");
5 V E+ g3 o9 X* w. g9 \ }
. w2 A3 M- u# S- b+ _& T }6 _! m; w( c* m1 Y; ^
! `- j9 l" J$ k Z
$ O- d8 s/ w1 x- e# [
|
|