|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【PLM之家NX二次开发自动装配项目】1.6 创建固定约束
0 u. m" {* V; G( D/ n4 i' s装配约束的创建过程,如何创建一个对象的约束为固定约束!( {$ P/ ?0 X" \5 J: u X/ _) ^7 L
4 v' a7 b { r& F$ m$ p" @2 E0 H S( _* l+ C3 `9 n
o) M2 ^% c) O
// 创建固定约束# z# f9 e. ]3 `6 g
% m5 A2 J8 V' ~$ G, n: t
# N) p/ n6 j5 N0 j7 S Positioning::ComponentPositioner *componentPositioner1; C: r' P2 G, Y* m4 C1 {
componentPositioner1 = workPart->ComponentAssembly()->Positioner();
, Q( j4 |$ Y# Y componentPositioner1->ClearNetwork();
2 d5 p; \; B7 g componentPositioner1->BeginAssemblyConstraints();
- g2 ^/ @1 L0 |7 p, z6 W5 Q Positioning::Network *network1;
! g0 T7 O. F2 x network1 = componentPositioner1->EstablishNetwork();% Q* E2 w' ?0 g: W
Positioning::ComponentNetwork *componentNetwork1(dynamic_cast<Positioning::ComponentNetwork *>(network1));, g9 z8 U* [4 \8 H
componentNetwork1->SetMoveObjectsState(true);# E' H: v' @/ h* p7 ]1 C& B9 a
Assemblies::Component *nullAssemblies_Component(NULL);
9 i# [9 f. \' L" e8 O! G7 Y# B componentNetwork1->SetDisplayComponent(nullAssemblies_Component);& A/ ~# ~) C2 l& Z: L0 ]
componentNetwork1->SetNetworkArrangementsMode(Positioning::ComponentNetwork::ArrangementsModeExisting);
; G8 Y) ^; z* M2 I) s2 V6 E( Q7 Z$ V1 D Positioning::Constraint *constraint1;+ K- M9 C) U! F, ~: ]* R, A6 }
constraint1 = componentPositioner1->CreateConstraint(true);3 @, \* s0 ?. h2 w+ R9 N- H
Positioning::ComponenTConstraint *componentConstraint1(dynamic_cast<Positioning::ComponentConstraint *>(constraint1));: E$ Q( `) Q1 q: t& @: w' E
componentConstraint1->SetConstraintType(Positioning::Constraint::TypeFix);6 C+ s3 J7 J# r( R5 d6 Y
Positioning::ConstraintReference *constraintReference1;$ g2 F. z/ H4 n5 z$ t+ x
constraintReference1 = componentConstraint1->CreateConstraintReference(component1, component1, false, false, false);
$ i1 A7 ~/ d3 N2 C0 Z7 J) Q! N& X Point3d helpPoint1(0, 0, 0);
' D6 j4 ? n0 j4 W5 O; t% c6 E constraintReference1->SetHelpPoint(helpPoint1);
. l6 V& F% X d componentNetwork1->Solve();' g0 [' w# J" Y- u5 o- P9 E0 L
componentPositioner1->ClearNetwork();
2 P% i) y7 M3 U! Q- D% O5 U6 B componentPositioner1->DeleteNonPersistentConstraints();
2 z' U% t( }3 `" J6 u' w% m Assemblies::Arrangement *nullAssemblies_Arrangement(NULL);2 s/ E, J, K! F5 N% q
componentPositioner1->SetPrimaryArrangement(nullAssemblies_Arrangement);8 V( E3 c- e' b% `
componentPositioner1->EndAssemblyConstraints();$ v6 g' D- P# s9 Z% x
1 e9 p+ F8 Z, }9 e
|
|