//#if CALLBACK //------------------------------------------------------------------------------ //Method name: Show_addnew //------------------------------------------------------------------------------ public static void Show_addnew() { try { theaddnew = new addnew(); // The following method shows the dialog immediately theaddnew.Show(); } catch (Exception ex) { //---- Enter your exception handling code here ----- theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString()); } finally { theaddnew.Dispose(); } }
//------------------------------------------------------------------------------ //Callback Name: update_cb //------------------------------------------------------------------------------ public int update_cb(NXOpen.BlockStyler.UIBlock block) { try { if (block == enum0) { Part workPart = theSession.Parts.Work; Layout layout1 = (Layout)workPart.Layouts.FindObject("L1");//此处写死了。。。。。TAG ERROR int sel = enum0.GetProperties().GetEnum("Value"); string addnewstr = enum0.GetProperties().GetEnumAsString("Value"); if (addnewstr != "添加新视图") { layout1.ReplaceView(workPart.ModelingViews.WorkView, aaa[sel], true); } else { string newviewname = null; addnew.Show_addnew(); addnew theaddnew = new addnew(); //newviewname = theaddnew.string0.GetProperties().GetString("Value"); //switch (theUI.NXMessageBox.Show("添加新视图", NXMessageBox.DialogType.Question, "是否添加新视图")) //{ // case 0: // break; // case 1: // break; //} } //---------Enter your code here----------- } else if (block == ifcro) { if (ifcro.GetProperties().GetLogical("Value")) { cro.GetProperties().SetLogical("Enable", true); } else if (!ifcro.GetProperties().GetLogical("Value")) { cro.GetProperties().SetLogical("Enable", false); } //---------Enter your code here----------- } else if (block == cro) { //---------Enter your code here----------- } else if (block == realanno) { //---------Enter your code here----------- } else if (block == iflabel) { //---------Enter your code here----------- } else if (block == selection01) { if (iflabel.GetProperties().GetLogical("Value")) { selection01.GetProperties().SetLogical("Enable", true); } else if (!iflabel.GetProperties().GetLogical("Value")) { selection01.GetProperties().SetLogical("Enable", false); } //---------Enter your code here----------- } else if (block == point0) { NXOpen.TaggedObject[] guanlian = null; NXOpen.DisplayableObject guanlianobj = null; if (ifcro.GetProperties().GetLogical("Value") == true) { guanlian = cro.GetProperties().GetTaggedObjectVector("SelectedObjects"); guanlianobj = Tag2NXObject <DisplayableObject>(guanlian[0].Tag);//这个是关联对象 } string[] zhushiwenzi = realanno.GetProperties().GetStrings("Value");//这个是注释文字 NXOpen.TaggedObject[] zhiyin = null; NXOpen.NXObject zhiyinobj = null; if (iflabel.GetProperties().GetLogical("Value") == true) { zhiyin = selection01.GetProperties().GetTaggedObjectVector("SelectedObjects"); zhiyinobj = Tag2NXObject <NXObject>(zhiyin[0].Tag);//指引线 } NXOpen.TaggedObject[] placept = null; placept = point0.GetProperties().GetTaggedObjectVector("SelectedObjects"); Point placeptobj = Tag2NXObject <Point>(placept[0].Tag);//注释最后的放置点 Point3d placeptobj3d = placeptobj.Coordinates; //---------Enter our code here----------- thenotefun.function_note(zhushiwenzi, guanlianobj, zhiyinobj, placeptobj3d); } else if (block == dic) { //---------Enter your code here----------- } else if (block == str) { //---------Enter your code here----------- } else if (block == button0) //这个就是添加按钮,在这里调用 { string diction = null; //这个有”添加至CAPP助手“中得到的字符串 diction = dic.GetProperties().GetString("Value"); string strvalue = str.GetProperties().GetEnumAsString("Value"); switch (strvalue) { case "加工前准备": break; case "工作内容": break; case "技术条件": break; case "附注": break; case "特种工艺术语": break; case "检验工序": break; case "常用符号": break; } //---------Enter your code here----------- } } catch (Exception ex) { //---- Enter your exception handling code here ----- theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString()); } return(0); }