当前位置: 首页 > news >正文

Nxopen 直齿轮参数化设计

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;	}

在这里插入图片描述

相关文章:

Nxopen 直齿轮参数化设计

NXUG1953 Visualstudio 2019 参考论文&#xff1a; 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 I…...

线程配置经验

工作时&#xff0c;时常会遇到&#xff0c;线程相关的问题与解法&#xff0c;本人会持续对开发过程中遇到的关于线程相关的问题及解决记录更新记录在此篇博客中。 目录 一、线程基本知识 1. 线程和进程 二、问题与解法 1. 避免乘法级别数量线程并行 1&#xff09;使用线程池…...

火语言RPA--KimiAiFree服务

&#x1f6a9;【组件功能】&#xff1a;KimiAiFree服务支持联网搜索、支持智能体对话、支持长文档解读、支持图像OCR。 配置预览 配置说明 服务地址 支持T或# 自行搭建或第三方提供的KimiAiFree服务地址。 RefreshToken 支持T或# 与KimiAiFree服务交互时用到的token。从ki…...

P6120 [USACO17JAN] Hoof, Paper, Scissor S

难度&#xff1a;普及/提高−&#xff1b; 题意&#xff1a; ​ 石头、剪刀、布游戏&#xff0c;先给出 n n n 轮已经知道的其中一人的对局情况&#xff0c;例如样例&#xff1a; 5 P - 布 P - 布 H - 石头 P - 布 S - 剪刀另外一人&#xff0c;只允许修改一次机会的情况下…...

Android Studio打包APK

1.导出APK安装包 如果是首次打包&#xff0c;Create new 单击蓝色对话框右边文件夹&#x1f4c2;图标 &#xff0c;选择密钥保存路径&#xff0c;然后在下方File name对话框中填写您想要名称&#xff0c;再点击OK回到密钥创建对话框。 在此对话框中填写密码&#xff08;Passwo…...

08 比特币通用技术介绍

比特币分层 比特币区块结构 存储结构 区块是比特币存储交易的结构&#xff0c;一个区块总是指向其父节点。 一个区块包含三个字段&#xff1a;区块头、区块交易数量、交易列表。交易数量受到区块大小限制&#xff0c;输入、输出数量和脚本都会占用区块空间&#xff0c;矿工往…...

拟合损失函数

文章目录 拟合损失函数一、线性拟合1.1 介绍1.2 代码可视化1.2.1 生成示例数据1.2.2 损失函数1.2.3 绘制三维图像1.2.4 绘制等高线1.2.5 损失函数关于斜率的函数 二、 多变量拟合2.1 介绍2.2 代码可视化2.2.1 生成示例数据2.2.2 损失函数2.2.3 绘制等高线 三、 多项式拟合3.1 介…...

二进制安卓清单 binary AndroidManifest - XCTF apk 逆向-2

XCTF 的 apk 逆向-2 题目 wp&#xff0c;这是一道反编译对抗题。 题目背景 AndroidManifest.xml 在开发时是文本 xml&#xff0c;在编译时会被 aapt 编译打包成为 binary xml。具体的格式可以参考稀土掘金 MindMac 做的类图&#xff08;2014&#xff09;&#xff0c;下面的博…...

在线免费快速无痕去除照片海报中的文字logo

上期和大家分享了用photoshop快速无痕去除照片海报中的文字logo的方法&#xff0c;有的同学觉得安装PS太麻烦&#xff0c;有那下载安装时间早都日落西山了&#xff0c;问有没有合适的在线方法可以快速去除&#xff1b;达芬奇上网也尝试了几个网站&#xff0c;今天分享一个对国人…...

引领未来科技潮流:Web3 前沿发展趋势

随着技术不断发展&#xff0c;我们正站在一个全新的互联网时代的门槛上&#xff0c;Web3的出现正在重新定义互联网的构架和运作方式。Web3&#xff0c;作为互联网的下一代发展趋势&#xff0c;其核心思想是去中心化、开放与用户主权。与现有的Web2.0相比&#xff0c;Web3更加注…...

【番外篇】鸿蒙扫雷天纪:运混沌灵智勘破雷劫天局

