【PLM之家NX二次开发自动装配项目】1.6 创建固定约束
【PLM之家NX二次开发自动装配项目】1.6 创建固定约束装配约束的创建过程,如何创建一个对象的约束为固定约束!
// 创建固定约束
Positioning::ComponentPositioner *componentPositioner1;
componentPositioner1 = workPart->ComponentAssembly()->Positioner();
componentPositioner1->ClearNetwork();
componentPositioner1->BeginAssemblyConstraints();
Positioning::Network *network1;
network1 = componentPositioner1->EstablishNetwork();
Positioning::ComponentNetwork *componentNetwork1(dynamic_cast<Positioning::ComponentNetwork *>(network1));
componentNetwork1->SetMoveObjectsState(true);
Assemblies::Component *nullAssemblies_Component(NULL);
componentNetwork1->SetDisplayComponent(nullAssemblies_Component);
componentNetwork1->SetNetworkArrangementsMode(Positioning::ComponentNetwork::ArrangementsModeExisting);
Positioning::Constraint *constraint1;
constraint1 = componentPositioner1->CreateConstraint(true);
Positioning::ComponentConstraint *componentConstraint1(dynamic_cast<Positioning::ComponentConstraint *>(constraint1));
componentConstraint1->SetConstraintType(Positioning::Constraint::TypeFix);
Positioning::ConstraintReference *constraintReference1;
constraintReference1 = componentConstraint1->CreateConstraintReference(component1, component1, false, false, false);
Point3d helpPoint1(0, 0, 0);
constraintReference1->SetHelpPoint(helpPoint1);
componentNetwork1->Solve();
componentPositioner1->ClearNetwork();
componentPositioner1->DeleteNonPersistentConstraints();
Assemblies::Arrangement *nullAssemblies_Arrangement(NULL);
componentPositioner1->SetPrimaryArrangement(nullAssemblies_Arrangement);
componentPositioner1->EndAssemblyConstraints();
培训VIP可见
页:
[1]