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

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/8498.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

基于vue和elementui的简易课表

本文参考基于vue和elementui的课程表_vue实现类似课程表的周会议列表-CSDN博客&#xff0c;原程序在vue3.5.13版本下不能运行&#xff0c;修改两处&#xff1a; 1&#xff09;slot-cope改为v-slot 2&#xff09;return background-color:rgb(24 144 255 / 80%);color: #fff; …

Unreal Engine 5 C++ Advanced Action RPG 十一章笔记

第十一章 In Game Widgets 本章节就是做UI2-Template Button Widget 这章节创建不同的UI 结束UI胜利UI暂停菜单主菜单加载UI新建一个按钮小组件作为模版 3-Pause Menu Template Button 继续做更多模版UI 4-Lose Screen(游戏失败UI) 做失败的UI 之前按钮模版的调度程序就在这起…

若依基本使用及改造记录

若依框架想必大家都了解得不少&#xff0c;不可否认这是一款及其简便易用的框架。 在某种情况下&#xff08;比如私活&#xff09;使用起来可谓是快得一匹。 在这里小兵结合自身实际使用情况&#xff0c;记录一下我对若依框架的使用和改造情况。 一、源码下载 前往码云进行…

【数据结构】(1)集合类的认识

一、什么是数据结构 1、数据结构的定义 数据结构就是存储、组织数据的方式&#xff0c;即相互之间存在一种或多种关系的数据元素的集合。 2、学习数据结构的目的 在实际开发中&#xff0c;我们需要使用大量的数据。为了高效地管理这些数据&#xff0c;实现增删改查等操作&…

git相关命令

目录 一、创建 二、添加文件和修改提交文件 1、git add 文件名 添加到暂存区 提交多个文件 撤销回工作区 2、git commit -m "注释" 提交文件到主分支 3、修改后添加&#xff0c;提交 三、版本回退 1、查看日志git log 2、版本回退和撤销 2.1…

第4章 神经网络【1】——损失函数

4.1.从数据中学习 实际的神经网络中&#xff0c;参数的数量成千上万&#xff0c;因此&#xff0c;需要由数据自动决定权重参数的值。 4.1.1.数据驱动 数据是机器学习的核心。 我们的目标是要提取出特征量&#xff0c;特征量指的是从输入数据/图像中提取出的本质的数 …

[c语言日寄]assert函数功能详解

【作者主页】siy2333 【专栏介绍】⌈c语言日寄⌋&#xff1a;这是一个专注于C语言刷题的专栏&#xff0c;精选题目&#xff0c;搭配详细题解、拓展算法。从基础语法到复杂算法&#xff0c;题目涉及的知识点全面覆盖&#xff0c;助力你系统提升。无论你是初学者&#xff0c;还是…

Canny 边缘检测

步骤 1.降噪 应用高斯滤波器&#xff0c;以平滑图像&#xff0c;滤除噪声。 边缘检测易受噪声影响&#xff0c;所以使用高斯滤波器平滑图像&#xff0c;降低噪声。 2.梯度 计算图像中每个像素点的梯度大小和方向。 计算大小 Sobel算子是一种常用的边缘检测滤波器&#xff…

【数据结构】_链表经典算法OJ:合并两个有序数组

目录 1. 题目描述及链接 2. 解题思路 3. 程序 3.1 第一版 3.2 第二版 1. 题目描述及链接 题目链接&#xff1a;21. 合并两个有序链表 - 力扣&#xff08;LeetCode&#xff09; 题目描述&#xff1a; 将两个升序链表合并为一个新的 升序 链表并返回。 新链表是通过拼接给…

LiteFlow Spring boot使用方式

文章目录 概述LiteFlow框架的优势规则调用逻辑规则组件定义组件内数据获取通过 DefaultContext自定义上下文 通过 组件规则定义数据通过预先传入数据 liteflow 使用 概述 在每个公司的系统中&#xff0c;总有一些拥有复杂业务逻辑的系统&#xff0c;这些系统承载着核心业务逻…

