|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【PLM之家NX二次开发自动装配项目】1.6 创建固定约束
2 u( N4 R- [6 z& ^装配约束的创建过程,如何创建一个对象的约束为固定约束!
7 m* y7 ? I: e# s1 T; @3 B
5 m: T2 z) }! e. Q/ p3 V e8 F9 U" Z1 _; j7 u$ k9 C" G1 u0 |4 {
5 T" i% b+ c' f, f7 Z# Y9 i
// 创建固定约束( K, ~7 L3 Q" C* a0 q8 ]1 A8 u; I
) b* ]& n$ a' d H* c+ e
7 I( |& I; A4 \* w
Positioning::ComponentPositioner *componentPositioner1;
, c- s6 O8 j# k4 I5 T& q componentPositioner1 = workPart->ComponentAssembly()->Positioner();/ i# d# L4 |' w# T9 Z! N K6 P
componentPositioner1->ClearNetwork();: x2 \: u' {1 Y3 ?1 x
componentPositioner1->BeginAssemblyConstraints();2 b! r( E1 E8 H: P% L" W
Positioning::Network *network1;6 z# n7 n" d& a! G8 A" q, B5 j& i
network1 = componentPositioner1->EstablishNetwork();1 r( {) F# f3 [: e" e9 V
Positioning::ComponentNetwork *componentNetwork1(dynamic_cast<Positioning::ComponentNetwork *>(network1));
" e3 _, e/ a) p& a$ L+ |" H9 p componentNetwork1->SetMoveObjectsState(true);
s$ i: D; a0 m( _9 @2 T. I0 k* }% M& ^ Assemblies::Component *nullAssemblies_Component(NULL);6 i a! T! ^+ V8 U; N6 S# }
componentNetwork1->SetDisplayComponent(nullAssemblies_Component);& E( Q' M0 {. V! @) z+ E
componentNetwork1->SetNetworkArrangementsMode(Positioning::ComponentNetwork::ArrangementsModeExisting);
& Q, K, ` A& J+ ~ Positioning::Constraint *constraint1;
" x! q3 n% e% A8 y5 A+ Y constraint1 = componentPositioner1->CreateConstraint(true);
7 M& v z# E8 Y1 X) A Positioning::ComponenTConstraint *componentConstraint1(dynamic_cast<Positioning::ComponentConstraint *>(constraint1));
; f4 h; J P, f) d# q7 z! I5 b2 A componentConstraint1->SetConstraintType(Positioning::Constraint::TypeFix);- S$ W0 ^ }: \
Positioning::ConstraintReference *constraintReference1;
# N- K4 W! p/ z7 Y; \7 y% ~ constraintReference1 = componentConstraint1->CreateConstraintReference(component1, component1, false, false, false);0 p# N0 S: g: F% \" a+ \
Point3d helpPoint1(0, 0, 0);! f* Q. J8 x$ T! @
constraintReference1->SetHelpPoint(helpPoint1);; H2 }5 e. L. _( O0 i
componentNetwork1->Solve();4 `1 E9 d; ]5 e2 @7 z7 a
componentPositioner1->ClearNetwork();
0 B% l5 j5 t# | N( Q3 M componentPositioner1->DeleteNonPersistentConstraints();
! s" o) G1 {8 |, r Assemblies::Arrangement *nullAssemblies_Arrangement(NULL);" O: x, h' p$ u* \
componentPositioner1->SetPrimaryArrangement(nullAssemblies_Arrangement);
2 [" L8 h# s; M componentPositioner1->EndAssemblyConstraints();
$ g4 U( |* o9 h& j6 m" u
2 J1 f7 z. x6 T8 c6 L" ? |
|