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 参考论文: 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…...
Vue.js组件开发-实现HTML内容打印
在Vue项目中实现打印功能,可以借助vue-html-to-paper插件来完成。 步骤 创建Vue项目:如果还没有Vue项目,可以使用Vue CLI来创建一个新的项目。 npm install -g vue/cli vue create vue-print-template cd vue-print-template安装vue-html-…...
大模型GUI系列论文阅读 DAY4续:《Large Language Model Agent for Fake News Detection》
摘要 在当前的数字时代,在线平台上虚假信息的迅速传播对社会福祉、公众信任和民主进程构成了重大挑战,并影响着关键决策和公众舆论。为应对这些挑战,自动化假新闻检测机制的需求日益增长。 预训练的大型语言模型(LLMs࿰…...
Day27-【13003】短文,线性表两种基本实现方式空间效率、时间效率比较?兼顾优点的静态链表是什么?如何融入空闲单元链表来解决问题?
文章目录 本次内容总览第四节,两种基本实现方式概览两种基本实现方式的比较元素个数n大于多少时,使用顺序表存储的空间效率才会更高?时间效率比较?*、访问操作,也就是读运算,读操作1、插入,2、删…...
Scrapy如何设置iP,并实现IP重用, IP代理池重用
前置知识 1/3乐观锁 2/3 Scrapy流程(非全部) 3/3 关于付费代理 我用的"快代理", 1000个ip, 每个ip1min的有效期, 你用的时候, 把你的链接, 用户名填上去就行 设置代理IP 🔒 & 帮助文档: ①meta ②meta#proxy$ 语法: ①proxy的设置: Request对象中…...
动手学图神经网络(4):利用图神经网络进行图分类
利用图神经网络进行图分类:从理论到实践 引言 在之前的学习中,大家了解了如何使用图神经网络(GNNs)进行节点分类。本次教程将深入探讨如何运用 GNNs 解决图分类问题。图分类是指在给定一个图数据集的情况下,根据图的一些结构属性对整个图进行分类,而不是对图中的节点进…...
C++游戏开发深度解析
引言 在本篇文章中,我们将深入探讨C在游戏开发中的应用,包括内存管理、面向对象编程(OOP)、模板使用等,并通过实际代码示例来帮助理解。 内存管理与智能指针 cpp 深色版本 #include <iostream> #include <…...
ultralytics 是什么?
ultralytics 是一个用于计算机视觉任务的 Python 库,专注于提供高效、易用的目标检测、实例分割和图像分类工具。它最著名的功能是实现 YOLO(You Only Look Once) 系列模型,特别是最新的 YOLOv8。 1. YOLO 是什么? YO…...
【从零到一,C++项目实战】CineShare++(基于C++的视频点播系统)
🌈个人主页: 南桥几晴秋 🌈C专栏: 南桥谈C 🌈C语言专栏: C语言学习系列 🌈Linux学习专栏: 南桥谈Linux 🌈数据结构学习专栏: 数据结构杂谈 🌈数据…...
kaggle-ISIC 2024 - 使用 3D-TBP 检测皮肤癌-学习笔记
问题描述: 通过从 3D 全身照片 (TBP) 中裁剪出单个病变来识别经组织学确诊的皮肤癌病例 数据集描述: 图像临床文本信息 评价指标: pAUC,用于保证敏感性高于指定阈值下的AUC 主流方法分析(文本) 基于CatBoo…...
C语言深入解析 printf的底层源码实现
深入解析 printf 的底层源码实现 printf 是 C 标准库中最常用的函数之一,用于格式化输出字符串。它的底层实现复杂且高效,包含多个模块化的函数和机制。本文结合 GNU C Library(glibc)的源码,详细分析 printf 的实现原…...
IPhone14 Pro 设备详情
目录 产品宣传图内部图——后设备详细信息 产品宣传图 内部图——后 设备详细信息 信息收集于HubWeb.cn...
vim多文件操作如何同屏开多个文件
[rootxxx ~]# vimdiff aa.txt bb.txt cc.txt #带颜色比较的纵向排列打开的同屏多文件操作 示例: [rootxxx ~]# vimdiff -o aa.txt bb.txt cc.txt #带颜色比较的横向排列打开的同屏多文件操作 示例: [rootxxx ~]# vim -O aa.txt bb.txt c…...
18款炫酷烟花合集
系列专栏 《Python趣味编程》《C/C趣味编程》《HTML趣味编程》《Java趣味编程》 写在前面 Python、C/C、HTML、Java等4种语言实现18款炫酷烟花的代码。 Python Python烟花① 完整代码:Python动漫烟花(完整代码)-CSDN博客 Python烟…...
服务器虚拟化技术详解与实战:架构、部署与优化
📝个人主页🌹:一ge科研小菜鸡-CSDN博客 🌹🌹期待您的关注 🌹🌹 引言 在现代 IT 基础架构中,服务器虚拟化已成为提高资源利用率、降低运维成本、提升系统灵活性的重要手段。通过服务…...
01.双Android容器解决方案
目录 写在前面 一,容器 1.1 容器的原理 1.1.1 Namespace 1.1.2 Cgroups(Control Groups) 1.1.3 联合文件系统(Union File System) 1.2 容器的应用 1.2.1 微服务架构 1.2.2 持续集成和持续部署(CI/C…...
C++封装红黑树实现mymap和myset和模拟实现详解
文章目录 map和set的封装map和set的底层 map和set的模拟实现insertiterator实现的思路operatoroperator- - map和set的封装 介绍map和set的底层实现 map和set的底层 一份模版实例化出key的rb_tree和pair<k,v>的rb_tree rb_tree的Key和Value不是我们之前传统意义上的key/…...
嵌入式知识点总结 Linux驱动 (一)-指令-常用Linux指令 GCC指令 GDB调试指令 驱动开发指令
针对于嵌入式软件杂乱的知识点总结起来,提供给读者学习复习对下述内容的强化。 目录 1.怎么查看当前进程?怎么执行退出?怎么查看当前路径? 2.ls命令执行有什么功能?可以带哪些参数? 3.创建目录用什么命令…...
数字化创新者如何利用开源2+1链动模式AI智能名片S2B2C商城小程序源码重塑市场地位
摘要:在数字化转型的浪潮中,数字化创新者正通过整合前沿技术,重塑行业格局,引领市场变革。本文深入探讨了开源21链动模式、AI智能名片以及S2B2C商城小程序源码等技术在数字化创新中的应用,旨在揭示这些技术如何助力企业…...
以用户为中心,优化 B 端界面设计
在数字化转型的进程中,B 端产品已成为企业高效运营的关键支撑,而 B 端界面设计则是决定其成败的核心要素。以用户为中心优化 B 端界面,不仅能提升员工操作体验,还能为企业运营注入强大动力。 以用户为中心,意味着深入洞…...
微服务学习-服务调用组件 OpenFeign 实战
1. OpenFeign 接口方法编写规范 1.1. 在编写 OpenFeign 接口方法时,需要遵循以下规范 1.1.1.1. 接口中的方法必须使用 RequestMapping、GetMapping、PostMapping 等注解声明 HTTP 请求的类型。 1.1.1.2. 方法的参数可以使用 RequestParam、RequestHeader、PathVa…...
使用国内镜像加速器解决 Docker Hub 拉取镜像慢或被屏蔽的问题
一、问题背景 Docker Hub 是 Docker 默认的镜像仓库,但由于网络限制,国内用户直接拉取镜像可能面临以下问题: 下载速度极慢(尤其是大镜像)。连接超时或完全被屏蔽(部分网络环境)。依赖国外源的…...
反向代理模块。。
1 概念 1.1 反向代理概念 反向代理是指以代理服务器来接收客户端的请求,然后将请求转发给内部网络上的服务器,将从服务器上得到的结果返回给客户端,此时代理服务器对外表现为一个反向代理服务器。 对于客户端来说,反向代理就相当于…...
《十七》浏览器基础
浏览器:是安装在电脑里面的一个软件,能够将页面内容渲染出来呈现给用户查看,并让用户与网页进行交互。 常见的主流浏览器: 常见的主流浏览器有:Chrome、Safari、Firefox、Opera、Edge 等。 输入 URL,浏览…...
飞致云开源社区月度动态报告(2025年1月)
自2023年6月起,中国领先的开源软件公司飞致云以月度为单位发布《飞致云开源社区月度动态报告》,旨在向广大社区用户同步飞致云旗下系列开源软件的发展情况,以及当月主要的产品新版本发布、社区运营成果等相关信息。 飞致云开源运营数据概览&…...
【PyQt5】数据库连接失败: Driver not loaded Driver not loaded
报错内容如下: 可以看到目前所支持的数据库驱动仅有[‘QSQLITE’, ‘QMARIADB’, ‘QODBC’, ‘QODBC3’, ‘QPSQL’, ‘QPSQL7’] 我在网上查找半天解决方法未果,其中有一篇看评论反馈是可以使用的,但是PyQt5的版本有点低,5.12…...
Linux之内存管理前世今生(一)
一个程序(如王者荣耀)平常是存储在硬盘上的,运行时才把这个程序载入内存,CPU才能执行。 问题: 这个程序载入内存的哪个位置呢?载入内核所在的空间吗?系统直接挂了。 一、虚拟内存 1.1 内存分…...
【cran Archive R包的安装方式】
cran Archive R包的安装方式 添加链接描述 1.包被cran移除 2.包要求的R语言版本与你电脑上的版本不相符 ad archive包的网址或者是下载到工作目录下,ad等于文件名 install,packages(ad repos NULL)...
Python中容器类型的数据(上)
若我们想将多个数据打包并且统一管理,应该怎么办? Python内置的数据类型如序列(列表、元组等)、集合和字典等可以容纳多项数据,我们称它们为容器类型的数据。 序列 序列 (sequence) 是一种可迭代的、元素有序的容器类型的数据。 序列包括列表 (list)…...
2025美赛美国大学生数学建模竞赛A题完整思路分析论文(43页)(含模型、可运行代码和运行结果)
2025美国大学生数学建模竞赛A题完整思路分析论文 目录 摘要 一、问题重述 二、 问题分析 三、模型假设 四、 模型建立与求解 4.1问题1 4.1.1问题1思路分析 4.1.2问题1模型建立 4.1.3问题1样例代码(仅供参考) 4.1.4问题1样例代码运行结果&…...
OneDrive同步桌面 实现文件备份
Target 将笔记本桌面与OneDrive同步,当Desktop的文件发生变动时,自动更新到OneDrive。 取消旧的OneDrive账号与本机的关联 点击logo,弹出界面,点击设置。 随后打开OneDrive界面,点击“同步与备份”,“备…...
14.模型,纹理,着色器
模型、纹理和着色器是计算机图形学中的三个核心概念,用通俗易懂的方式来解释: 1. 模型:3D物体的骨架 通俗解释: 模型就像3D物体的骨架,定义了物体的形状和结构。 比如,一个房子的模型包括墙、屋顶、窗户等…...
用C++编写一个2048的小游戏
以下是一个简单的2048游戏的实现。这个实现使用了控制台输入和输出,适合在终端或命令行环境中运行。 2048游戏的实现 1.游戏逻辑 2048游戏的核心逻辑包括: • 初始化一个4x4的网格。 • 随机生成2或4。 • 处理玩家的移动操作(上、下、左、…...
python -m pip和pip的主要区别
python -m pip和pip的主要区别在于它们与Python环境的关联方式和安装路径。 与Python环境的关联方式: pip 是直接使用命令行工具来安装Python包,不指定特定的Python解释器。如果系统中存在多个Python版本,可能会导致安装的包被安装到…...
linux监控脚本+自动触发邮件发送
linux脚本 需求: CPU 负载:使用 uptime 命令,我们可以清楚地了解系统的 CPU 负载情况。这个命令会显示系统在过去 1 分钟、5 分钟和 15 分钟的平均负载。高负载可能意味着系统正在处理大量的任务,可能会导致性能下降或服务响应延迟…...
Mybaties缓存机制
Mybatis缓存机制 在 MyBatis 中,缓存机制是用来提高查询效率的一种方式。MyBatis 提供了两种内置的缓存机制:一级缓存和二级缓存。 1. 一级缓存(Local Cache) 一级缓存是基于 SqlSession 的。当你在同一个 SqlSession 中执行相…...
面试题-Java集合框架
前言 Java集合框架(Java Collections Framework)是Java平台提供的一套用于表示和操作集合的统一架构。它位于java.util包中,并且自Java 1.2(也称为Java 2平台,标准版,即Java SE 2)起成为Java平…...
半波整流和全波整流电路汇总及电路仿真
0 前言 0.1 引言 整流电路是将交流电(AC)转换为直流电(DC)的电路,广泛应用于电源设计、信号处理和电力电子等领域。整流电路的基本功能是将交流电的正半周或负半周转换为直流电,从而为电子设备提供稳定的直流电源。本文将详细介绍半波整流和全波整流电路的工作原理、电…...
04-机器学习-网页数据抓取
网络爬取(Web Scraping)深度指南 1. 网络爬取全流程设计 一个完整的网络爬取项目通常包含以下步骤: 目标分析: 明确需求:需要哪些数据(如商品价格、评论、图片)?网站结构分析&…...
豆包MarsCode:前缀和计算问题
问题描述 思路分析 问题理解 小S的任务是计算一个整数数组 nums 的前缀和。前缀和是指从数组开始到某个位置的所有元素的累加值,形成一个新数组。例如: 输入数组:nums [4, 5, 1, 6]前缀和数组:[4, 9, 10, 16] 4 49 4 510 …...
MySQL中InnoDB逻辑存储结构
在MySQL中,InnoDB是最常用的存储引擎之一,它具有高度的事务支持、行级锁、ACID特性以及自动崩溃恢复等特性。InnoDB的逻辑存储结构可以分为多个层次,下面是详细的解析。 1. 表空间 (Tablespace) InnoDB的物理存储结构以表空间为基础。表空间…...
如何提高新产品研发效率
优化研发流程、采用先进工具、提升团队协作、持续学习与改进,是提高新产品研发效率的关键。其中,优化研发流程尤为重要。通过简化流程,减少不必要的环节和复杂性,企业可以显著提升研发效率。例如,采用自动化测试工具和…...
可扩展架构:如何打造一个善变的柔性系统?
系统的构成:模块 + 关系 我们天天和系统打交道,但你有没想过系统到底是什么?在我看来,系统内部是有明确结构 的,它可以简化表达为: 系统 = 模块 + 关系 在这里,模块是系统的基本组成部分,它泛指子系统、应用、服务或功能模块。关系指模块 之间的依赖关系,简单…...
使用大语言模型在表格化网络安全数据中进行高效异常检测
论文链接 Efficient anomaly detection in tabular cybersecurity data using large language models 论文主要内容 这篇论文介绍了一种基于大型语言模型(LLMs)的创新方法,用于表格网络安全数据中的异常检测,称为“基于引导式提…...
BUUCTF 蜘蛛侠呀 1
BUUCTF:https://buuoj.cn/challenges 文章目录 题目描述:密文:解题思路:flag: 相关阅读 CTF Wiki Hello CTF NewStar CTF buuctf-蜘蛛侠呀 BUUCTF:蜘蛛侠呀 MISC(时间隐写)蜘蛛侠呀 题目描述&am…...
eVTOL的航空电子设备漫谈
电动垂直起降(eVTOL),也统称为城市空中交通(UAM),是民用航空平台发展的新方向之一。随着它们在市场上成为现实,它们将对所使用的航空电子设备有其自身的要求.. eVTOL概念 eVTOL领域的发展才刚…...
SpringCloudAlibaba 服务保护 Sentinel 项目集成实践
目录 一、简介1.1、服务保护的基本概念1.1.1、服务限流/熔断1.1.2、服务降级1.1.3、服务的雪崩效应1.1.4、服务的隔离的机制 1.2、Sentinel的主要特性1.3、Sentinel整体架构1.4、Sentinel 与 Hystrix 对比 二、Sentinel控制台部署3.1、版本选择和适配3.2、本文使用各组件版本3.…...
【深度学习|DenseNet-121】Densely Connected Convolutional Networks内部结构和参数设置
【深度学习|DenseNet-121】Densely Connected Convolutional Networks内部结构和参数设置 【深度学习|DenseNet-121】Densely Connected Convolutional Networks内部结构和参数设置 文章目录 【深度学习|DenseNet-121】Densely Connected Convolutional Networks内部结构和参数…...
【问题】Qt c++ 界面 lineEdit、comboBox、tableWidget.... SIGSEGV错误
蛋疼的错误集锦----今日分错误: 在主界面或者对话框的构造函数中,准备对一些对象赋值初始化值时,报了以上错误。!!!! 一脸懵逼的,各种确认,因为是最基础的赋值想不到错在…...
Hugging Face 推出最小体积多模态模型,浏览器运行成为现实!
1. SmolVLM 模型家族简介 1.1 什么是 SmolVLM-256M 和 SmolVLM-500M,它们为何如此重要? 在人工智能的多模态模型领域,如何在有限的计算资源下实现强大性能一直是一个重要的挑战。SmolVLM-256M 和 SmolVLM-500M 是最近推出的两款视觉语言模型,它们不仅突破了传统“大模型”…...