使用XYZ创建点

#include <NXOpen/Session.hxx>
#include <NXOpen/BasePart.hxx>
#include <NXOpen/Builder.hxx>
#include <NXOpen/Expression.hxx>
#include <NXOpen/ExpressionCollection.hxx>
#include <NXOpen/Features_BaseFeatureCollection.hxx>
#include <NXOpen/Features_PointFeatureBuilder.hxx>
#include <NXOpen/NXObject.hxx>
#include <NXOpen/Part.hxx>
#include <NXOpen/PartCollection.hxx>
#include <NXOpen/Point.hxx>
#include <NXOpen/PointCollection.hxx>
#include <NXOpen/Preferences_PartModeling.hxx>
#include <NXOpen/Preferences_PartPreferences.hxx>
#include <NXOpen/Scalar.hxx>
#include <NXOpen/ScalarCollection.hxx>
#include <NXOpen/Session.hxx>
#include <NXOpen/SmartObject.hxx>
#include <NXOpen/Unit.hxx>
#include <NXOpen/UnitCollection.hxx>
#include <NXOpen/Update.hxx>

void create_point_by_XYZ(double X,double Y,double Z)
{
  Session *theSession = Session::GetSession();
    Part *workPart(theSession->Parts()->Work());
    Part *displayPart(theSession->Parts()->Display());
    Point3d coordinates1(X, Y, Z);
    Point *point3;
    point3 = workPart->Points()->CreatePoint(coordinates1);
   
    point3->SetVisibility(SmartObject::VisibilityOptionVisible);
   
    Features::Feature *nullFeatures_Feature(NULL);
   
    Features::PointFeatureBuilder *pointFeatureBuilder1;
    pointFeatureBuilder1 = workPart->BaseFeatures()->CreatePointFeatureBuilder(nullFeatures_Feature);
   
    pointFeatureBuilder1->SetPoint(point3);
   
    NXObject *nXObject1;
    nXObject1 = pointFeatureBuilder1->Commit();
   
    pointFeatureBuilder1->Destroy();
}

原文地址:https://www.cnblogs.com/whiteIcrow/p/3678261.html