|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【PLM之家NX二次开发自动装配项目】1.6 创建固定约束
6 k/ r& r( s" e! o! ^装配约束的创建过程,如何创建一个对象的约束为固定约束!/ h" K' q2 `$ X
+ Q$ p( a8 b. e9 T
0 p, d9 |" Y- S$ W4 i: Y1 ?9 V+ M3 h4 q2 c p' m
// 创建固定约束" x# W9 A" }) p/ e- Y# [2 `) ^
4 P( j: N) M) M+ N& M9 @5 A7 c
* _6 B( S, s8 ~3 g9 V Positioning::ComponentPositioner *componentPositioner1;6 A$ U, }: |# G1 X9 M0 r) p
componentPositioner1 = workPart->ComponentAssembly()->Positioner();
: k2 _& M8 o# a2 ^ componentPositioner1->ClearNetwork();: ?9 i3 p0 L9 _3 X/ s
componentPositioner1->BeginAssemblyConstraints();
6 d9 I: n+ L, l1 I: @ Positioning::Network *network1;
: {) J3 m& @* C3 R+ i; v network1 = componentPositioner1->EstablishNetwork();! A/ S' r) ^2 s
Positioning::ComponentNetwork *componentNetwork1(dynamic_cast<Positioning::ComponentNetwork *>(network1));& }! l8 Y3 Y- F' p- E0 a+ N$ c
componentNetwork1->SetMoveObjectsState(true);2 t' H' P- R# b& @
Assemblies::Component *nullAssemblies_Component(NULL);: K# m+ O9 ^1 q3 i5 P6 `2 [8 r" W
componentNetwork1->SetDisplayComponent(nullAssemblies_Component);0 R/ D1 G% V( H
componentNetwork1->SetNetworkArrangementsMode(Positioning::ComponentNetwork::ArrangementsModeExisting);
4 c; G: J8 Z% k, f* @8 z% | p Positioning::Constraint *constraint1;
6 m1 w0 l Z+ j' G+ m constraint1 = componentPositioner1->CreateConstraint(true);& D( b0 |; u# r( Q% i
Positioning::ComponenTConstraint *componentConstraint1(dynamic_cast<Positioning::ComponentConstraint *>(constraint1));
* r9 b$ |' R) C" Q; l: O" X componentConstraint1->SetConstraintType(Positioning::Constraint::TypeFix);7 U7 n) v9 {# x) M" `
Positioning::ConstraintReference *constraintReference1;
: g; `. u1 Y: y9 l. w constraintReference1 = componentConstraint1->CreateConstraintReference(component1, component1, false, false, false);& E, y* `) {1 E+ d( ^1 e2 L% Q
Point3d helpPoint1(0, 0, 0);3 G" t+ R6 k, I7 m+ B
constraintReference1->SetHelpPoint(helpPoint1);2 X6 c |) [+ i$ ?0 D% e
componentNetwork1->Solve();
6 T& [! M A4 W2 V8 [& y. ?4 I0 y componentPositioner1->ClearNetwork();
! w' U5 v3 Y9 } N' m componentPositioner1->DeleteNonPersistentConstraints();0 S' w$ k3 a v. v( }% p7 F
Assemblies::Arrangement *nullAssemblies_Arrangement(NULL);
& u0 @' H; U- G n1 e componentPositioner1->SetPrimaryArrangement(nullAssemblies_Arrangement);$ W, v8 S# Q: p+ b3 Q! [
componentPositioner1->EndAssemblyConstraints();
H* p! a( D; I. h# z }. F/ X1 |5 n$ }& h
|
|