Ejemplo n.º 1
0
        public void CloseTestOutput()
        {
            int status = JAUTL_SESSION_close_test_output();

            if (status != 0)
            {
                throw NXException.Create(status);
            }
        }
Ejemplo n.º 2
0
        public void SetTestOutput(string outputFile, int version)
        {
            int status = JAUTL_SESSION_set_test_output(outputFile, version);

            if (status != 0)
            {
                throw NXException.Create(status);
            }
        }
Ejemplo n.º 3
0
        public void CompareTestOutput(string originalFile, string newFile)
        {
            int status = JAUTL_SESSION_compare_test_output(originalFile, newFile);

            if (status != 0)
            {
                throw NXException.Create(status);
            }
        }
Ejemplo n.º 4
0
        public void LoadFully()
        {
            PartLoadStatus status = this.NXOpenPart.LoadFully();

            if (status.NumberUnloadedParts != 0)
            {
                NXException.Create(status.GetStatus(0));
            }
        }
Ejemplo n.º 5
0
        public void SetSelectedObjects(TaggedObject[] objectVector)
        {
            JAM.StartCall();
            int status = JA_BLOCK_STYLER_SELECT_PART_FROM_LIST_set_selected_objects(JAM.Lookup(base.Tag), objectVector.Length, JAM.ToTagArray(objectVector));

            if (status != 0)
            {
                throw NXException.Create(status);
            }
        }
Ejemplo n.º 6
0
        protected override void FreeResource()
        {
            JAM.StartCall();
            int status = JA_BLOCK_STYLER_SNAP_DIALOG_dispose(base.Handle);

            if (status != 0)
            {
                throw NXException.Create(status);
            }
        }
Ejemplo n.º 7
0
        public static void StartCall(string license1, string license2)
        {
            int status = JAM_reserve_license_pair(license1, license2, GetLicenseContext());

            if (status != 0)
            {
                throw NXException.Create(status);
            }
            JAM_start_wrapped_call();
        }
Ejemplo n.º 8
0
        public PartSaveStatus Save()
        {
            PartSaveStatus status = this.NXOpenPart.Save(BasePart.SaveComponents.True, BasePart.CloseAfterSave.False);

            if (status.NumberUnsavedParts != 0)
            {
                NXException.Create(status.GetStatus(0));
            }
            status.Dispose();
            return(status);
        }
Ejemplo n.º 9
0
        public PartSaveStatus SaveAs(string pathName)
        {
            PartSaveStatus status = this.NXOpenPart.SaveAs(pathName);

            if (status.NumberUnsavedParts != 0)
            {
                NXException.Create(status.GetStatus(0));
            }
            status.Dispose();
            return(status);
        }
Ejemplo n.º 10
0
        public static void StartCall(string[] licenses)
        {
            IntPtr[] ptrArray = ToLocaleStringArray(licenses);
            int      status   = JAM_reserve_license_eitheror(licenses.Length, ptrArray, GetLicenseContext());

            FreeLocaleStringArray(ptrArray);
            if (status != 0)
            {
                throw NXException.Create(status);
            }
            JAM_start_wrapped_call();
        }
Ejemplo n.º 11
0
 private static double[] GetParameter(Compute.IntersectionResult[] result)
 {
     if (result == null)
     {
         throw NXException.Create(0xa396b);
     }
     double[] numArray = new double[result.Length];
     for (int i = 0; i < numArray.Length; i++)
     {
         numArray[i] = result[i].CurveParameter;
     }
     return(numArray);
 }
Ejemplo n.º 12
0
        public bool Validate()
        {
            bool flag;

            JAM.StartCall();
            int status = JA_ICOMPONENT_BUILDER_validate(base.Tag, out flag);

            if (status != 0)
            {
                throw NXException.Create(status);
            }
            return(flag);
        }
Ejemplo n.º 13
0
        public void AddItem(string itemType, string itemID)
        {
            JAM.StartCall();
            IntPtr ptr    = JAM.ToLocaleString(itemType);
            IntPtr ptr2   = JAM.ToLocaleString(itemID);
            int    status = JA_BLOCK_STYLER_SNAP_DIALOG_add_item(base.Handle, ptr, ptr2);

            JAM.FreeLocaleString(ptr);
            JAM.FreeLocaleString(ptr2);
            if (status != 0)
            {
                throw NXException.Create(status);
            }
        }
