|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【PLM之家NX二次开发自动装配项目】1.6 创建固定约束
$ v7 R: i) Z1 l3 p8 t/ N0 A% K) m装配约束的创建过程,如何创建一个对象的约束为固定约束!: f& `' Q/ ^2 j$ e
8 H/ [. g. t* P. I# ] N, j. k0 g% J
" s) q4 Y' p5 U1 b8 Q4 J// 创建固定约束6 J( d4 u0 e# l: _7 z2 D% P; P) y
, m6 g d( B% o! O0 `/ M
; p6 O- `" d% m- x* M0 X Positioning::ComponentPositioner *componentPositioner1;
9 O) W5 z6 P+ I* v9 ? componentPositioner1 = workPart->ComponentAssembly()->Positioner();
/ R5 z2 W) ~! X5 N% C( l componentPositioner1->ClearNetwork();% K+ I3 f6 F o" q0 J' V' ~
componentPositioner1->BeginAssemblyConstraints();8 B2 P+ K, I$ [/ {
Positioning::Network *network1;% F4 ^! X4 X7 K/ w5 |% \
network1 = componentPositioner1->EstablishNetwork();
+ s! D9 U& K% Z) Y: Q) | Positioning::ComponentNetwork *componentNetwork1(dynamic_cast<Positioning::ComponentNetwork *>(network1));
' [% _ @/ E: ]3 { z) O componentNetwork1->SetMoveObjectsState(true);2 W, s" G5 L* }$ q- E1 R
Assemblies::Component *nullAssemblies_Component(NULL);
5 T1 k6 K D; p3 ]3 t componentNetwork1->SetDisplayComponent(nullAssemblies_Component);
/ U/ m( ]) t9 A1 p+ G- ^ componentNetwork1->SetNetworkArrangementsMode(Positioning::ComponentNetwork::ArrangementsModeExisting);. H& y9 ~- x$ Y9 G$ h
Positioning::Constraint *constraint1;& o1 M# m1 }/ `$ U' X
constraint1 = componentPositioner1->CreateConstraint(true);" W: T: [ b8 Y* d" E, q) \; G
Positioning::ComponenTConstraint *componentConstraint1(dynamic_cast<Positioning::ComponentConstraint *>(constraint1));2 {( n$ G6 _: B. @
componentConstraint1->SetConstraintType(Positioning::Constraint::TypeFix);
% h; j1 [6 U3 ~: l2 q) Y Positioning::ConstraintReference *constraintReference1;2 l8 w. V) y; R5 M3 D
constraintReference1 = componentConstraint1->CreateConstraintReference(component1, component1, false, false, false);0 h% p2 E- S3 F3 f
Point3d helpPoint1(0, 0, 0);0 t' k8 n- e) s6 N1 ~8 |/ r7 i; i
constraintReference1->SetHelpPoint(helpPoint1);
9 p! E3 V9 _1 R3 @6 K2 ?3 J1 A componentNetwork1->Solve();0 r8 c. r+ q" t% T
componentPositioner1->ClearNetwork();
1 g# G) c" x7 K- g5 C componentPositioner1->DeleteNonPersistentConstraints();
7 O% |) a9 A' H" |! u3 [ ]0 N Assemblies::Arrangement *nullAssemblies_Arrangement(NULL);
9 x' \- ~0 p4 T8 u- e" z. M& e componentPositioner1->SetPrimaryArrangement(nullAssemblies_Arrangement);& O) t" g1 B. x, k
componentPositioner1->EndAssemblyConstraints();) L7 A5 {- A8 Y) O/ @3 ]
6 o0 ]% S) N+ j! F4 y
|
|