NXUG1953 Visualstudio 2019 参考论文: A Method for Determining the AGMA Tooth Form Factor from Equations for the Generated Tooth Root Fillet
//FullGear// Mandatory UF Includes
#include <uf.h>
#include <uf_object_types.h>// Internal Includes
#include <NXOpen/ListingWindow.hxx>
#include <NXOpen/NXMessageBox.hxx>
#include <NXOpen/UI.hxx>// Internal+External Includes
#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/NXException.hxx>
#include <NXOpen/NXObject.hxx>
#include <NXOpen/Part.hxx>
#include <NXOpen/PartCollection.hxx>
#include <NXOpen/Session.hxx>
#include <NXOpen/PointCollection.hxx>
#include <NXOpen/Features_PointFeatureBuilder.hxx>
#include <NXOpen/Features_BaseFeatureCollection.hxx>
#include <NXOpen/MathUtils.hxx>
#include <NXOpen/Features_StudioSplineBuilderEx.hxx>
#include <NXOpen/Features_FeatureCollection.hxx>
#include <NXOpen/Point.hxx>
#include <NXOpen/Features_Extrude.hxx>
#include <NXOpen/Features_ExtrudeBuilder.hxx>
#include <NXOpen/GeometricUtilities_BooleanOperation.hxx>
#include <NXOpen/Direction.hxx>
#include <NXOpen/DirectionCollection.hxx>
#include <NXOpen/GeometricUtilities_Limits.hxx>
#include <NXOpen/GeometricUtilities_Extend.hxx>
#include <NXOpen/SectionCollection.hxx>
#include <NXOpen/Features_AssociativeArcBuilder.hxx>
#include <NXOpen/Features_AssociativeArc.hxx>
#include <NXOpen/SelectPoint.hxx>
#include <NXOpen/CurveFeatureRule.hxx>
#include <NXOpen/Features_StudioSpline.hxx>
#include <NXOpen/Spline.hxx>
#include <NXOpen/Arc.hxx>
#include <NXOpen/NXObjectManager.hxx>
#include <NXOpen/ScRuleFactory.hxx>// Std C++ Includes
#include <iostream>
#include <sstream>using namespace NXOpen;
using std::string;
using std::exception;
using std::stringstream;
using std::endl;
using std::cout;
using std::cerr;//------------------------------------------------------------------------------
// NXOpen c++ test class
//------------------------------------------------------------------------------
class MyClass
{// class members
public:static Session *theSession;static UI *theUI;MyClass();~MyClass();void do_it();void print(const NXString &);void print(const string &);void print(const char*);NXOpen::Point3d Involutecurve(double alphax, double rb);NXOpen::Point* pointcreat(NXOpen::Point3d InputPoint, NXOpen::BasePart* part1);void POINTconstruction(NXOpen::Point* point1, NXOpen::BasePart* part1);NXOpen::Point3d Rotz(double thetai, NXOpen::Point3d inputpoint3d, NXOpen::MathUtils* Ms);NXOpen::NXObject* splinecreatbypoint(std::vector<NXOpen::Point* > CurvePoint, NXOpen::BasePart* part1);std::vector<NXOpen::Point* > CreatSymmetricPoint(std::vector<NXOpen::Point* > CurvePoint, NXOpen::BasePart* part1);NXOpen::NXObject* arccreatthreepoint(std::vector<NXOpen::Point* > ARCPoint, NXOpen::BasePart* part1);void addsplinetosection(NXOpen::NXObject* splinexnObject, NXOpen::Section* sectionx, tag_t splinexTag, NXOpen::Point3d helpPoint, NXOpen::Part* GPart);void addarctosection(NXOpen::NXObject* arcxnObject, NXOpen::Section* sectionx, tag_t arcxTag, NXOpen::Point3d helpPoint, NXOpen::Part* GPart);std::vector<NXOpen::Point* >RotZPoint(std::vector<NXOpen::Point* > Point11, double theta, NXOpen::MathUtils* Ms, NXOpen::BasePart* part1);
private:BasePart *workPart, *displayPart;NXMessageBox *mb;ListingWindow *lw;LogFile *lf;
};//------------------------------------------------------------------------------
// Initialize static variables
//------------------------------------------------------------------------------
Session *(MyClass::theSession) = NULL;
UI *(MyClass::theUI) = NULL;//------------------------------------------------------------------------------
// Constructor
//------------------------------------------------------------------------------
MyClass::MyClass()
{// Initialize the NX Open C++ API environmentMyClass::theSession = NXOpen::Session::GetSession();MyClass::theUI = UI::GetUI();mb = theUI->NXMessageBox();lw = theSession->ListingWindow();lf = theSession->LogFile();workPart = theSession->Parts()->BaseWork();displayPart = theSession->Parts()->BaseDisplay();}//------------------------------------------------------------------------------
// Destructor
//------------------------------------------------------------------------------
MyClass::~MyClass()
{
}//------------------------------------------------------------------------------
// Print string to listing window or stdout
//------------------------------------------------------------------------------
void MyClass::print(const NXString &msg)
{if(! lw->IsOpen() ) lw->Open();lw->WriteLine(msg);
}
void MyClass::print(const string &msg)
{if(! lw->IsOpen() ) lw->Open();lw->WriteLine(msg);
}
void MyClass::print(const char * msg)
{if(! lw->IsOpen() ) lw->Open();lw->WriteLine(msg);
}NXOpen::Point3d MyClass::Involutecurve(double alphax, double rb)
{double rx = rb / cos(alphax);double thetax = tan(alphax) - alphax;double xx = -rx * sin(thetax);double yy = rx * cos(thetax);NXOpen::Point3d OutputPoint3d = {xx,yy,0.0} ;return OutputPoint3d;
}
NXOpen::Point* MyClass::pointcreat(NXOpen::Point3d InputPoint, NXOpen::BasePart* part1)
{NXOpen::Point* point;point = part1->Points()->CreatePoint(InputPoint);return point;
}
void MyClass::POINTconstruction(NXOpen::Point* point1, NXOpen::BasePart* part1)
{NXOpen::Features::Feature* nullNXOpen_Features_Feature(NULL);NXOpen::Features::PointFeatureBuilder* pointFeatureBuilder1;pointFeatureBuilder1 = part1->BaseFeatures()->CreatePointFeatureBuilder(nullNXOpen_Features_Feature);pointFeatureBuilder1->SetPoint(point1);NXOpen::NXObject* nXObject1;nXObject1 = pointFeatureBuilder1->Commit();pointFeatureBuilder1->Destroy();
}NXOpen::Point3d MyClass::Rotz(double thetai, NXOpen::Point3d inputpoint3d, NXOpen::MathUtils* Ms)
{NXOpen::Matrix3x3 Rzmatrix;Rzmatrix.Xx = cos(thetai);Rzmatrix.Xy = -sin(thetai);Rzmatrix.Xz = 0.0;Rzmatrix.Yx = sin(thetai);Rzmatrix.Yy = cos(thetai);Rzmatrix.Yz = 0.0;Rzmatrix.Zx = 0.0;Rzmatrix.Zy = 0.0;Rzmatrix.Zz = 1.0;NXOpen::Point3d outputpoint3d= Ms->Multiply(Rzmatrix, inputpoint3d);return outputpoint3d;
}
NXOpen::NXObject* MyClass::splinecreatbypoint(std::vector<NXOpen::Point* > CurvePoint, NXOpen::BasePart* part1)
{NXOpen::NXObject* nullNXOpen_NXObject(NULL);NXOpen::Features::StudioSplineBuilderEx* studioSplineBuilderEx;studioSplineBuilderEx = part1->Features()->CreateStudioSplineBuilderEx(nullNXOpen_NXObject);studioSplineBuilderEx->SetDegree(3);NXOpen::Features::GeometricConstraintData* geometricConstraintData;std::vector<Features::GeometricConstraintData*> constraints(CurvePoint.size());for (int gg = 0; gg < CurvePoint.size(); gg++){NXOpen::Point* point = CurvePoint[gg];geometricConstraintData = studioSplineBuilderEx->ConstraintManager()->CreateGeometricConstraintData();geometricConstraintData->SetPoint(point);constraints[gg] = geometricConstraintData;}studioSplineBuilderEx->ConstraintManager()->SetContents(constraints);NXOpen::NXObject* nXObject;nXObject = studioSplineBuilderEx->Commit();Spline* returnSpline = studioSplineBuilderEx->Curve();return nXObject;
}
std::vector<NXOpen::Point* >MyClass::CreatSymmetricPoint(std::vector<NXOpen::Point* > CurvePoint, NXOpen::BasePart* part1)
{std::vector<NXOpen::Point* > CurvePoint1;for (int i = 0; i < CurvePoint.size(); i++){NXOpen::Point* PP = CurvePoint[i];NXOpen::Point3d PP3d = PP->Coordinates();NXOpen::Point3d PP3df = { -PP3d.X,PP3d.Y,PP3d.Z};NXOpen::Point* pointi = pointcreat(PP3df, part1);CurvePoint1.push_back(pointi);}return CurvePoint1;
}NXOpen::NXObject* MyClass::arccreatthreepoint(std::vector<NXOpen::Point* > ARCPoint, NXOpen::BasePart* part1)
{NXOpen::Point* starpoint = ARCPoint[0];NXOpen::Point* endpoint = ARCPoint[1];NXOpen::Point* midpoint = ARCPoint[2];Features::AssociativeArc* nullFeatures_AssociativeArc(NULL);Features::AssociativeArcBuilder* associativeArcBuilder;associativeArcBuilder = part1->BaseFeatures()->CreateAssociativeArcBuilder(nullFeatures_AssociativeArc);Unit* unit;unit = associativeArcBuilder->Radius()->Units();associativeArcBuilder->SetStartPointOptions(Features::AssociativeArcBuilder::StartOptionPoint);associativeArcBuilder->SetEndPointOptions(Features::AssociativeArcBuilder::EndOptionPoint);associativeArcBuilder->SetMidPointOptions(Features::AssociativeArcBuilder::MidOptionPoint);associativeArcBuilder->Limits()->StartLimit()->SetLimitOption(GeometricUtilities::CurveExtendData::LimitOptionsAtPoint);associativeArcBuilder->Limits()->EndLimit()->SetLimitOption(GeometricUtilities::CurveExtendData::LimitOptionsAtPoint);associativeArcBuilder->Limits()->StartLimit()->Distance()->SetRightHandSide("0");associativeArcBuilder->Limits()->EndLimit()->Distance()->SetRightHandSide("0");associativeArcBuilder->StartPoint()->SetValue(starpoint);associativeArcBuilder->EndPoint()->SetValue(endpoint);associativeArcBuilder->MidPoint()->SetValue(midpoint);NXObject* nXObject;nXObject = associativeArcBuilder->Commit();associativeArcBuilder->Destroy();return nXObject;
}
void MyClass::addsplinetosection(NXOpen::NXObject* splinexnObject, NXOpen::Section* sectionx, tag_t splinexTag, NXOpen::Point3d helpPoint, NXOpen::Part* GPart)
{NXOpen::NXObject* nullNXOpen_NXObject(NULL);std::vector<NXOpen::Features::Feature*> features2(1);NXOpen::Features::StudioSpline* studioSpline1(dynamic_cast<NXOpen::Features::StudioSpline*>(GPart->Features()->FindObject(splinexnObject->JournalIdentifier())));features2[0] = studioSpline1;NXOpen::CurveFeatureRule* curveFeatureRule2;curveFeatureRule2 = GPart->ScRuleFactory()->CreateRuleCurveFeature(features2);std::vector<NXOpen::SelectionIntentRule*> rules2(1);rules2[0] = curveFeatureRule2;NXOpen::Spline* spline1(dynamic_cast<NXOpen::Spline*>(NXOpen::NXObjectManager::Get(splinexTag)));sectionx->AddToSection(rules2, spline1, nullNXOpen_NXObject, nullNXOpen_NXObject, helpPoint, NXOpen::Section::ModeCreate, false);
}
void MyClass::addarctosection(NXOpen::NXObject* arcxnObject, NXOpen::Section* sectionx, tag_t arcxTag, NXOpen::Point3d helpPoint, NXOpen::Part* GPart)
{NXOpen::NXObject* nullNXOpen_NXObject(NULL);std::vector<NXOpen::Features::Feature*> features3(1);NXOpen::Features::AssociativeArc* associativeArc1(dynamic_cast<NXOpen::Features::AssociativeArc*>(GPart->Features()->FindObject(arcxnObject->JournalIdentifier())));features3[0] = associativeArc1;NXOpen::CurveFeatureRule* curveFeatureRule3;curveFeatureRule3 = GPart->ScRuleFactory()->CreateRuleCurveFeature(features3);std::vector<NXOpen::SelectionIntentRule*> rules3(1);rules3[0] = curveFeatureRule3;NXOpen::Arc* arc1(dynamic_cast<NXOpen::Arc*>(NXOpen::NXObjectManager::Get(arcxTag)));sectionx->AddToSection(rules3, arc1, nullNXOpen_NXObject, nullNXOpen_NXObject, helpPoint, NXOpen::Section::ModeCreate, false);
}
std::vector<NXOpen::Point* >MyClass::RotZPoint(std::vector<NXOpen::Point* > inputPoint, double theta, NXOpen::MathUtils* Ms, NXOpen::BasePart* part1)
{std::vector<NXOpen::Point* > outputPoint;for (int i = 0; i < inputPoint.size(); i++){NXOpen::Point3d Pointi3d = Rotz(theta, inputPoint[i]->Coordinates(), Ms);NXOpen::Point* point1i = pointcreat(Pointi3d, part1);outputPoint.push_back(point1i);}return outputPoint;
}//------------------------------------------------------------------------------
// Do something
//------------------------------------------------------------------------------
void MyClass::do_it()
{NXOpen::Session* theSession = NXOpen::Session::GetSession();NXOpen::Part* GPart(theSession->Parts()->Work());NXOpen::Part* displayPart(theSession->Parts()->Display());NXOpen::MathUtils* Ms(theSession->MathUtils());lw->Open();char msg[256];//齿轮参数double mn = 6;double z = 20;double ToothWidth = 55.0;double Holediameter = 30.0;double ha = 1;double c = 0.25;double hf = (ha + c) * mn;double alphan = PI / 9;double theten = tan(alphan) - alphan;double d = mn * z;double r = d / 2;double da = d + 2 * ha * mn;double ra = da / 2;double db = d * cos(alphan);double rb = db / 2;double df = d - 2 * hf;double rf = df / 2;double beta = PI / z;double omegaS = PI / (2 * z) + theten;double alphaA = acos(rb / ra);// 齿条参数double cP = 0.25 * mn;double rhofP = 0.38 * mn;double hfP = 1.25 * mn;double hFfP = hfP - cP;double P = PI * mn;double sP = 0.5 * P;double alphaP = PI / 9;double lB = 0.5 * sP + hFfP * tan(alphaP) + hFfP / tan(alphan);double etaB = lB / r;double xB = cos(-etaB) * (-hFfP / tan(alphan)) - sin(-etaB) * (r - hFfP);double yB = sin(-etaB) * (-hFfP / tan(alphan)) + cos(-etaB) * (r - hFfP);double rB = sqrt(pow(xB, 2) + pow(yB, 2));double alphaB = acos(rb / rB);double lC = 0.5 * sP + hFfP * tan(alphaP) + rhofP * cos(alphaP);double etaC = lC / r;double xC = cos(-etaC) * 0.0 - sin(-etaC) * (r - hfP);double yC = sin(-etaC) * 0.0 + cos(-etaC) * (r - hfP);double deltaS = 0.5;double S = rb / 2 * (1 / pow(cos(alphaA), 2) - 1 / pow(cos(alphaB), 2));std::vector<NXOpen::Point* > RInvolutePoint;for (int i = 1; i < 100; i++){double Si = S - (i - 1) * deltaS;if (Si > 0){double alphai = acos(sqrt(1 / (2 * Si / rb + 1 / pow(cos(alphaB), 2))));NXOpen::Point3d OutputPoint3d = Involutecurve(alphai, rb);NXOpen::Point3d OutputPoint3d1 = Rotz(-omegaS, OutputPoint3d, Ms);NXOpen::Point* Opoint = pointcreat(OutputPoint3d1, GPart);RInvolutePoint.push_back(Opoint);}else{double alphai = alphaB;NXOpen::Point3d OutputPoint3d = Involutecurve(alphai, rb);NXOpen::Point3d OutputPoint3d1 = Rotz(-omegaS, OutputPoint3d, Ms);NXOpen::Point* Opoint = pointcreat(OutputPoint3d1, GPart);RInvolutePoint.push_back(Opoint);break;}}double Xc0 = 0.5 * sP + hFfP * tan(alphaP) + rhofP * cos(alphaP);double Yc0 = r - (hfP - rhofP);double deltaA = 0.01;std::vector<NXOpen::Point* > RTransitionpoint;for (int k = 1; k < 1000; k++){double thete = etaB - k * deltaA;if (thete > etaC){double phi = atan((r * thete - Xc0) / (r - Yc0));double Xc = (Yc0 * tan(thete) - (r * thete - Xc0)) * cos(thete);double Yc = -(r - Yc0 / cos(thete) + (Yc0 * tan(thete) - (r * thete - Xc0)) * sin(thete));double alpha = PI + (PI / 2 - phi - thete);double Xf = Xc + rhofP * cos(alpha);double Yf = Yc + rhofP * sin(alpha);double xk = Xf;double yk = r + Yf;NXOpen::Point3d InputPoint3d = { xk, yk,0.0 };NXOpen::Point* Tpoint = pointcreat(InputPoint3d, GPart);RTransitionpoint.push_back(Tpoint);}else{break;}}double xD = rf * sin(beta);double yD = rf * cos(beta);double xM = (xC + xD) / 2;double yM = sqrt(pow(rf, 2) - pow(xM, 2));NXOpen::Point3d Cpoint3d = { xC,yC,0.0 };NXOpen::Point3d Dpoint3d = { xD,yD,0.0 };NXOpen::Point3d Mpoint3d = { xM,yM,0.0 };NXOpen::Point* Cpoint = pointcreat(Cpoint3d, GPart);NXOpen::Point* Dpoint = pointcreat(Dpoint3d, GPart);NXOpen::Point* Mpoint = pointcreat(Mpoint3d, GPart);RTransitionpoint[0] = RInvolutePoint.back();RTransitionpoint.push_back(Cpoint);std::vector<NXOpen::Point* > RDedendumcirclepoint;RDedendumcirclepoint.push_back(Cpoint);RDedendumcirclepoint.push_back(Dpoint);RDedendumcirclepoint.push_back(Mpoint);std::vector<NXOpen::Point* > LInvolutePoint;LInvolutePoint = CreatSymmetricPoint(RInvolutePoint, GPart);std::vector<NXOpen::Point* > LTransitionpoint;LTransitionpoint = CreatSymmetricPoint(RTransitionpoint, GPart);std::vector<NXOpen::Point* > LDedendumcirclepoint;LDedendumcirclepoint = CreatSymmetricPoint(RDedendumcirclepoint, GPart);NXOpen::Point* Hpoint = pointcreat({ 0.0,ra,0.0 }, GPart);NXOpen::Point* Apoint = RInvolutePoint[0];NXOpen::Point3d Apoint3d = Apoint->Coordinates();NXOpen::Point* ApointR = pointcreat({ Apoint3d.X,Apoint3d.Y,Apoint3d.Z }, GPart);NXOpen::Point* ApointL = pointcreat({ -Apoint3d.X,Apoint3d.Y,Apoint3d.Z }, GPart);std::vector<NXOpen::Point* > Addendumcirclepoint;Addendumcirclepoint.push_back(ApointL);Addendumcirclepoint.push_back(ApointR);Addendumcirclepoint.push_back(Hpoint);char Twidth[256];sprintf(Twidth, "%f", ToothWidth);NXOpen::Features::Feature* nullNXOpen_Features_Feature(NULL);NXOpen::Body* nullNXOpen_Body(NULL);NXOpen::Features::ExtrudeBuilder* extrudeBuilder1;extrudeBuilder1 = GPart->Features()->CreateExtrudeBuilder(nullNXOpen_Features_Feature);extrudeBuilder1->BooleanOperation()->SetType(NXOpen::GeometricUtilities::BooleanOperation::BooleanTypeCreate);extrudeBuilder1->SetDistanceTolerance(0.001);NXOpen::Section* section1;section1 = GPart->Sections()->CreateSection(0.00095, 0.001, 0.05);extrudeBuilder1->SetSection(section1);extrudeBuilder1->AllowSelfIntersectingSection(true);section1->SetAllowedEntityTypes(NXOpen::Section::AllowTypesOnlyCurves);section1->AllowSelfIntersection(true);std::vector<NXOpen::Body*> targetBodies1(1);targetBodies1[0] = nullNXOpen_Body;extrudeBuilder1->BooleanOperation()->SetTargetBodies(targetBodies1);extrudeBuilder1->Limits()->StartExtend()->Value()->SetRightHandSide(Twidth);extrudeBuilder1->Limits()->EndExtend()->Value()->SetRightHandSide("0");NXOpen::Point3d origin1;NXOpen::Vector3d vector1(0.0, 0.0, 1.0);NXOpen::Direction* direction1;direction1 = GPart->Directions()->CreateDirection(origin1, vector1, NXOpen::SmartObject::UpdateOptionWithinModeling);extrudeBuilder1->SetDirection(direction1);NXOpen::NXObject* nullNXOpen_NXObject(NULL);NXOpen::Point3d helpPoint1;for (int j = 0; j < z; j++){double thetaj = j * 2 * PI / z;std::vector<NXOpen::Point* > Arc1jpoint;Arc1jpoint = RotZPoint(RDedendumcirclepoint, thetaj,Ms, GPart);NXObject* Arc1jnXObject = arccreatthreepoint(Arc1jpoint, GPart);tag_t Arc1jTag = NULL_TAG;Arc1jTag = Arc1jnXObject->Tag();std::vector<NXOpen::Point* > Spline2jpoint;Spline2jpoint = RotZPoint(RTransitionpoint, thetaj, Ms, GPart);NXObject* Spline2jnXObject = splinecreatbypoint(Spline2jpoint, GPart);tag_t Spline2jTag = NULL_TAG;Spline2jTag = Spline2jnXObject->Tag();std::vector<NXOpen::Point* > Spline3jpoint;Spline3jpoint = RotZPoint(RInvolutePoint, thetaj,Ms, GPart);NXObject* Spline3jnXObject = splinecreatbypoint(Spline3jpoint, GPart);tag_t Spline3jTag = NULL_TAG;Spline3jTag = Spline3jnXObject->Tag();std::vector<NXOpen::Point* > Arc4jpoint;Arc4jpoint = RotZPoint(Addendumcirclepoint, thetaj,Ms, GPart);NXObject* Arc4jnXObject = arccreatthreepoint(Arc4jpoint, GPart);tag_t Arc4jTag = NULL_TAG;Arc4jTag = Arc4jnXObject->Tag();std::vector<NXOpen::Point* > Spline5jpoint;Spline5jpoint = RotZPoint(LInvolutePoint, thetaj,Ms, GPart);NXObject* Spline5jnXObject = splinecreatbypoint(Spline5jpoint, GPart);tag_t Spline5jTag = NULL_TAG;Spline5jTag = Spline5jnXObject->Tag();std::vector<NXOpen::Point* > Spline6jpoint;Spline6jpoint = RotZPoint(LTransitionpoint, thetaj,Ms, GPart);NXObject* Spline6jnXObject = splinecreatbypoint(Spline6jpoint, GPart);tag_t Spline6jTag = NULL_TAG;Spline6jTag = Spline6jnXObject->Tag();std::vector<NXOpen::Point* > Arc7jpoint;Arc7jpoint = RotZPoint(LDedendumcirclepoint, thetaj,Ms, GPart);NXObject* Arc7jnXObject = arccreatthreepoint(Arc7jpoint, GPart);tag_t Arc7jTag = NULL_TAG;Arc7jTag = Arc7jnXObject->Tag();addarctosection(Arc1jnXObject, section1, Arc1jTag, helpPoint1, GPart);addsplinetosection(Spline2jnXObject, section1, Spline2jTag, helpPoint1, GPart);addsplinetosection(Spline3jnXObject, section1, Spline3jTag, helpPoint1, GPart);addarctosection(Arc4jnXObject, section1, Arc4jTag, helpPoint1, GPart);addsplinetosection(Spline5jnXObject, section1, Spline5jTag, helpPoint1, GPart);addsplinetosection(Spline6jnXObject, section1, Spline6jTag, helpPoint1, GPart);addarctosection(Arc7jnXObject, section1, Arc7jTag, helpPoint1, GPart);}NXOpen::Point* HalfholepointS= pointcreat({ Holediameter / 2,0.0,0.0}, GPart);NXOpen::Point* HalfholepointE = pointcreat({ -Holediameter / 2, 0.0,0.0 }, GPart);NXOpen::Point* HalfholepointM1 =pointcreat({0.0, Holediameter / 2,0.0 }, GPart);NXOpen::Point* HalfholepointM2 = pointcreat({ 0.0,-Holediameter / 2,0.0 }, GPart);std::vector<NXOpen::Point* > Halfhole1point;Halfhole1point.push_back(HalfholepointE);Halfhole1point.push_back(HalfholepointS);Halfhole1point.push_back(HalfholepointM1);NXOpen::NXObject* HolenXObject1 = arccreatthreepoint(Halfhole1point, GPart);tag_t HoleTag1 = NULL_TAG;HoleTag1 = HolenXObject1->Tag();addarctosection(HolenXObject1, section1, HoleTag1, helpPoint1, GPart);std::vector<NXOpen::Point* > Halfhole2point;Halfhole2point.push_back(HalfholepointS);Halfhole2point.push_back(HalfholepointE);Halfhole2point.push_back(HalfholepointM2);NXOpen::NXObject* HolenXObject2 = arccreatthreepoint(Halfhole2point, GPart);tag_t HoleTag2 = NULL_TAG;HoleTag2 = HolenXObject2->Tag();addarctosection(HolenXObject2, section1, HoleTag2, helpPoint1, GPart);extrudeBuilder1->SetParentFeatureInternal(false);NXOpen::Features::Feature* feature1;feature1 = extrudeBuilder1->CommitFeature();extrudeBuilder1->Destroy();// TODO: add your code here}//------------------------------------------------------------------------------
// Entry point(s) for unmanaged internal NXOpen C/C++ programs
//------------------------------------------------------------------------------
// Explicit Execution
extern "C" DllExport void ufusr( char *parm, int *returnCode, int rlen )
{try{// Create NXOpen C++ class instanceMyClass *theMyClass;theMyClass = new MyClass();theMyClass->do_it();delete theMyClass;}catch (const NXException& e1){UI::GetUI()->NXMessageBox()->Show("NXException", NXOpen::NXMessageBox::DialogTypeError, e1.Message());}catch (const exception& e2){UI::GetUI()->NXMessageBox()->Show("Exception", NXOpen::NXMessageBox::DialogTypeError, e2.what());}catch (...){UI::GetUI()->NXMessageBox()->Show("Exception", NXOpen::NXMessageBox::DialogTypeError, "Unknown Exception.");}
}//------------------------------------------------------------------------------
// Unload Handler
//------------------------------------------------------------------------------
extern "C" DllExport int ufusr_ask_unload()
{// Unloads the image when the application completesreturn (int)Session::LibraryUnloadOptionImmediately; }