CAM获取操作(程序组)的加工时间
这里进行封装,说明一下该函数,这里通过GetToolpathCuttingTime ()函数计算的时间时切削时间,不包括,换刀等时间。若是想要计算总时间请使用GetToolpathTime()。
#include <NXOpen/CAM_NCGroup.hxx>
#include <NXOpen/CAM_NCGroupBuilder.hxx>
#include <NXOpen/CAM_NCGroupCollection.hxx>
//获取操作的加工时间
static double GetOperTime(tag_t groupTag);
//获取操作的加工时间
double LiangFuns::UserUFBaseFun::GetOperTime(tag_t groupTag)
{
//NXObjectManager::Get(groupTag)将TAG转化为NXObject
CAM::NCGroup * nCGroup = dynamic_cast<CAM::NCGroup *>(NXObjectManager::Get(groupTag));
double aLLTimes = 0.0;
//加工对象包括方法和程序组
vector<NXOpen::CAM::CAMObject *> vCAMObjects = nCGroup->GetMembers();
for (int i = 0; i<vCAMObjects.size(); i++)
{
CAM::Operation * operation = dynamic_cast<CAM::Operation *>(vCAMObjects[i]);
double times = operation->GetToolpathTime();
aLLTimes = aLLTimes + times;
}
return aLLTimes;
}