大家好啊&#xff0c;我是小象٩(๑ω๑)۶ 我的博客&#xff1a;Xiao Xiangζั͡ޓއއ 很高兴见到大家&#xff0c;希望能够和大家一起交流学习&#xff0c;共同进步。 这一节课我们不学习新的知识&#xff0c;我们来做一个扫雷小游戏 目录 扫雷小游戏概述一、扫雷游戏分析…...

08.OSPF 特殊区域及其他特性

OSPF 特殊区域及其他特性 一. 前言OSPF的四个特殊区域Stub末梢区域Totally Stub完全末梢区域NSSATotally NSSA完全的NSSA二.Stub 区域和 Totally Stub 区域(1)网络规模变大引发的问题(2)传输区域和末端区域(3)Stub 区域(4)Totally Stub 区域三.NSSA 区域和 Totally NSS…...

人工智能在医疗领域的应用有哪些?

人工智能在医疗领域的应用十分广泛&#xff0c;涵盖了诊断、治疗、药物研发等多个环节&#xff0c;以下是一些主要的应用&#xff1a; 医疗影像诊断 疾病识别&#xff1a;通过分析 X 光、CT、MRI 等影像&#xff0c;人工智能算法能够识别出肿瘤、结节、骨折等病变&#xff0c;…...

c#使用Confluent.Kafka实现生产者发送消息至kafka(远程连接kafka发送消息超时的解决 Local:Message timed out)

水一篇&#xff1a; 参考&#xff1a;c#使用Confluent.Kafka实现生产者发送消息至kafka&#xff08;远程连接kafka发送消息超时的解决 Local&#xff1a;Message timed out&#xff09; - 寒冰之光 - 博客园 该死的Kafka&#xff0c;远程连接Kafka超时以及解决办法 - 博客王大…...

【2025年数学建模美赛F题】(顶刊论文绘图)模型代码+论文

全球网络犯罪与网络安全政策的多维度分析及效能评估 摘要1 Introduction1.1 Problem Background1.2Restatement of the Problem1.3 Literature Review1.4 Our Work 2 Assumptions and Justifications数据完整性与可靠性假设&#xff1a;法律政策独立性假设&#xff1a;人口统计…...

DeepSeek 的背景介绍

在全球人工智能大模型蓬勃发展的浪潮中&#xff0c;DeepSeek 宛如一颗耀眼的新星&#xff0c;迅速崛起并吸引了众多关注的目光。它的出现不仅为人工智能领域注入了新的活力&#xff0c;也在一定程度上改变了行业的竞争格局。 一、创立背景与资金支持 DeepSeek&#xff0c;中文…...

Meta 计划 2025 年投资 650 亿美元推动 AI 发展

每周跟踪AI热点新闻动向和震撼发展 想要探索生成式人工智能的前沿进展吗&#xff1f;订阅我们的简报&#xff0c;深入解析最新的技术突破、实际应用案例和未来的趋势。与全球数同行一同&#xff0c;从行业内部的深度分析和实用指南中受益。不要错过这个机会&#xff0c;成为AI领…...

信息学奥赛一本通 2110:【例5.1】素数环

【题目链接】 ybt 2110&#xff1a;【例5.1】素数环 【题目考点】 1. 深搜回溯 2. 质数 【解题思路】 1~n的数字构成一个环&#xff0c;要求相邻数字加和必须是质数。 该题最终输出的是一个序列&#xff0c;只不过逻辑上序列最后一个数字的下一个数字就是序列的第一个数字…...

Redis、MongoDB 和 MySQL评估

Redis、MongoDB 和 MySQL 是三种不同类型的数据库系统&#xff0c;各自有独特的特点和适用场景。MySQL 是一个关系型数据库管理系统&#xff08;RDBMS&#xff09;&#xff0c;而 Redis 和 MongoDB 是非关系型数据库&#xff08;NoSQL&#xff09;。以下是对这三者的比较以及它…...

P1719 最大加权矩形

