NX二次开发,创建基准平面
通过点与方向创建基准平面
NXObject* CreateDatumOlane(Point3d iPoint, Vector3d iVec, NXObject* iDatumPlane)
{
Session* theSession = Session::GetSession();
Part* workPart = theSession->Parts()->Work();
Features::DatumPlaneFeature* datumPlaneFeature1 = NULL;
if(iDatumPlane != NULL)
datumPlaneFeature1 = dynamic_cast<Features::DatumPlaneFeature*>(iDatumPlane );
Features::DatumPlaneBuilder* datumPlaneBuilder1 = workPart->Features()->CreateDatumPlaneBuilder(datumPlaneFeature1 );
Point* point1 = workPart->Points()->CreatePoint(iPoint);
Direction* direction1 = workPart->Directions()->CreateDirection(iPoint, iVec, SmartObject::UpdateOption::UpdateOptionWithinModeling);
datumPlaneBuilder1->SetPointAndDirection(point1, direction1);
NXObject* vObject = datumPlaneBuilder1->CommitFeature();
datumPlaneBuilder1->Destroy();
return vObject;
}