//------------------------------------------------------------------------------ //Callback Name: ApplyCB //------------------------------------------------------------------------------ public int ApplyCB() { int errorCode = 0; try { // Session.UndoMarkId markid = tSetUndoMark(Session.MarkVisibility.Visible, "Test"); // theSession.UndoToMark(markid, "Test"); // theSession.DeleteUndoMark(markids[index++], ""); // markids[index] = theSession.SetUndoMark(Session.MarkVisibility.Visible, "a"); //回转母线 TaggedObject[] obs1 = super_section0.GetProperties().GetTaggedObjectVector("SelectedObjects"); if (obs1.GetLength(0) == 0) { // theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Warning, "请选择回转母线!"); return(1); } //回转轴 TaggedObject[] obs2 = axis0.GetProperties().GetTaggedObjectVector("SelectedObjects"); if (obs2.GetLength(0) == 0) { // theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Warning, "请选择回转轴!"); return(1); } //要修剪的体 TaggedObject[] obs3 = bodySelect0.GetProperties().GetTaggedObjectVector("SelectedObjects"); if (obs3.GetLength(0) == 0) { // theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Warning, "请选择目标体!"); return(1); } //是否反向 bool reverse = toggle0.GetProperties().GetLogical("Value"); Section section = (Section)obs1[0]; Axis axis = (Axis)obs2[0]; Body body = (Body)obs3[0]; NXOpen.Features.Revolve revolve = NXFun.Revolve(section, axis); Body[] bodys = revolve.GetBodies(); //修剪体 NXFun.TrimBody(body, bodys[0], reverse); //隐藏面 Body[] bs = revolve.GetBodies(); NXFun.BlankObject(bs[0]); } catch (Exception ex) { errorCode = 1; theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString()); } return(errorCode); }