コード例 #1
0
ファイル: EX.cs プロジェクト: suifengsigan/TEST_1
 public static NXOpen.Selection.Response SelectTaggedObjects(this NXOpen.Selection obj, string message, string title, NXOpen.Selection.SelectionScope scope, NXOpen.Selection.SelectionAction action, bool includeFeatures, bool keepHighlighted, NXOpen.Selection.MaskTriple[] maskArray, out TaggedObject[] objectArray)
 {
     //Response response;
     //int num;
     //JAM.StartCall();
     //IntPtr ptr = JAM.ToLocaleString(message);
     //IntPtr ptr2 = JAM.ToLocaleString(title);
     //IntPtr zero = IntPtr.Zero;
     //int status = JA_UI_SELECT_select_tagged_objects(ptr, ptr2, scope, action, includeFeatures, keepHighlighted, maskArray.Length, maskArray, out response, out num, out zero);
     //JAM.FreeLocaleString(ptr);
     //JAM.FreeLocaleString(ptr2);
     //if (status != 0)
     //{
     //    throw NXException.Create(status);
     //}
     //objectArray = (TaggedObject[])JAM.ToObjectArray(typeof(TaggedObject), num, zero);
     //return response;
     objectArray = new NXOpen.TaggedObject[] { };
     return(new Selection.Response());
 }
コード例 #2
0
ファイル: EX.cs プロジェクト: suifengsigan/TEST_1
        public static NXOpen.Selection.Response SelectTaggedObject(this NXOpen.Selection obj, string message, string title, NXOpen.Selection.SelectionScope scope, NXOpen.Selection.SelectionAction action, bool includeFeatures, bool keepHighlighted, NXOpen.Selection.MaskTriple[] maskArray, out TaggedObject @object, out Point3d cursor)
        {
            //Response response;
            //NXOpen.Tag tag;
            //JAM.StartCall();
            //IntPtr ptr = JAM.ToLocaleString(message);
            //IntPtr ptr2 = JAM.ToLocaleString(title);
            //int status = JA_UI_SELECT_select_tagged_object(ptr, ptr2, scope, action, includeFeatures, keepHighlighted, maskArray.Length, maskArray, out response, out tag, out cursor);
            //JAM.FreeLocaleString(ptr);
            //JAM.FreeLocaleString(ptr2);
            //if (status != 0)
            //{
            //    throw NXException.Create(status);
            //}
            //@object = NXObjectManager.Get(tag);
            //return response;

            @object = NXObjectManager.Get(Tag.Null);
            cursor  = new Point3d();
            return(new Selection.Response());
        }
コード例 #3
0
            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));
            }