|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【PLM之家NX二次开发自动装配项目】1.6 创建固定约束& w, C$ K* a' m- Y
装配约束的创建过程,如何创建一个对象的约束为固定约束!
) \+ i, k/ L6 [ W# K. n
, }* V1 e, X3 d3 x- j4 U7 F5 a
7 x4 Z) o* b" C: W, m2 J, S9 J% @' Q$ v
// 创建固定约束/ ?1 c% S- [' g' t% l0 s$ f
4 W5 Z {" e( P# d; J6 ?: _. H$ `% }7 k
Positioning::ComponentPositioner *componentPositioner1;
; V2 i* t5 U; v5 d6 h7 w componentPositioner1 = workPart->ComponentAssembly()->Positioner();2 m- t. p" D. O" n7 J; s* q
componentPositioner1->ClearNetwork();# @: ?: ^7 { u# T
componentPositioner1->BeginAssemblyConstraints();# |! Q$ a2 B/ H5 C+ {& N. U h
Positioning::Network *network1;9 P f. D% B: A" e6 h6 j, O% g
network1 = componentPositioner1->EstablishNetwork();1 o8 i$ O) _- J- I$ A& o% j
Positioning::ComponentNetwork *componentNetwork1(dynamic_cast<Positioning::ComponentNetwork *>(network1));( V' ^2 C! ~' ` Y, a' W! r( d
componentNetwork1->SetMoveObjectsState(true);& ^5 L9 |, k7 e/ s' d2 v
Assemblies::Component *nullAssemblies_Component(NULL);
" a! o6 i+ \0 u* M componentNetwork1->SetDisplayComponent(nullAssemblies_Component);
8 w8 m' u% c0 K$ e8 h componentNetwork1->SetNetworkArrangementsMode(Positioning::ComponentNetwork::ArrangementsModeExisting);3 K; E$ i* P8 O( k7 C5 C! |5 c
Positioning::Constraint *constraint1;
9 B) A P y2 r& a# V4 _ constraint1 = componentPositioner1->CreateConstraint(true);
0 B. R# k, l) _. T6 U Positioning::ComponenTConstraint *componentConstraint1(dynamic_cast<Positioning::ComponentConstraint *>(constraint1));+ T" u; ^0 P# l1 w
componentConstraint1->SetConstraintType(Positioning::Constraint::TypeFix);
c% H5 t( k3 Z9 F6 d" f3 B' y2 t Positioning::ConstraintReference *constraintReference1;
9 K9 K. V2 Q: R' X0 v# y2 e$ D constraintReference1 = componentConstraint1->CreateConstraintReference(component1, component1, false, false, false);
; P/ |: N# n) }& D/ E Point3d helpPoint1(0, 0, 0);
9 R+ N7 W7 p( x, z( V6 V# b' _ [ constraintReference1->SetHelpPoint(helpPoint1);. q- M4 J& k/ Y2 j9 i$ T1 L+ y6 t
componentNetwork1->Solve();
# z* e' R) Z* k' W2 U componentPositioner1->ClearNetwork();
7 C( r, b9 T- B componentPositioner1->DeleteNonPersistentConstraints();; \8 L# G5 u" a
Assemblies::Arrangement *nullAssemblies_Arrangement(NULL);
, k4 s, y& n! m: Q componentPositioner1->SetPrimaryArrangement(nullAssemblies_Arrangement); P j8 ^# p# F. }
componentPositioner1->EndAssemblyConstraints();
. [6 f- u: p$ d2 B4 d: ^, l! U8 V" V* Q2 m0 q
|
|