二次开发源码分享: 镜像体
二次开发源码分享: 镜像体
int IR9027488::apply_cb()
{
int errorCode = 0;
try
{
// AIW - Begin
tag_t body = selection0->GetSelectedObjects()->Tag();
Plane *thePlane = dynamic_cast<Plane*>(plane0->GetSelectedObjects());
NXOpen::Features::Feature *nullNXOpen_Features_Feature(NULL);
NXOpen::Features::DatumPlaneBuilder *datumPlaneBuilder1;
datumPlaneBuilder1 = theSession->Parts()->Work()->Features()->CreateDatumPlaneBuilder(nullNXOpen_Features_Feature);
NXOpen::Plane *plane1;
plane1 = datumPlaneBuilder1->GetPlane();
plane1->SynchronizeToPlane(thePlane);// this is new in NX11.0.1
plane1->Evaluate();
NXOpen::Features::Feature *feature1;
feature1 = datumPlaneBuilder1->CommitFeature();
NXOpen::Features::DatumPlaneFeature *datumPlaneFeature1(dynamic_cast<NXOpen::Features::DatumPlaneFeature *>(feature1));
NXOpen::DatumPlane *datumPlane1;
datumPlane1 = datumPlaneFeature1->DatumPlane();
tag_t mirror_feat;
errorCode = UF_initialize();
if (errorCode != 0) throw NXOpen::NXException::Create(errorCode);
errorCode = UF_MODL_create_mirror_body(body, datumPlane1->Tag(), &mirror_feat);
if (errorCode != 0) throw NXOpen::NXException::Create(errorCode);
// AIW - End
}
catch(exception& ex)
{
//---- Enter your exception handling code here -----
errorCode = 1;
IR9027488::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
}
return errorCode;
}
页:
[1]