|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【PLM之家NX二次开发自动装配项目】1.6 创建固定约束
0 k- @( e: V; F/ V9 K8 g装配约束的创建过程,如何创建一个对象的约束为固定约束!1 r: R7 H1 \. H; w; V" Y
8 V9 i- x4 V; g/ F4 P- t- E
% x3 \0 L; a* U+ q0 g
0 c# A4 F6 C: J0 B$ ^: _$ L3 C% m9 [
// 创建固定约束; q: \' N, x3 V" n% F
7 R5 x& c& M5 S' I% s
) g+ \# M( x v* x U* o* k
Positioning::ComponentPositioner *componentPositioner1;' j$ c- Y B; o3 _+ Q. Y5 m
componentPositioner1 = workPart->ComponentAssembly()->Positioner(); y) M' a% a" O7 ^& ~; N
componentPositioner1->ClearNetwork();6 X+ L- @0 V M3 o, W% B8 f' S) A$ l$ a" @( R
componentPositioner1->BeginAssemblyConstraints(); }2 \# P9 {' ^3 \# n- E
Positioning::Network *network1;" E9 e' c0 ?" J9 k! _3 P
network1 = componentPositioner1->EstablishNetwork();4 @1 F; w9 J1 W, A. G
Positioning::ComponentNetwork *componentNetwork1(dynamic_cast<Positioning::ComponentNetwork *>(network1));$ W: Z. J. {7 |- J
componentNetwork1->SetMoveObjectsState(true);, D% F4 n- J5 E% G
Assemblies::Component *nullAssemblies_Component(NULL); E" b% N& `+ ]9 V# G% @
componentNetwork1->SetDisplayComponent(nullAssemblies_Component);
7 t- b4 D% U* @: p# a componentNetwork1->SetNetworkArrangementsMode(Positioning::ComponentNetwork::ArrangementsModeExisting);
' @, w- Z/ F+ U* K. j# w6 E Positioning::Constraint *constraint1;- M) G0 n* z" j# W( v* K$ @
constraint1 = componentPositioner1->CreateConstraint(true);! P9 V' F, L; }! D# p* t: w9 \5 k
Positioning::ComponenTConstraint *componentConstraint1(dynamic_cast<Positioning::ComponentConstraint *>(constraint1));
" q* N/ w7 R. \ c# v componentConstraint1->SetConstraintType(Positioning::Constraint::TypeFix);
1 D5 W i& y1 _" G8 B7 o2 A7 |8 l Positioning::ConstraintReference *constraintReference1;1 y' ^9 T3 v* M9 l; ?: D
constraintReference1 = componentConstraint1->CreateConstraintReference(component1, component1, false, false, false);
4 [! U+ W5 h2 W6 h* D Point3d helpPoint1(0, 0, 0);
0 e) D/ O+ x+ c% h" {; u) ] constraintReference1->SetHelpPoint(helpPoint1);
9 u) L' F3 [6 X, W componentNetwork1->Solve();. }5 m- g2 A3 v( e
componentPositioner1->ClearNetwork();7 w! m9 @9 ?( e, N1 V
componentPositioner1->DeleteNonPersistentConstraints();9 g& t& [. [9 M% H
Assemblies::Arrangement *nullAssemblies_Arrangement(NULL);$ Y# _* E4 E4 ?5 ^/ U4 g
componentPositioner1->SetPrimaryArrangement(nullAssemblies_Arrangement);
) |6 q& H. e6 l7 t: I componentPositioner1->EndAssemblyConstraints(); q; H9 x. u) v3 M2 l
1 X, _: v3 [7 G" k9 d |
|