|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【PLM之家NX二次开发自动装配项目】1.6 创建固定约束& j& g& Z N' B4 i* w3 S# x0 ~
装配约束的创建过程,如何创建一个对象的约束为固定约束!
3 ]8 F9 Q; ?1 x& i7 ^/ x2 j+ t+ {3 h5 W3 c
1 `! F1 p; Z$ M
4 u1 I. A9 ~. Z3 K5 l6 w// 创建固定约束
! Q/ a& T; I( x! _" C' m
, M0 n' _3 x- X! M
4 h8 v% {+ @# Y Positioning::ComponentPositioner *componentPositioner1;
2 U& R+ t6 \- ]1 P componentPositioner1 = workPart->ComponentAssembly()->Positioner();% @' D6 u) k' e# D. @$ i
componentPositioner1->ClearNetwork(); Y" K; q8 Q4 ~4 T, o+ R9 t
componentPositioner1->BeginAssemblyConstraints();; k- L+ w8 I% j
Positioning::Network *network1;
% s! b$ i' S6 y# ~5 k B network1 = componentPositioner1->EstablishNetwork();
, N( d8 V: y) Z$ ~0 {: q2 Q Positioning::ComponentNetwork *componentNetwork1(dynamic_cast<Positioning::ComponentNetwork *>(network1));; y8 T% [) ^8 W
componentNetwork1->SetMoveObjectsState(true);
' K o, T, O% `: `: z t. K Assemblies::Component *nullAssemblies_Component(NULL);7 J7 u+ O/ L! P: b. Z
componentNetwork1->SetDisplayComponent(nullAssemblies_Component);$ d; p9 p( G. L% E7 |2 p
componentNetwork1->SetNetworkArrangementsMode(Positioning::ComponentNetwork::ArrangementsModeExisting);1 \$ q" }8 J0 M) j/ F0 s- l! `: i
Positioning::Constraint *constraint1;; e+ b! X/ o! B
constraint1 = componentPositioner1->CreateConstraint(true);$ T+ k8 ]2 h2 ^* Z/ D
Positioning::ComponenTConstraint *componentConstraint1(dynamic_cast<Positioning::ComponentConstraint *>(constraint1));
6 B: i7 k- Y$ d/ G M0 x componentConstraint1->SetConstraintType(Positioning::Constraint::TypeFix);
1 h! V; Q+ y' {) u, f7 R Positioning::ConstraintReference *constraintReference1;
1 T$ w) d( `; p4 w. y1 L$ c constraintReference1 = componentConstraint1->CreateConstraintReference(component1, component1, false, false, false);$ X7 o* T7 t( N3 H' o/ t2 _
Point3d helpPoint1(0, 0, 0);! V1 T! z2 Y0 \+ H& V# m
constraintReference1->SetHelpPoint(helpPoint1);
0 }# k- u9 {/ k+ U7 C7 m componentNetwork1->Solve();
, Z- a2 F+ \+ Z1 G4 e$ N componentPositioner1->ClearNetwork();
6 O7 Z. _8 g# T' Z componentPositioner1->DeleteNonPersistentConstraints();1 h- z3 A! l0 L
Assemblies::Arrangement *nullAssemblies_Arrangement(NULL);, h3 `; z7 o: }/ P
componentPositioner1->SetPrimaryArrangement(nullAssemblies_Arrangement);
' B1 V! F1 ~" Q1 _! s2 r7 W componentPositioner1->EndAssemblyConstraints();2 p! z: B/ ~ m2 e {. J# k6 V4 n
g0 a6 f% b. X, M* F$ d$ a* U |
|