|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【PLM之家NX二次开发自动装配项目】1.6 创建固定约束 B; R) s5 C* ]# h' G5 h
装配约束的创建过程,如何创建一个对象的约束为固定约束!0 b8 H! ?" m+ F' r
& k& g" V( L- Q0 E6 w! o) c. S# Q4 z
& a5 e P2 b6 u. z# k2 f! p
// 创建固定约束+ b$ P; A2 u* O- _( k
0 _+ N: N3 ~1 W; S1 ?6 i! ~% q2 \
d, q, ^9 g' H) {5 n; G$ L* i Positioning::ComponentPositioner *componentPositioner1;3 m. i% Y5 ~0 n; V1 [
componentPositioner1 = workPart->ComponentAssembly()->Positioner();
- p0 Q/ }' k, a; p' |% H5 H' z componentPositioner1->ClearNetwork();4 U& @$ r' R0 s( h: R
componentPositioner1->BeginAssemblyConstraints();+ b5 I: X) Z' `, [8 l k
Positioning::Network *network1;! a& y, D% e) m z! M+ ~' q
network1 = componentPositioner1->EstablishNetwork();# Y- a( F. P7 ~% F. b; }
Positioning::ComponentNetwork *componentNetwork1(dynamic_cast<Positioning::ComponentNetwork *>(network1));
. f. |; k1 t6 v2 r S8 ~5 L componentNetwork1->SetMoveObjectsState(true); I. p9 z( J! I u
Assemblies::Component *nullAssemblies_Component(NULL);* v9 D6 ?8 j) t3 g' J
componentNetwork1->SetDisplayComponent(nullAssemblies_Component);
& a% W Y* Z1 B* P5 w" Z2 b componentNetwork1->SetNetworkArrangementsMode(Positioning::ComponentNetwork::ArrangementsModeExisting);( i! g* p( C! W# t' H% Z1 r0 G
Positioning::Constraint *constraint1;+ ]* E7 v* m; y) g: j6 w
constraint1 = componentPositioner1->CreateConstraint(true);' Y7 [3 C" |& p: {
Positioning::ComponenTConstraint *componentConstraint1(dynamic_cast<Positioning::ComponentConstraint *>(constraint1));# h1 \# g r$ j ]' [
componentConstraint1->SetConstraintType(Positioning::Constraint::TypeFix);
* F5 E( V3 x6 q) B3 |2 z# r" [ Positioning::ConstraintReference *constraintReference1;
" {, A0 Z/ U: S' P* M0 {, I constraintReference1 = componentConstraint1->CreateConstraintReference(component1, component1, false, false, false);/ O2 @ n+ L3 [
Point3d helpPoint1(0, 0, 0);) M% _( s3 d- w' V5 U9 B
constraintReference1->SetHelpPoint(helpPoint1);
. u, a' |$ g, `( M# P I& { componentNetwork1->Solve();
, M; a8 B, h" `. t# c* j componentPositioner1->ClearNetwork();, i/ D8 ^3 @& c- v- Y
componentPositioner1->DeleteNonPersistentConstraints();, X( M1 c6 o3 ~; D; O9 Z
Assemblies::Arrangement *nullAssemblies_Arrangement(NULL); x5 E3 U/ T. u3 M- ]3 s, R% o$ D! g
componentPositioner1->SetPrimaryArrangement(nullAssemblies_Arrangement);
) U" k: B6 h9 e, L componentPositioner1->EndAssemblyConstraints();
; i/ w6 a, t5 \* q7 V) Y6 v( @# H: o6 r% z$ f% S R
|
|