|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【PLM之家NX二次开发自动装配项目】1.6 创建固定约束
& X- I7 s, \$ @/ F1 |+ Y! Z' @装配约束的创建过程,如何创建一个对象的约束为固定约束!% o, |- i, T4 f1 ?* g3 m. e9 V( ^! T
5 }2 G9 k/ D7 z; h8 T, v
1 Y' R1 X7 Z6 i9 P1 @
9 m) j+ J. J" R2 l! l! i" \// 创建固定约束) e l o* |5 @! t& ~) Z! D
. x7 v" _' C9 r3 M) D
4 d; j! ^; P0 r; e Positioning::ComponentPositioner *componentPositioner1;
, \" F9 W. \+ e componentPositioner1 = workPart->ComponentAssembly()->Positioner(); Q" x) |+ y* _
componentPositioner1->ClearNetwork();
8 o* s6 a' @; S w3 W componentPositioner1->BeginAssemblyConstraints();; @5 ]% x+ b- }' v0 D8 ~
Positioning::Network *network1; G; s& _. ^" k
network1 = componentPositioner1->EstablishNetwork();
2 k* `: u3 N9 N Positioning::ComponentNetwork *componentNetwork1(dynamic_cast<Positioning::ComponentNetwork *>(network1));
# Y9 P7 f$ X0 G6 s componentNetwork1->SetMoveObjectsState(true);% S; F& i+ Z& R+ f$ O! O
Assemblies::Component *nullAssemblies_Component(NULL);) s; q" z- j% y( V: o1 ^
componentNetwork1->SetDisplayComponent(nullAssemblies_Component);. R" n# P: n I' N' Z0 H1 E6 A
componentNetwork1->SetNetworkArrangementsMode(Positioning::ComponentNetwork::ArrangementsModeExisting);
0 O7 S9 W$ A2 e; [# v' o. z$ Q Positioning::Constraint *constraint1;, h' N+ X8 A8 h; d6 ^; ]
constraint1 = componentPositioner1->CreateConstraint(true);
* A" F# K0 `* {) c* u2 d* o Positioning::ComponenTConstraint *componentConstraint1(dynamic_cast<Positioning::ComponentConstraint *>(constraint1));
! I4 c' t8 w# y4 b3 R3 {# ~ componentConstraint1->SetConstraintType(Positioning::Constraint::TypeFix);
: C R, B4 L9 b7 `1 [, j) i) e Positioning::ConstraintReference *constraintReference1;( i% W" u9 G2 w, a8 e' F
constraintReference1 = componentConstraint1->CreateConstraintReference(component1, component1, false, false, false);
i- R8 R1 K8 g! I9 o% d+ J7 h+ E Point3d helpPoint1(0, 0, 0);' y# S. R5 E+ v/ O H1 [
constraintReference1->SetHelpPoint(helpPoint1);
9 L" R( w5 R' M) ~ componentNetwork1->Solve();
1 u' |! e8 S5 _/ D& y4 M8 ]5 B componentPositioner1->ClearNetwork();4 ]' s( d3 v& \+ `
componentPositioner1->DeleteNonPersistentConstraints();& Y8 B' r# }: [% a- o$ M; z7 w1 C
Assemblies::Arrangement *nullAssemblies_Arrangement(NULL);& u, G+ n5 K9 v
componentPositioner1->SetPrimaryArrangement(nullAssemblies_Arrangement);
! P+ ]( \, b& c- q! Z: H# z, O/ ] componentPositioner1->EndAssemblyConstraints();
& F, \2 T4 {1 W4 I5 F0 o7 S3 V \3 G
+ |1 B! @$ u- Q V) ^ |
|