|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【PLM之家NX二次开发自动装配项目】1.6 创建固定约束) J7 @0 w# H1 u" d6 a7 D7 N( o
装配约束的创建过程,如何创建一个对象的约束为固定约束!
1 e# R" q1 i- k
1 P% y% m. V5 n; S0 A8 m: ^) F% L5 K* ]2 W' A( t) t
, L; d" ~6 B/ l8 r' q7 B4 f; U' S
// 创建固定约束
/ \, W, V6 y: u" `' \7 d
3 a; d5 E0 }1 ], O5 Q
0 k# R8 s! p$ z, y2 B Positioning::ComponentPositioner *componentPositioner1;7 U. o/ `3 q4 P% _# D5 T' \ z! e
componentPositioner1 = workPart->ComponentAssembly()->Positioner();9 K5 d* Z9 B( G: z, ^# t$ F
componentPositioner1->ClearNetwork();
" u4 l0 [+ q, W) H componentPositioner1->BeginAssemblyConstraints();
x! y% ]1 f" L6 Y+ z5 h3 \* w9 E Positioning::Network *network1;
7 i7 f+ G) L7 t" n- u; A' ] network1 = componentPositioner1->EstablishNetwork();
- k' |( U3 M: [9 ` Positioning::ComponentNetwork *componentNetwork1(dynamic_cast<Positioning::ComponentNetwork *>(network1));
! w6 o8 t$ Q& i' P9 l+ `6 S componentNetwork1->SetMoveObjectsState(true);
K6 \% s5 O* ^0 e Assemblies::Component *nullAssemblies_Component(NULL);; e' i- s" H+ m/ j* h* H. z+ a d8 S
componentNetwork1->SetDisplayComponent(nullAssemblies_Component);0 t" B4 j5 N4 N0 h! e! l. z: j! G) ~
componentNetwork1->SetNetworkArrangementsMode(Positioning::ComponentNetwork::ArrangementsModeExisting);" t: o2 C' C: z
Positioning::Constraint *constraint1;
' P* D. [, K6 A9 i! T$ ~- a constraint1 = componentPositioner1->CreateConstraint(true);
4 N& A/ ?2 Y# s% r. K n Positioning::ComponenTConstraint *componentConstraint1(dynamic_cast<Positioning::ComponentConstraint *>(constraint1));& `# n6 _/ O( j- O* q/ t
componentConstraint1->SetConstraintType(Positioning::Constraint::TypeFix);3 X9 a, C: {4 T+ r5 J: z: Y
Positioning::ConstraintReference *constraintReference1;4 ?5 O$ a4 c, O; l
constraintReference1 = componentConstraint1->CreateConstraintReference(component1, component1, false, false, false);) y$ E1 B/ d0 h" x8 n
Point3d helpPoint1(0, 0, 0);: t" ]3 u& T; {" _3 }
constraintReference1->SetHelpPoint(helpPoint1);2 i5 y/ e8 |7 S$ G7 y1 u2 o
componentNetwork1->Solve();
. K9 n6 N- C2 {% X componentPositioner1->ClearNetwork();
) p& F" O$ s) K9 T) U6 a; ?% p9 a componentPositioner1->DeleteNonPersistentConstraints();9 g% p' P+ c/ D: Y
Assemblies::Arrangement *nullAssemblies_Arrangement(NULL);, k W0 q% U$ j# U. R8 T
componentPositioner1->SetPrimaryArrangement(nullAssemblies_Arrangement);: Z2 e9 X. v& H: A- A6 h
componentPositioner1->EndAssemblyConstraints();/ \0 ~$ s! |* L" H3 l) r+ ]% k* S
0 ?8 J& ~2 j- L$ x% A# Q5 n |
|