Ejemplo n.º 14
0
        public TaggedObject[] GetSelectedObjects()
        {
            int num;

            JAM.StartCall();
            IntPtr zero   = IntPtr.Zero;
            int    status = JA_BLOCK_STYLER_SELECT_PART_FROM_LIST_get_selected_objects(JAM.Lookup(base.Tag), out num, out zero);

            if (status != 0)
            {
                throw NXException.Create(status);
            }
            return((TaggedObject[])JAM.ToObjectArray(typeof(TaggedObject), num, zero));
        }
Ejemplo n.º 15
0
        protected static void StaticInitialize()
        {
            int status = JAM_SESSION_initialize();

            if (status != 0)
            {
                throw NXException.Create(status);
            }
            InitLicense();
            if (objectManager == null)
            {
                objectManager = new NXObjectManager();
            }
        }
Ejemplo n.º 16
0
        public string Add(string itemType, string itemTitle, string itemValue)
        {
            IntPtr ptr4;

            JAM.StartCall();
            IntPtr ptr    = JAM.ToLocaleString(itemType);
            IntPtr ptr2   = JAM.ToLocaleString(itemTitle);
            IntPtr ptr3   = JAM.ToLocaleString(itemValue);
            int    status = JA_BLOCK_STYLER_SNAP_DIALOG_add(base.Handle, ptr, ptr2, ptr3, out ptr4);

            JAM.FreeLocaleString(ptr);
            JAM.FreeLocaleString(ptr2);
            JAM.FreeLocaleString(ptr3);
            if (status != 0)
            {
                throw NXException.Create(status);
            }
            return(JAM.ToStringFromLocale(ptr4));
        }
Ejemplo n.º 17
0
        public static IntPtr ToLocaleString(string s)
        {
            if (s == null)
            {
                return(IntPtr.Zero);
            }
            Encoding localeEncoding = GetLocaleEncoding();

            byte[] bytes = localeEncoding.GetBytes(s);
            if ((localeEncoding != Encoding.UTF8) && !localeEncoding.GetString(bytes).Equals(s))
            {
                throw NXException.Create(0x170a7a);
            }
            IntPtr destination = SM_alloc(bytes.Length + 1);

            Marshal.Copy(bytes, 0, destination, bytes.Length);
            Marshal.WriteByte(destination, bytes.Length, 0);
            return(destination);
        }
Ejemplo n.º 18
0
        public static void InitLicense()
        {
            bool flag = false;

            try
            {
                flag = verifyAssemblyData(false);
            }
            catch (NeedSNAPAuthorLicenseException exception)
            {
                if (JAM_presence_check_snap_author_license() != 0)
                {
                    throw exception;
                }
                Trace.WriteLine(exception);
                Trace.WriteLine("Validation failed but author license exists - loading library");
                AddDLLAuthorization(JAM.ToStringFromLocale(JAM_get_filename(AppDomain.CurrentDomain.BaseDirectory, AppDomain.CurrentDomain.FriendlyName)), ResourceUtilities.SignatureType.SNAP_TYPE);
            }
            catch (NeedDOTNETAuthorLicenseException exception2)
            {
                if (JAM_presence_check_dotnet_author_license() != 0)
                {
                    throw exception2;
                }
                Trace.WriteLine(exception2);
                Trace.WriteLine("Validation failed but author license exists - loading library");
                AddDLLAuthorization(JAM.ToStringFromLocale(JAM_get_filename(AppDomain.CurrentDomain.BaseDirectory, AppDomain.CurrentDomain.FriendlyName)), ResourceUtilities.SignatureType.NORMAL_TYPE);
            }
            catch (Exception exception3)
            {
                throw exception3;
            }
            if (!flag)
            {
                int status = JAM_check_session_license(AppDomain.CurrentDomain.BaseDirectory + AppDomain.CurrentDomain.FriendlyName);
                if (status != 0)
                {
                    Trace.WriteLine("Could not obtain runtime license");
                    throw NXException.Create(status);
                }
            }
        }
