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.mzph.cn/diannao/68624.shtml

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

相关文章

蓝桥杯模拟算法:蛇形方阵

P5731 【深基5.习6】蛇形方阵 - 洛谷 | 计算机科学教育新生态 我们只要定义两个方向向量数组&#xff0c;这种问题就可以迎刃而解了 比如我们是4的话&#xff0c;我们从左向右开始存&#xff0c;1&#xff0c;2&#xff0c;3&#xff0c;4 到5的时候y就大于4了就是越界了&…

VLLM性能调优

1. 抢占 显存不够的时候&#xff0c;某些request会被抢占。其KV cache被清除&#xff0c;腾退给其他request&#xff0c;下次调度到它&#xff0c;重新计算KV cache。 报这条消息&#xff0c;说明已被抢占&#xff1a; WARNING 05-09 00:49:33 scheduler.py:1057 Sequence gr…

HTML特殊符号的使用示例

目录 一、基本特殊符号的使用 1、空格符号&#xff1a; 2、小于号 和 大于号&#xff1a; 3、引号&#xff1a; 二、版权、注册商标符号的使用 1、版权符号&#xff1a;© 2、注册商标符号&#xff1a; 三、数学符号的使用 四、箭头符号的使用 五、货币符号的使用…

three.js用粒子使用canvas生成的中文字符位图材质

three.js用粒子使用canvas生成中文字符材质 <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1.0"><title>Three.…

STM32 PWM驱动直流电机

接线图&#xff1a; 代码配置&#xff1a; 根据驱动舵机的代码来写&#xff0c;与舵机不同的是&#xff0c;这次的引脚接到了PA2上&#xff0c;所以需要改一下引脚以及改为OC3通道。 另外还需在配置两个GPIO引脚&#xff0c;来控制电机的旋转方向&#xff0c;这里连接到了PA4与…

【外文原版书阅读】《机器学习前置知识》2.用看电影推荐的例子带你深入了解向量点积在机器学习的作用

目录 3.3 Where Are You Looking, Vector? The Dot Product 个人主页&#xff1a;Icomi 大家好&#xff0c;我是Icomi&#xff0c;本专栏是我阅读外文原版书《Before Machine Learning》对于文章中我认为能够增进线性代数与机器学习之间的理解的内容的一个输出&#xff0c;希望…

Conditional DETR for Fast Training Convergence论文学习

1. 写作背景 最近提出的 DETR 成功地将 transformer 引入到物体检测任务中&#xff0c;获得了很不错的性能。DETR 的重要意义在于去除了物体检测算法里需要人工设计的部分&#xff0c;比如 anchor 的生成和 NMS 操作。这大大简化了物体检测的设计流程。基本的结构还是沿用了以…

低代码产品表单渲染架构

在React和Vue没有流行起来的时候&#xff0c;低代码产品的表单渲染设计通常会使用操作Dom的方式实现。 下面是一个表单的例子&#xff1a; 产品层 用户通过打开表单&#xff0c;使用不同业务场景业务下的表单页面&#xff0c;中间的Render层就是技术实现。 每一个不同业务的表单…

XSS 漏洞全面解析:原理、危害与防范

目录 前言​编辑 漏洞原理 XSS 漏洞的危害 检测 XSS 漏洞的方法 防范 XSS 漏洞的措施 前言 在网络安全的复杂版图中&#xff0c;XSS 漏洞&#xff0c;即跨站脚本攻击&#xff08;Cross - Site Scripting&#xff09;&#xff0c;是一类极为普遍且威胁巨大的安全隐患。随着互…

拒绝 Github 投毒,通过 Sharp4SuoBrowser 分析 Visual Studio 隐藏文件

近期的网络安全事件中&#xff0c;某提权工具被发现植入后门&#xff0c;攻击者使用 .suo 文件作为隐蔽攻击媒介。由于 .suo 文件是项目的隐藏配置文件&#xff0c;安全研究人员很少关注它的内容。 此次攻击事件被初步判断为东南亚地区的 APT 组织——海莲花&#xff08;Lotus…

