怡宁塑胶模具设计

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

头文件

 

#include <algorithm>//比大小的头文件

 

double distance;
std::vector<double> measureValue;//测量的值(double型)

for ( int i = 0 ; i < edges.size(); i ++ )
{
Edge *edge1 = edges[i];
NXObject *nullNXObject(NULL);
MeasureDistanceBuilder *measureDistanceBuilder1;
measureDistanceBuilder1 = workPart->MeasureManager()->CreateMeasureDistanceBuilder(nullNXObject);

measureDistanceBuilder1->SetMtype(MeasureDistanceBuilder::MeasureTypeMinimum);
measureDistanceBuilder1->Object1()->SetValue(edge1);

DatumPlane *datumPlane1(dynamic_cast<DatumPlane *>(workPart->Datums()->FindObject(datumPlanefeature1->JournalIdentifier())));
measureDistanceBuilder1->Object2()->SetValue(datumPlane1);

Unit *unit1(dynamic_cast<Unit *>(workPart->UnitCollection()->FindObject("MilliMeter")));
MeasureDistance *measureDistance1;
measureDistance1 = workPart->MeasureManager()->NewDistance(unit1, MeasureManager::MeasureTypeMinimum, edge1, datumPlane1);

Measure *measure1;
measure1 = measureDistance1->CreateFeature();

distance = measureDistance1->Value();//获取测量的值
if ( distance > 0 )
{
measureValue.push_back(distance);//获取的值塞到容器
}
measureDistanceBuilder1->Destroy();

}

sort(measureValue.begin(),measureValue.end());//排序,从小到大排

reverse(measureValue.begin(),measureValue.end());//reverse函数功能是逆序(或反转)

 

char msgmeasureValue[256];
for ( int i = 0 ; i < measureValue.size(); i ++ )
{
sprintf(msgmeasureValue, "边的距离:%.2f",measureValue[i]);
theSession->ListingWindow()->WriteLine( msgmeasureValue);
}

 

 

 

posted on 2021-03-13 17:31  怡宁塑胶模具设计  阅读(372)  评论(0编辑  收藏  举报