Ejemplo n.º 19
0
        public virtual void Move(Transform xform)
        {
            UFSession uFSession = Globals.UFSession;
            int       num       = 1;

            Tag[] objects = new Tag[] { this.NXOpenTag };
            int   num2    = 1;
            int   num3    = 0;
            int   num4    = 2;

            Tag[] copies = null;
            int   status = 0;

            try
            {
                Tag tag;
                uFSession.Trns.TransformObjects(xform.Matrix, objects, ref num, ref num2, ref num3, ref num4, copies, out tag, out status);
                switch (status)
                {
                case 3:
                    throw NXException.Create(0xa4c2d);

                case 4:
                    if (this.ObjectType == ObjectTypes.Type.CoordinateSystem)
                    {
                        throw new ArgumentException("A transform that does not preserve angles cannot be applied to a coordinate system");
                    }
                    throw new ArgumentException("The matrix does not preserve angles");

                case 5:
                    throw NXException.Create(0xa3948);

                case 6:
                    throw NXException.Create(0xa3938);

                case 7:
                    throw NXException.Create(0xa3939);

                case 8:
                    throw NXException.Create(0x25);

                case 9:
                    throw NXException.Create(0xa3946);

                case 10:
                    throw NXException.Create(0xa3947);

                case 11:
                    throw NXException.Create(0xa1222);
                }
            }
            catch (NXException exception)
            {
                if (this.ObjectType == ObjectTypes.Type.Edge)
                {
                    throw new ArgumentException("The object is an edge. Edges cannot be moved.", exception);
                }
                if (this.ObjectType == ObjectTypes.Type.Face)
                {
                    throw new ArgumentException("The object is a face. Faces cannot be moved.", exception);
                }
                if (((this.ObjectType != ObjectTypes.Type.Feature) && (this.ObjectType != ObjectTypes.Type.DatumPlane)) && ((this.ObjectType != ObjectTypes.Type.DatumAxis) && (this.ObjectType != ObjectTypes.Type.CoordinateSystem)))
                {
                    throw exception;
                }
                throw new ArgumentException("A feature cannot be moved, because its position is controlled by its parents.", exception);
            }
        }
Ejemplo n.º 20
0
        public virtual Snap.NX.NXObject Copy(Transform xform)
        {
            Snap.NX.NXObject obj3;
            UFSession        uFSession = Globals.UFSession;
            int num = 1;

            Tag[] objects = new Tag[] { this.NXOpenTag };
            int   num2    = 2;
            int   num3    = 0;
            int   num4    = 2;

            Tag[] copies = new Tag[num];
            int   status = 0;

            try
            {
                Tag tag;
                uFSession.Trns.TransformObjects(xform.Matrix, objects, ref num, ref num2, ref num3, ref num4, copies, out tag, out status);
                switch (status)
                {
                case 3:
                    throw NXException.Create(0xa4c2d);

                case 4:
                    throw new ArgumentException("The matrix does not preserve angles");

                case 5:
                    throw NXException.Create(0xa3948);

                case 6:
                    throw NXException.Create(0xa3938);

                case 7:
                    throw NXException.Create(0xa3939);

                case 8:
                    throw NXException.Create(0x25);

                case 9:
                    throw NXException.Create(0xa3946);

                case 10:
                    throw NXException.Create(0xa3947);

                case 11:
                    throw NXException.Create(0xa1222);
                }
                if ((status == 0) && (copies[0] == Tag.Null))
                {
                    throw NXException.Create(0xa4c2d);
                }
                Snap.NX.NXObject[] objArray = new Snap.NX.NXObject[num];
                for (int i = 0; i < num; i++)
                {
                    NXOpen.NXObject objectFromTag = GetObjectFromTag(copies[i]);
                    objArray[i] = CreateNXObject(objectFromTag);
                }
                obj3 = objArray[0];
            }
            catch (NXException exception)
            {
                if (this.ObjectType == ObjectTypes.Type.Edge)
                {
                    throw new ArgumentException("The object is an edge. Edges cannot be copied", exception);
                }
                if (this.ObjectType == ObjectTypes.Type.Face)
                {
                    throw new ArgumentException("The object is a face. Faces cannot be copied", exception);
                }
                if (((this.ObjectType == ObjectTypes.Type.Feature) || (this.ObjectType == ObjectTypes.Type.DatumPlane)) || (this.ObjectType == ObjectTypes.Type.DatumAxis))
                {
                    throw new ArgumentException("A feature cannot be copied unless all of its ancestors are copied too", exception);
                }
                if (this.ObjectType == ObjectTypes.Type.CoordinateSystem)
                {
                    throw new ArgumentException("A transform that does not preserve angles cannot be applied to a coordinate system");
                }
                throw exception;
            }
            return(obj3);
        }