internal Dialog(bool allowMultiple, string cue, ObjectTypes.Type type, ObjectTypes.SubType subtype) : this(allowMultiple, cue) { this.Cue = cue; ObjectTypes.TypeCombo combo = new ObjectTypes.TypeCombo(type, subtype); NXOpen.Selection.MaskTriple[] tripleArray = new NXOpen.Selection.MaskTriple[] { Snap.UI.MaskTriple.BuildFromTypeCombo(combo) }; this.MaskTripleArray = tripleArray; }
//------------------------------------------------------------------------------ // Callback Name: constructor_cb // Following callback is associated with the "changeDialog" Styler item. // Input: eventObject - object of UIStyler.StylerEvent class //------------------------------------------------------------------------------ public NXOpen.UIStyler.DialogState constructor_cb(NXOpen.UIStyler.StylerEvent eventObject) { try { // Get the selection handle SelectionHandle selectH; selectH = changeDialog.GetSelectionHandle(); NXOpen.Selection.MaskTriple[] selectionMask_array = new NXOpen.Selection.MaskTriple[1]; NXOpen.Selection.MaskTriple selectionMask_arrayElem; selectionMask_arrayElem.Type = NXOpen.UF.UFConstants.UF_solid_type; selectionMask_arrayElem.Subtype = NXOpen.UF.UFConstants.UF_solid_edge_subtype; selectionMask_arrayElem.SolidBodySubtype = NXOpen.UF.UFConstants.UF_UI_SEL_FEATURE_ANY_EDGE; selectionMask_array[0] = selectionMask_arrayElem; //Following sets the Selection mask for Edge theUI.SelectionManager.SetSelectionMask(selectH, NXOpen.Selection.SelectionAction.ClearAndEnableSpecific, selectionMask_array); //Following sets the Selection and Filter callbacks which are invoked during selection theUI.SelectionManager.SetSelectionCallbacks(selectH, filter_cb, sel_cb); changeToggle6.ItemValue = true; changeStr0.ItemValue = "5.0"; changeLabel1.SetLabel("Select Edges (0)"); } catch (NXOpen.NXException ex) { // ---- Enter your exception handling code here ----- theUI.NXMessageBox.Show("UI Styler", NXMessageBox.DialogType.Error, ex.Message); } // Callback acknowledged, do not terminate dialog // A return value of NXOpen.UIStyler.DialogState.ExitDialog will not be accepted // for this callback type. You must continue dialog construction. return(NXOpen.UIStyler.DialogState.ContinueDialog); }
internal static NXOpen.Selection.MaskTriple BuildFromType(ObjectTypes.Type type) { NXOpen.Selection.MaskTriple triple = new NXOpen.Selection.MaskTriple(); if (type == ObjectTypes.Type.Body) { triple.Type = 70; triple.Subtype = 0; triple.SolidBodySubtype = 0; return(triple); } if (type == ObjectTypes.Type.Face) { triple.Type = 70; triple.Subtype = 2; triple.SolidBodySubtype = 20; return(triple); } if (type == ObjectTypes.Type.Edge) { triple.Type = 70; triple.Subtype = 3; triple.SolidBodySubtype = 1; return(triple); } triple.Type = (int)type; triple.Subtype = 0; triple.SolidBodySubtype = 0; return(triple); }
internal Dialog(string cue, bool allowMultiple, params ObjectTypes.Type[] types) : this(allowMultiple, cue) { this.Cue = cue; int length = types.Length; NXOpen.Selection.MaskTriple[] tripleArray = new NXOpen.Selection.MaskTriple[length]; tripleArray = Snap.UI.MaskTriple.BuildFromICurveTypes(types); this.MaskTripleArray = tripleArray; }
public void SetFilter(params ObjectTypes.Type[] types) { int length = types.Length; NXOpen.Selection.MaskTriple[] tripleArray = new NXOpen.Selection.MaskTriple[length]; for (int i = 0; i < length; i++) { tripleArray[i] = Snap.UI.MaskTriple.BuildFromType(types[i]); } this.MaskTriples = tripleArray; }
//------------------------------------------------------------------------------ // Callback Name: filter_cb // Following callback is associated with the "changeDialog" Styler item. // Input: eventObject - object of UIStyler.StylerEvent class //------------------------------------------------------------------------------ //Following is Filter Callback - This function gets invoked during selection. //Here, we can put a logic to accept or reject the selected entities. In this example "Edge * 6 *1" is rejected. public int filter_cb(NXObject selectedObject, NXOpen.Selection.MaskTriple selectionMask_array, SelectionHandle selectHandle) { if (String.Equals(selectedObject.JournalIdentifier, "EDGE * 6 * 1")) { return(NXOpen.UF.UFConstants.UF_UI_SEL_REJECT); } else { return(NXOpen.UF.UFConstants.UF_UI_SEL_ACCEPT); } }
internal static NXOpen.Selection.MaskTriple[] BuildFromTypeCombos(ObjectTypes.TypeCombo[] combos) { int length = combos.Length; NXOpen.Selection.MaskTriple[] tripleArray = new NXOpen.Selection.MaskTriple[length]; for (int i = 0; i < length; i++) { tripleArray[i] = BuildFromTypeCombo(combos[i]); } return(tripleArray); }
internal Dialog(bool allowMultiple, string cue, params ObjectTypes.Type[] types) : this(allowMultiple, cue) { this.Cue = cue; int length = types.Length; NXOpen.Selection.MaskTriple[] tripleArray = new NXOpen.Selection.MaskTriple[length]; for (int i = 0; i < length; i++) { tripleArray[i] = Snap.UI.MaskTriple.BuildFromType(types[i]); } this.MaskTripleArray = tripleArray; }
public static Dialog SelectFace(string cue) { Dialog dialog = new Dialog(false, cue) { Cue = cue, Title = "Select Face" }; NXOpen.Selection.MaskTriple[] tripleArray = new NXOpen.Selection.MaskTriple[] { Snap.UI.MaskTriple.BuildFromType(ObjectTypes.Type.Face) }; dialog.MaskTripleArray = tripleArray; return(dialog); }
internal static NXOpen.Selection.MaskTriple[] BuildFromICurveTypes(params ObjectTypes.Type[] curveTypes) { int length = curveTypes.Length; NXOpen.Selection.MaskTriple[] tripleArray = new NXOpen.Selection.MaskTriple[2]; NXOpen.Selection.MaskTriple[] tripleArray2 = new NXOpen.Selection.MaskTriple[2 * length]; for (int i = 0; i < length; i++) { tripleArray = BuildFromICurveType(curveTypes[i]); tripleArray2[2 * i] = tripleArray[0]; tripleArray2[(2 * i) + 1] = tripleArray[1]; } return(tripleArray2); }
internal static NXOpen.Selection.MaskTriple BuildFromTypeCombo(ObjectTypes.TypeCombo combo) { ObjectTypes.Type type = combo.Type; ObjectTypes.SubType subType = combo.SubType; NXOpen.Selection.MaskTriple triple = BuildFromType(type); if (type == ObjectTypes.Type.Body) { triple.Subtype = 0; triple.SolidBodySubtype = 0x24; switch (subType) { case ObjectTypes.SubType.BodySolid: triple.SolidBodySubtype = 0x24; break; case ObjectTypes.SubType.BodySheet: triple.SolidBodySubtype = 0x23; break; } return(triple); } if (type == ObjectTypes.Type.Face) { triple.Subtype = 2; triple.SolidBodySubtype = ((int)combo.SubType) % ((int)type); return(triple); } if (type == ObjectTypes.Type.Edge) { triple.Subtype = 3; triple.SolidBodySubtype = ((int)combo.SubType % (int)type); return(triple); } triple.Type = (int)type; triple.Subtype = (int)combo.SubType % (int)type; triple.SolidBodySubtype = 0; return(triple); }
public void SetFaceFilter() { NXOpen.Selection.MaskTriple[] tripleArray = new NXOpen.Selection.MaskTriple[] { Snap.UI.MaskTriple.BuildFromType(ObjectTypes.Type.Face) }; this.MaskTriples = tripleArray; }
public void SetFilter(ObjectTypes.Type type, ObjectTypes.SubType subtype) { ObjectTypes.TypeCombo combo = new ObjectTypes.TypeCombo(type, subtype); NXOpen.Selection.MaskTriple[] tripleArray = new NXOpen.Selection.MaskTriple[] { Snap.UI.MaskTriple.BuildFromTypeCombo(combo) }; this.MaskTriples = tripleArray; }
public Snap.UI.Selection.Result Show() { Snap.UI.Response response; TaggedObject[] objArray; NXOpen.Selection selectionManager = UI.GetUI().SelectionManager; Point3d cursor = new Point3d(); NXOpen.Selection.SelectionAction clearAndEnableSpecific = NXOpen.Selection.SelectionAction.ClearAndEnableSpecific; string cue = this.Cue; string title = this.Title; NXOpen.Selection.SelectionScope scope = (NXOpen.Selection.SelectionScope) this.Scope; bool includeFeatures = this.IncludeFeatures; bool keepHighlighted = this.KeepHighlighted; if (!this.AllowMultiple) { TaggedObject obj2; string str3; NXOpen.Selection.MaskTriple[] maskTripleArray = null; if (includeFeatures) { maskTripleArray = new NXOpen.Selection.MaskTriple[this.MaskTripleArray.Length + 1]; for (int j = 0; j < this.MaskTripleArray.Length; j++) { maskTripleArray[j] = this.MaskTripleArray[j]; } maskTripleArray[this.MaskTripleArray.Length].Type = 0xcd; maskTripleArray[this.MaskTripleArray.Length].Subtype = 0; maskTripleArray[this.MaskTripleArray.Length].SolidBodySubtype = 0; if (maskTripleArray == null) { response = (Snap.UI.Response)selectionManager.SelectTaggedObject(cue, title, scope, includeFeatures, keepHighlighted, out obj2, out cursor); } else { response = (Snap.UI.Response)selectionManager.SelectTaggedObject(cue, title, scope, clearAndEnableSpecific, includeFeatures, keepHighlighted, maskTripleArray, out obj2, out cursor); } } else { maskTripleArray = this.MaskTripleArray; if (maskTripleArray == null) { response = (Snap.UI.Response)selectionManager.SelectTaggedObject(cue, title, scope, includeFeatures, keepHighlighted, out obj2, out cursor); } else { response = (Snap.UI.Response)selectionManager.SelectTaggedObject(cue, title, scope, clearAndEnableSpecific, includeFeatures, keepHighlighted, maskTripleArray, out obj2, out cursor); } } if (obj2 == null) { return(new Snap.UI.Selection.Result(null, response, null)); } Snap.NX.NXObject obj3 = Snap.NX.NXObject.CreateNXObject(obj2); Snap.NX.NXObject[] objArray2 = new Snap.NX.NXObject[] { obj3 }; UFSession uFSession = Globals.UFSession; UI.GetUI(); uFSession.Ui.AskLastPickedView(out str3); return(new Snap.UI.Selection.Result(objArray2, response, GetCursorRay(str3, cursor))); } NXOpen.Selection.MaskTriple[] maskArray = null; if (includeFeatures) { maskArray = new NXOpen.Selection.MaskTriple[this.MaskTripleArray.Length + 1]; for (int k = 0; k < this.MaskTripleArray.Length; k++) { maskArray[k] = this.MaskTripleArray[k]; } maskArray[this.MaskTripleArray.Length].Type = 0xcd; maskArray[this.MaskTripleArray.Length].Subtype = 0; maskArray[this.MaskTripleArray.Length].SolidBodySubtype = 0; if (maskArray == null) { response = (Snap.UI.Response)selectionManager.SelectTaggedObjects(cue, title, scope, includeFeatures, keepHighlighted, out objArray); } else { response = (Snap.UI.Response)selectionManager.SelectTaggedObjects(cue, title, scope, clearAndEnableSpecific, includeFeatures, keepHighlighted, maskArray, out objArray); } } else { maskArray = this.MaskTripleArray; if (maskArray == null) { response = (Snap.UI.Response)selectionManager.SelectTaggedObjects(cue, title, scope, includeFeatures, keepHighlighted, out objArray); } else { response = (Snap.UI.Response)selectionManager.SelectTaggedObjects(cue, title, scope, clearAndEnableSpecific, includeFeatures, keepHighlighted, maskArray, out objArray); } } if (objArray == null) { return(new Snap.UI.Selection.Result(null, response, null)); } Snap.NX.NXObject[] objects = new Snap.NX.NXObject[objArray.Length]; for (int i = 0; i < objects.Length; i++) { objects[i] = Snap.NX.NXObject.CreateNXObject(objArray[i]); } return(new Snap.UI.Selection.Result(objects, response, null)); }