NXOpen拉伸

#include <NXOpen/Annotations.hxx>
#include <NXOpen/Assemblies_Component.hxx>
#include <NXOpen/Assemblies_ComponentAssembly.hxx>
#include <NXOpen/Body.hxx>
#include <NXOpen/BodyCollection.hxx>
#include <NXOpen/Face.hxx>
#include <NXOpen/Line.hxx>
#include <NXOpen/NXObject.hxx>
#include <NXOpen/Part.hxx>
#include <NXOpen/PartCollection.hxx>
#include <NXOpen/Session.hxx>
#include <NXOpen/Builder.hxx>
#include <NXOpen/CurveDumbRule.hxx>
#include <NXOpen/Direction.hxx>
#include <NXOpen/DirectionCollection.hxx>
#include <NXOpen/DisplayableObject.hxx>
#include <NXOpen/Expression.hxx>
#include <NXOpen/ExpressionCollection.hxx>
#include <NXOpen/Features_ExtrudeBuilder.hxx>
#include <NXOpen/Features_Feature.hxx>
#include <NXOpen/Features_FeatureBuilder.hxx>
#include <NXOpen/Features_FeatureCollection.hxx>
#include <NXOpen/GeometricUtilities_BooleanOperation.hxx>
#include <NXOpen/GeometricUtilities_Extend.hxx>
#include <NXOpen/GeometricUtilities_FeatureOffset.hxx>
#include <NXOpen/GeometricUtilities_FeatureOptions.hxx>
#include <NXOpen/GeometricUtilities_Limits.hxx>
#include <NXOpen/GeometricUtilities_MultiDraft.hxx>
#include <NXOpen/GeometricUtilities_SimpleDraft.hxx>
#include <NXOpen/GeometricUtilities_SmartVolumeProfileBuilder.hxx>
#include <NXOpen/IBaseCurve.hxx>
#include <NXOpen/Part.hxx>
#include <NXOpen/PartCollection.hxx>
#include <NXOpen/PreviewBuilder.hxx>
#include <NXOpen/ScRuleFactory.hxx>
#include <NXOpen/Section.hxx>
#include <NXOpen/SectionCollection.hxx>
#include <NXOpen/SelectionIntentRule.hxx>
#include <NXOpen/SelectionIntentRuleOptions.hxx>
#include <NXOpen/Session.hxx>
#include <NXOpen/SmartObject.hxx>
#include <NXOpen/Unit.hxx>
#include <NXOpen/Part.hxx>
#include <NXOpen/PartCollection.hxx>
#include <NXOpen/MeasureManager.hxx>

Features::Feature* nullNXOpen_Features_Feature(NULL);
    Features::ExtrudeBuilder* extrudeBuilder1;
    extrudeBuilder1 = workPart->Features()->CreateExtrudeBuilder(nullNXOpen_Features_Feature);
    Section* section1 = workPart->Sections()->CreateSection(0.001, 0.001, 0.05);
    extrudeBuilder1->SetSection(section1);
    extrudeBuilder1->AllowSelfIntersectingSection(true);//支持自相交截面
    extrudeBuilder1->SetDistanceTolerance(0.001);    
    extrudeBuilder1->Limits()->StartExtend()->Value()->SetFormula("0");
    extrudeBuilder1->Limits()->EndExtend()->Value()->SetFormula("12");
    extrudeBuilder1->BooleanOperation()->SetType(GeometricUtilities::BooleanOperation::BooleanTypeCreate);//布尔类型:创建
    std::vector<IBaseCurve*> curves1;
    for (size_t i = 0; i < obj.size(); i++)//加入选择的线段
    {
        curves1.push_back(dynamic_cast<IBaseCurve*>(obj[i]));
    }
    CurveDumbRule* curveDumbRule1;
    curveDumbRule1 = workPart->ScRuleFactory()->CreateRuleBaseCurveDumb(curves1);
    section1->AllowSelfIntersection(true);//如果允许自相交,则为True,否则为false*
    section1->AllowDegenerateCurves(false);//如果允许在section中简并曲线,则为True,否则为false
    std::vector<SelectionIntentRule*> rules1(1);
    rules1[0] = curveDumbRule1;
    NXObject* nullNXOpen_NXObject(NULL);
    Point3d helpPoint1(0.0, 0.0, 0.0);
    section1->AddToSection(rules1, nullNXOpen_NXObject, nullNXOpen_NXObject, nullNXOpen_NXObject, helpPoint1, Section::ModeCreate, false);

    Point3d origin1(27.449526855605949, -106.81899463811334, 0.0);
    Vector3d vector1(0.0, 0.0, -1.0);
    Direction* direction1;
    direction1 = workPart->Directions()->CreateDirection(origin1, vector1, SmartObject::UpdateOptionWithinModeling);//创建方向
    extrudeBuilder1->SetDirection(direction1);
    Features::Feature* feature1;
    feature1 = extrudeBuilder1->CommitFeature();
    extrudeBuilder1->Destroy();

 

posted @ 2022-10-20 15:09  老婆饼里有老婆  阅读(91)  评论(0编辑  收藏  举报