|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【PLM之家NX二次开发自动装配项目】1.6 创建固定约束
, Z0 X. x9 l! M# T装配约束的创建过程,如何创建一个对象的约束为固定约束!
' t) b6 p2 p5 g3 }& d
) m8 ^7 f, i$ R/ T- ]/ u( E* {4 z% ~, |9 d Y$ Z ^5 }
: v$ [1 F6 h$ m0 K
// 创建固定约束
. A9 [4 |8 [; P1 |% y; w5 g( W& c# J0 g* A- R7 T1 ?( t
8 U4 x; C5 p+ a7 K) c$ _5 F
Positioning::ComponentPositioner *componentPositioner1;: P" _) D, h$ E' ^
componentPositioner1 = workPart->ComponentAssembly()->Positioner();
9 b! Z' O0 s6 M/ Y# k' l) A1 u! q componentPositioner1->ClearNetwork();: w {7 }) h2 {1 E9 t# |
componentPositioner1->BeginAssemblyConstraints();; x2 g9 f8 h! ^
Positioning::Network *network1;
N% m0 ?+ s9 A7 m1 U1 _+ R$ {* d network1 = componentPositioner1->EstablishNetwork();
1 U! x g) |3 }. e, F Positioning::ComponentNetwork *componentNetwork1(dynamic_cast<Positioning::ComponentNetwork *>(network1));3 I7 Q( W6 f: b
componentNetwork1->SetMoveObjectsState(true);4 p" M" { j( V
Assemblies::Component *nullAssemblies_Component(NULL);1 ?/ X3 ?* S; ~% c5 o
componentNetwork1->SetDisplayComponent(nullAssemblies_Component);
: F+ ~: a- g F2 B componentNetwork1->SetNetworkArrangementsMode(Positioning::ComponentNetwork::ArrangementsModeExisting);
1 V' O: p. p) x1 R3 ~$ I$ c Positioning::Constraint *constraint1;
5 E- R9 |+ l9 Y0 w P constraint1 = componentPositioner1->CreateConstraint(true);2 Q' Z- S6 E3 \, F& Y
Positioning::ComponenTConstraint *componentConstraint1(dynamic_cast<Positioning::ComponentConstraint *>(constraint1));4 P0 L6 x( \6 |1 X' L4 V; L% P
componentConstraint1->SetConstraintType(Positioning::Constraint::TypeFix);9 T$ X" ?# }: x) y
Positioning::ConstraintReference *constraintReference1;
; I# v% y8 u+ a- Y+ H' d constraintReference1 = componentConstraint1->CreateConstraintReference(component1, component1, false, false, false);2 I$ g% o* X2 ]: K! g$ c; e- j
Point3d helpPoint1(0, 0, 0);7 h: n7 q& W7 n8 \& o$ z9 T
constraintReference1->SetHelpPoint(helpPoint1); z7 N; h0 k( F! V/ g( A. Z1 \
componentNetwork1->Solve();
5 S2 Y! y2 V6 c/ Z& Y& i+ T componentPositioner1->ClearNetwork();
2 \. n' q; H( N6 U7 g6 ^7 b0 `& U componentPositioner1->DeleteNonPersistentConstraints();. z& N! I! A' h3 x
Assemblies::Arrangement *nullAssemblies_Arrangement(NULL);) b; P! I# u' g$ N$ W
componentPositioner1->SetPrimaryArrangement(nullAssemblies_Arrangement);
# r8 G+ q6 {; }* x& @ componentPositioner1->EndAssemblyConstraints();* R, `% i2 \7 A" w: J) H: `3 w% N- V5 ?
+ I* ?, B" N& Z0 K/ i
|
|