NXOpen检查异常,并且还原到之前状态
//NXOpen检查异常,并且还原到之前状态
Session *theSession = Session::GetSession();
Part *workPart(theSession->Parts()->Work());
Session::UndoMarkId markId1;
markId1 = theSession->SetUndoMark(Session::MarkVisibilityVisible, "displayModification");
try
{
//其他代码
theSession->DeleteUndoMark(markId1, NULL);
}
catch (exception ex)
{
theSession->UndoToMark(markId1, NULL);
theSession->DeleteUndoMark(markId1, NULL);
return false;
}
return true;