|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【PLM之家NX二次开发自动装配项目】1.6 创建固定约束% {+ x5 d0 o3 O# g* Q, j
装配约束的创建过程,如何创建一个对象的约束为固定约束!6 o9 P! n* Z4 C3 P1 v8 [% u
& q; ^+ J& X% y* T0 ]
9 ?% D1 y& Z9 H* } j- L
4 f3 j* C4 f6 j# g- O2 A// 创建固定约束" S0 L, G( w4 y
2 e. Y- u# D/ B0 s" j, p8 `" v* H
9 E7 G/ }5 e$ Z0 d; R; h Positioning::ComponentPositioner *componentPositioner1;
) ? Z' X( l5 O5 g6 E componentPositioner1 = workPart->ComponentAssembly()->Positioner();
9 Z5 D6 u0 T6 X/ t/ y' M componentPositioner1->ClearNetwork();, B9 K' ?0 }* H: Q& B3 N/ p9 n4 d) B
componentPositioner1->BeginAssemblyConstraints();$ H2 U, l& ^$ ^. I5 Q
Positioning::Network *network1;
$ f+ e0 `7 V. v4 o$ R network1 = componentPositioner1->EstablishNetwork();4 c7 F% a3 g/ i
Positioning::ComponentNetwork *componentNetwork1(dynamic_cast<Positioning::ComponentNetwork *>(network1));" e" V! d1 c0 X, C" k; Q
componentNetwork1->SetMoveObjectsState(true);
0 ~( P3 d2 |2 E Assemblies::Component *nullAssemblies_Component(NULL);7 j9 o/ B4 t% h
componentNetwork1->SetDisplayComponent(nullAssemblies_Component);* D. \2 j) n# V1 Z- I
componentNetwork1->SetNetworkArrangementsMode(Positioning::ComponentNetwork::ArrangementsModeExisting);
) |2 C, @* k/ M1 b Positioning::Constraint *constraint1;
$ |% K3 F$ Y3 M1 E* i5 \: T constraint1 = componentPositioner1->CreateConstraint(true);# z) E$ F O- j9 T/ K" x8 j" f
Positioning::ComponenTConstraint *componentConstraint1(dynamic_cast<Positioning::ComponentConstraint *>(constraint1));% f. G" x& |2 W8 l" ]% ?* Z
componentConstraint1->SetConstraintType(Positioning::Constraint::TypeFix);
* d8 _; u6 m' P- b) l- _7 \ Positioning::ConstraintReference *constraintReference1;" l. u6 ^4 U6 x5 V2 {
constraintReference1 = componentConstraint1->CreateConstraintReference(component1, component1, false, false, false);
' K# x1 Q! k. U F$ _8 y Point3d helpPoint1(0, 0, 0);
1 M5 ]/ I0 J3 c* z% Z- v constraintReference1->SetHelpPoint(helpPoint1);" \8 a3 e. o# P& W4 v
componentNetwork1->Solve();+ R) @3 ~6 u5 m% J Z& K2 p
componentPositioner1->ClearNetwork();
- \ \) u% b' {6 E" y5 o' { componentPositioner1->DeleteNonPersistentConstraints();
1 C3 ]5 q( f, c- t% P% o2 P Assemblies::Arrangement *nullAssemblies_Arrangement(NULL);9 S* j$ S8 F9 g" D6 a
componentPositioner1->SetPrimaryArrangement(nullAssemblies_Arrangement);
* f8 F8 e8 ^0 ` componentPositioner1->EndAssemblyConstraints();5 {! K: I6 w) [8 M4 m
4 u7 L2 _( ~# ~- D( v) `8 V2 B% W |
|