shiro学习五:使用springboot整合shiro。在前面学习四的基础上,增加shiro的缓存机制,源码讲解:认证缓存、授权缓存。

文章目录 前言1. 直接上代码最后在讲解1.1 新增的pom依赖1.2 RedisCache.java1.3 RedisCacheManager.java1.4 jwt的三个类1.5 ShiroConfig.java新增Bean 2. 源码讲解。2.1 shiro 缓存的代码流程。2.2 缓存流程2.2.1 认证和授权简述2.2.2 AuthenticatingRealm.getAuthentication…

Edge-TTS在广电系统中的语音合成技术的创新应用

Edge-TTS在广电系统中的语音合成技术的创新应用 作者&#xff1a;本人是一名县级融媒体中心的工程师&#xff0c;多年来一直坚持学习、提升自己。喜欢Python编程、人工智能、网络安全等多领域的技术。 摘要 随着人工智能技术的快速发展&#xff0c;文字转语音&#xff08;Te…

python3+TensorFlow 2.x(二) 回归模型

目录 回归算法 1、线性回归 (Linear Regression) 一元线性回归举例 2、非线性回归 3、回归分类 回归算法 回归算法用于预测连续的数值输出。回归分析的目标是建立一个模型&#xff0c;以便根据输入特征预测目标变量&#xff0c;在使用 TensorFlow 2.x 实现线性回归模型时&…

HarmonyOS应用开发快速入门

本节内容将帮助开发者学习如何构建一个全新的HarmonyOS应用&#xff0c;学习使用DevEco Studio创建新项目、使用预览器预览页面、了解基础组件如Image、Text等。 文章目录 一、介绍二、创建一个新项目三、页面结构总览四、自定义文本视图五、创建Image组件 一、介绍 根据本教程…

高级编码参数

1.跳帧机制 参考资料&#xff1a;frameskipping-hotedgevideo 跳帧机制用于优化视频质量和编码效率。它通过选择性地跳过某些帧并使用参考帧来预测和重建视频内容&#xff0c;从而减少编码所需的比特率&#xff0c;同时保持较高的视频质量。在视频编码过程中&#xff0c;如果…

CUDA学习-内存访问

一 访存合并 1.1 说明 本部分内容主要参考: 搞懂 CUDA Shared Memory 上的 bank conflicts 和向量化指令(LDS.128 / float4)的访存特点 - 知乎 1.2 share memory结构 图1.1 share memory结构 放在 shared memory 中的数据是以 4 bytes(即 32 bits)作为 1 个 word,依…

「AI学习笔记」深度学习进化史:从神经网络到“黑箱技术”(三)

在这篇文章中&#xff0c;我们将探讨深度学习&#xff08;DL&#xff09;这一领域的最新发展&#xff0c;以及它如何从传统机器学习&#xff08;ML&#xff09;中独立出来&#xff0c;成为一个独立的生态系统。深度学习的核心思想与我们大脑中的神经网络高度相似&#xff0c;因…

On to OpenGL and 3D computer graphics

2. On to OpenGL and 3D computer graphics 声明&#xff1a;该代码来自&#xff1a;Computer Graphics Through OpenGL From Theory to Experiments&#xff0c;仅用作学习参考 2.1 First Program Square.cpp完整代码 /// // square.cpp // // OpenGL program to draw a squ…

蓝桥杯练习日常|递归-进制转换

蓝桥云课760数的计算 一、递归 题目&#xff1a; 我的解题代码&#xff1a; #include <iostream> using namespace std; int sum0; int main() {// 请在此输入您的代码int n;cin>>n;int fun(int n);fun(n); cout<<sum<<\n;return 0; } // void fu…

WordPress使用(1)

1. 概述 WordPress是一个开源博客框架&#xff0c;配合不同主题&#xff0c;可以有多种展现方式&#xff0c;博客、企业官网、CMS系统等&#xff0c;都可以很好的实现。 官网&#xff1a;博客工具、发布平台和内容管理系统 – WordPress.org China 简体中文&#xff0c;这里可…