为了更好的备战 NOIP2013&#xff0c;电脑组的几个女孩子 LYQ,ZSC,ZHQ 认为&#xff0c;我们不光需要机房&#xff0c;我们还需要运动&#xff0c;于是就决定找校长申请一块电脑组的课余运动场地&#xff0c;听说她们都是电脑组的高手&#xff0c;校长没有马上答应他们&#xf…...

在生产环境中部署和管理 Apache:运维从入门到精通

在生产环境中部署和管理 Apache:运维从入门到精通 引言 Apache HTTP Server(简称 Apache)作为世界上最受欢迎的 Web 服务器之一,因其稳定性、灵活性和丰富的模块支持而被广泛使用。从个人网站到企业级应用,Apache 都能游刃有余。然而,要想在生产环境中高效部署和管理 A…...

DeepSeek API 的获取与对话示例

代码文件下载&#xff1a;Code 在线链接&#xff1a;Kaggle | Colab 文章目录 注册并获取API环境依赖设置 API单轮对话多轮对话流式输出更换模型 注册并获取API 访问 https://platform.deepseek.com/sign_in 进行注册并登录&#xff1a; 新用户注册后将赠送 10 块钱余额&#…...

【愚公系列】《循序渐进Vue.js 3.x前端开发实践》027-组件的高级配置和嵌套

标题详情作者简介愚公搬代码头衔华为云特约编辑,华为云云享专家,华为开发者专家,华为产品云测专家,CSDN博客专家,CSDN商业化专家,阿里云专家博主,阿里云签约作者,腾讯云优秀博主,腾讯云内容共创官,掘金优秀博主,亚马逊技领云博主,51CTO博客专家等。近期荣誉2022年度…...

预测性维护系统:让设备“未卜先知”

预测性维护系统:让设备“未卜先知” 在工业4.0的浪潮中,设备管理正在向智能化转型。传统的设备维护方式,要么是定期维护(时间消耗大),要么是被动维修(问题发生后再处理)。这种方式效率低下且成本高昂。而预测性维护(Predictive Maintenance,简称PdM)则为设备管理提…...

Qt Ribbon使用实例

采用SARibbon创建简单的ribbon界面 实例代码如下所示&#xff1a; 1、头文件&#xff1a; #pragma once #include <SARibbonBar.h> #include "SARibbonMainWindow.h" class QTextEdit; class SAProjectDemo1 : public SARibbonMainWindow { Q_OBJECT pub…...

Midscene.js:重新定义UI自动化的新时代工具

前言 Midscene.js 是一个创新的、面向开发者的 UI 自动化解决方案&#xff0c;并通过人工智能技术简化自动化脚本的编写与维护。 它提供了三种核心方法——交互&#xff08;.ai, .aiAction&#xff09;、提取&#xff08;.aiQuery&#xff09;和断言&#xff08;.aiAssert&am…...

【C语言基础】编译并运行第一个C程序

博主未授权任何人或组织机构转载博主任何原创文章&#xff0c;感谢各位对原创的支持&#xff01; 博主链接 博客内容主要围绕&#xff1a; 5G/6G协议讲解 高级C语言讲解 Rust语言讲解 文章目录 编译并运行第一个C程序一、编译上面的程序二、运行上面的程序…...

处理 .gitignore 未忽略文件夹问题

本地删除缓存 例如 .idea 文件夹被其他同事误提交&#xff0c;那么他本地执行以下代码 git rm -r --cached .idea对应本地再提交即可...

php-phar打包避坑指南2025

有很多php脚本工具都是打包成phar形式&#xff0c;使用起来就很方便&#xff0c;那么如何自己做一个呢&#xff1f;也找了很多文档&#xff0c;也遇到很多坑&#xff0c;这里就来总结一下 phar安装 现在直接装yum php-cli包就有phar文件&#xff0c;很方便 可通过phar help查看…...

卡特兰数学习

1&#xff0c;概念 卡特兰数&#xff08;英语&#xff1a;Catalan number&#xff09;&#xff0c;又称卡塔兰数&#xff0c;明安图数。是组合数学中一种常出现于各种计数问题中的数列。它在不同的计数问题中频繁出现。 2&#xff0c;公式 卡特兰数的递推公式为&#xff1a;f(…...