六、深入了解DI

依赖注入是⼀个过程&#xff0c;是指IoC容器在创建Bean时,去提供运⾏时所依赖的资源&#xff0c;⽽资源指的就是对象. 在上⾯程序案例中&#xff0c;我们使⽤了 Autowired 这个注解&#xff0c;完成了依赖注⼊的操作. 简单来说,就是把对象取出来放到某个类的属性中。 关于依赖注…

c++贪心

本篇文章&#xff0c;我将同大家一起学习c的贪心&#xff01;&#xff01;&#xff01; 目录 第一题 题目链接 题目解析 代码原理 代码编写 第二题 题目链接 题目解析 代码原理 代码编写 第三题 题目链接 题目解析 代码原理 代码编写 第四题 题目链接 题目解…

高低频混合组网系统中基于地理位置信息的信道测量算法matlab仿真

目录 1.算法运行效果图预览 2.算法运行软件版本 3.部分核心程序 4.算法理论概述 5.算法完整程序工程 1.算法运行效果图预览 (完整程序运行后无水印) 2.算法运行软件版本 matlab2022a 3.部分核心程序 &#xff08;完整版代码包含详细中文注释和操作步骤视频&#xff09…

【Python实现机器遗忘算法】复现2020年顶会CVPR算法Selective Forgetting

【Python实现机器遗忘算法】复现2020年顶会CVPR算法Selective Forgetting 1 算法原理 Golatkar, A., Achille, A., & Soatto, S. (2020). Eternal sunshine of the spotless net: Selective forgetting in deep networks. In Proceedings of the IEEE/CVF Conference on Co…

Linux(NTP配置)

后面也会持续更新&#xff0c;学到新东西会在其中补充。 建议按顺序食用&#xff0c;欢迎批评或者交流&#xff01; 缺什么东西欢迎评论&#xff01;我都会及时修改的&#xff01; NTP环境搭建 服务端客户端192.168.111.10192.168.111.11Linux MySQL5.7 3.10.0-1160.el7.x86_…

神经网络|(四)概率论基础知识-古典概型

【1】引言 前序学习了线性回归的基础知识&#xff0c;了解到最小二乘法可以做线性回归分析&#xff0c;但为何最小二乘法如此准确&#xff0c;这需要从概率论的角度给出依据。 因此从本文起&#xff0c;需要花一段时间来回顾概率论的基础知识。 【2】古典概型 古典概型是我…

21款炫酷烟花合集

系列专栏 《Python趣味编程》《C/C趣味编程》《HTML趣味编程》《Java趣味编程》 写在前面 Python、C/C、HTML、Java等4种语言实现18款炫酷烟花的代码。 Python Python烟花① 完整代码&#xff1a;Python动漫烟花&#xff08;完整代码&#xff09; ​ Python烟花② 完整…

新项目上传gitlab

Git global setup git config --global user.name “FUFANGYU” git config --global user.email “fyfucnic.cn” Create a new repository git clone gitgit.dev.arp.cn:casDs/sawrd.git cd sawrd touch README.md git add README.md git commit -m “add README” git push…

Brightness Controller-源码记录

Brightness Controller 亮度控制 一、概述二、ddcutil 与 xrandr1. ddcutil2. xrandr 三、部分代码解析1. icons2. ui3. utilinit.py 一、概述 项目&#xff1a;https://github.com/SunStorm2018/Brightness.git 原理&#xff1a;Brightness Controlle 是我在 Ubuntu 发现上调…

机器学习-K近邻算法

文章目录 一. 数据集介绍Iris plants dataset 二. 代码三. k值的选择 一. 数据集介绍 鸢尾花数据集 鸢尾花Iris Dataset数据集是机器学习领域经典数据集&#xff0c;鸢尾花数据集包含了150条鸢尾花信息&#xff0c;每50条取自三个鸢尾花中之一&#xff1a;Versicolour、Setosa…