public int apply_cb()
{
int errorCode = 0;
try
{
//---- Enter your callback code here -----
Session theSession = Session.GetSession();
Part workPart = theSession.Parts.Work;
Part displyPart = theSession.Parts.Display;
NXOpen.UF.UFSession theUfSession = NXOpen.UF.UFSession.GetUFSession();
TaggedObject[] objects = bodySelect0.GetSelectedObjects();
NXOpen.Tag objectTag = objects[0].Tag;
NXOpen.Tag csysTag = NXOpen.Tag.Null;
bool expand = false;
double[] minCorner = new double[3];
double[,] directions = new double[3,3];
double[] distances = new double[3];
theUfSession.Modl.AskBoundingBoxAligned(objectTag,csysTag,expand,minCorner,directions,distances);
//UF方法创建
//NXOpen.UF.FeatureSigns featureSigns = NXOpen.UF.FeatureSigns.Nullsign;
//string[] edgeLen = new string[3] { "Len = " + distances[0].ToString(), distances[1].ToString(), distances[2].ToString() };
//NXOpen.Tag blockTag;
//theUfSession.Modl.CreateBlock1(featureSigns,minCorner,edgeLen,out blockTag);
//NXOpen.Tag bodyTag;
//theUfSession.Modl.AskFeatBody(blockTag,out bodyTag);
//theUfSession.Obj.SetTranslucency(bodyTag,95);
//theUfSession.Obj.SetColor(bodyTag,186);
//NXopen创建
NXOpen.Features.BlockFeatureBuilder blockFeatureBuilder = workPart.Features.CreateBlockFeatureBuilder(null);
Point3d orgin = new Point3d(minCorner[0], minCorner[1], minCorner[2]);
blockFeatureBuilder.SetOriginAndLengths(orgin, distances[0].ToString(), distances[1].ToString(), distances[2].ToString());
blockFeatureBuilder.Commit();
blockFeatureBuilder.Destroy();
}