|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【PLM之家NX二次开发自动装配项目】1.6 创建固定约束# V: l& m, F1 a7 ]: u$ @ A" b5 G
装配约束的创建过程,如何创建一个对象的约束为固定约束!5 R; `; _& _& Z6 `- i' K, w5 e
0 X- j% Q6 D( }- x& Y1 W/ F0 C$ p% a U& h/ P! m
4 s' R* Q% T* B9 _" I& B5 J
// 创建固定约束
, N. U/ r& z8 i; \, }
5 V+ {+ V/ c4 J1 H, Q& _+ @# ^) N0 v- L+ i
Positioning::ComponentPositioner *componentPositioner1;
. J& f4 m2 l$ r# ^0 O- _ componentPositioner1 = workPart->ComponentAssembly()->Positioner();
& E5 W3 N$ Z3 h4 g% `+ U9 H componentPositioner1->ClearNetwork();
( a# e4 T1 x- _: K; f componentPositioner1->BeginAssemblyConstraints();" ?3 d! Z1 e5 [
Positioning::Network *network1; F1 Z' \& K7 Y: W1 k
network1 = componentPositioner1->EstablishNetwork();' e+ Z. ?; a9 \, E
Positioning::ComponentNetwork *componentNetwork1(dynamic_cast<Positioning::ComponentNetwork *>(network1));, D5 k5 y" n4 n( A8 b: K8 Q
componentNetwork1->SetMoveObjectsState(true);
, B* w' E- ~8 ^0 {4 P# U Assemblies::Component *nullAssemblies_Component(NULL);
/ ? X+ k6 H5 B0 H! D componentNetwork1->SetDisplayComponent(nullAssemblies_Component);
: [- M5 l8 ]& z! _ componentNetwork1->SetNetworkArrangementsMode(Positioning::ComponentNetwork::ArrangementsModeExisting);9 l6 p' i. Q3 b
Positioning::Constraint *constraint1;
. j( e8 A' l b* b3 @" m! D2 { constraint1 = componentPositioner1->CreateConstraint(true);
0 ]* z2 m3 ?' v) _* q7 ?2 u" Q Positioning::ComponenTConstraint *componentConstraint1(dynamic_cast<Positioning::ComponentConstraint *>(constraint1));# N9 G9 l9 {% O! M; R) p
componentConstraint1->SetConstraintType(Positioning::Constraint::TypeFix);
! m2 ~" E3 C/ o+ b. s1 \8 b Positioning::ConstraintReference *constraintReference1;
9 q* j( g) [3 S# W' ]& k constraintReference1 = componentConstraint1->CreateConstraintReference(component1, component1, false, false, false);
1 x( E2 q9 B8 T% n2 p5 U! C Point3d helpPoint1(0, 0, 0);
" w6 M1 x% Y3 ]7 n5 S0 W$ h constraintReference1->SetHelpPoint(helpPoint1);
^7 x: n9 H7 a, H% c" j componentNetwork1->Solve();/ A: _2 |3 |$ [, J6 Q% v( s
componentPositioner1->ClearNetwork();
& z9 i+ P6 ^; |9 ]# x componentPositioner1->DeleteNonPersistentConstraints();
+ g; H4 f) K" ~6 I Assemblies::Arrangement *nullAssemblies_Arrangement(NULL);
- [0 m/ J9 r- Z+ N- f f# i componentPositioner1->SetPrimaryArrangement(nullAssemblies_Arrangement);8 r2 v* z3 W# C( L
componentPositioner1->EndAssemblyConstraints();
" X Y, l4 M! N
5 x1 D J7 F! ` |
|