首页 > 其他分享 >测量角度

测量角度

时间:2023-02-18 12:00:56浏览次数:28  
标签:workPart MeasureManager 测量 measureAngle1 角度 NXOpen measureAngleBuilder1 nullNXOp

double Angle_faceFaec(tag_t Obj1, tag_t Obj2)//测量角度
{

NXOpen::Session *theSession = NXOpen::Session::GetSession();
NXOpen::Part *workPart(theSession->Parts()->Work());
NXOpen::Part *displayPart(theSession->Parts()->Display());


NXOpen::NXObject *nullNXOpen_NXObject(NULL);
NXOpen::MeasureAngleBuilder *measureAngleBuilder1;
measureAngleBuilder1 = workPart->MeasureManager()->CreateMeasureAngleBuilder(nullNXOpen_NXObject);

measureAngleBuilder1->SetInfoWindow(true);

 

//NXOpen::Features::Brep *brep1(dynamic_cast<NXOpen::Features::Brep *>(workPart->Features()->FindObject("UNPARAMETERIZED_FEATURE(52)")));
NXOpen::Face *face1(dynamic_cast<NXOpen::Face *>(NXOpen::NXObjectManager::Get(Obj1)));
measureAngleBuilder1->Object1()->SetValue(face1);

 

NXOpen::Face *face2(dynamic_cast<NXOpen::Face *>(NXOpen::NXObjectManager::Get(Obj2)));
measureAngleBuilder1->Object2()->SetValue(face2);

NXOpen::Unit *nullNXOpen_Unit(NULL);
NXOpen::MeasureAngle *measureAngle1;
measureAngle1 = workPart->MeasureManager()->NewAngle(nullNXOpen_Unit, face1, NXOpen::MeasureManager::EndpointTypeStartPoint, face2, NXOpen::MeasureManager::EndpointTypeStartPoint, true, false);

//measureAngle1->Information();

//获得距离
double Angle = measureAngle1->Value();

delete measureAngle1;

return Angle;

}

标签:workPart,MeasureManager,测量,measureAngle1,角度,NXOpen,measureAngleBuilder1,nullNXOp
From: https://www.cnblogs.com/firetuo/p/17132288.html

相关文章