|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【PLM之家NX二次开发自动装配项目】1.6 创建固定约束$ h8 m% g5 [* U" E% y. V
装配约束的创建过程,如何创建一个对象的约束为固定约束!
' L8 `& Q$ r* F( f
+ z7 ^: B. x% I3 I3 d; U* y! i
2 @/ \- j( y7 c' q9 F) R6 d2 X( t5 V0 i, b: ~
// 创建固定约束
9 n9 Q) p/ e8 K& i; t- |+ E' n$ T/ X3 ]$ h9 J n6 d/ b2 M
2 g( }- C4 D9 H Positioning::ComponentPositioner *componentPositioner1;) ]3 y) { J4 i" F8 _7 x; M
componentPositioner1 = workPart->ComponentAssembly()->Positioner();
! O) a; B& c y) h5 b( {- a componentPositioner1->ClearNetwork();: Z# k" O3 e% _: s2 S
componentPositioner1->BeginAssemblyConstraints();' Z$ c7 d7 v2 t. E
Positioning::Network *network1;
3 P# P( l+ t2 Z: Z* x2 o# b5 J network1 = componentPositioner1->EstablishNetwork();8 ?2 g0 O8 [+ ^
Positioning::ComponentNetwork *componentNetwork1(dynamic_cast<Positioning::ComponentNetwork *>(network1));
$ w9 Q _3 c+ F+ S- Z componentNetwork1->SetMoveObjectsState(true);# |4 o0 q7 k- l
Assemblies::Component *nullAssemblies_Component(NULL);: {: d& L/ i! Q
componentNetwork1->SetDisplayComponent(nullAssemblies_Component);
2 N, q* i! W( h) _0 N* r componentNetwork1->SetNetworkArrangementsMode(Positioning::ComponentNetwork::ArrangementsModeExisting);! }+ Z$ R% k1 ]# Q2 ]3 h) Q6 y: e
Positioning::Constraint *constraint1;. s, F2 ~8 S2 H8 f% G
constraint1 = componentPositioner1->CreateConstraint(true);
3 I' B5 v' s+ l3 z, ?% G3 [, e Positioning::ComponenTConstraint *componentConstraint1(dynamic_cast<Positioning::ComponentConstraint *>(constraint1));
8 W' }8 M' J9 l2 ]- ~ componentConstraint1->SetConstraintType(Positioning::Constraint::TypeFix);
, Z1 O* k" X: c9 E: `, `* ` Positioning::ConstraintReference *constraintReference1;+ P' s! v* E2 j5 K, T8 z( k" j& u
constraintReference1 = componentConstraint1->CreateConstraintReference(component1, component1, false, false, false);3 d! ^! o5 f4 B* z& V2 ^" e
Point3d helpPoint1(0, 0, 0);
0 P% g9 L/ D- r6 p constraintReference1->SetHelpPoint(helpPoint1);
5 Y3 \: G6 m% c8 P( E/ D7 _# \ componentNetwork1->Solve();
9 o1 K# ~3 ^ W componentPositioner1->ClearNetwork();- T4 q9 o: M5 f9 C( @
componentPositioner1->DeleteNonPersistentConstraints(); u5 [: Q* x# S6 p) m
Assemblies::Arrangement *nullAssemblies_Arrangement(NULL);4 N) ?6 A" D/ l" I5 R6 N% V
componentPositioner1->SetPrimaryArrangement(nullAssemblies_Arrangement);0 E/ `6 x+ L* T' H0 l" F; U
componentPositioner1->EndAssemblyConstraints();
: G3 D2 O; l' e$ W* X
- x; O- s( N! U1 Y+ L5 n |
|