Beispiel #1
0
        public void Works_isInvisible()
        {
            Inventor.Application app = null;
            app = ApplicationShim.NewInstance(false);

            try
            {
                Assert.IsNotNull(app);
            }
            finally
            {
                if (app != null)
                {
                    Process[] procs = Process.GetProcessesByName("Inventor");
                    app.Quit();
                    if (procs.Length == 1)
                    {
                        procs[0].WaitForExit();
                    }

                    Marshal.ReleaseComObject(app);
                    app = null;
                    //GC.Collect();
                    //GC.WaitForPendingFinalizers();
                }
            }
        }
        internal static Inventor.Document CreatePartDocument()
        {
            Inventor.Application app = ApplicationShim.Instance();
            var path = app.DesignProjectManager.ActiveDesignProject.TemplatesPath;

            return(app.Documents.Add(DocumentTypeEnum.kPartDocumentObject, path + "Standard.ipt", true));
        }
        public void GoodInput()
        {
            Inventor.Application app = ApplicationShim.Instance();

            var designProject = app.DesignProjectManager.ActiveDesignProject;
            var libraryPaths  = designProject.LibraryPaths;

            var i = libraryPaths.Count + 1;

            libraryPaths.Add("temporary path", @"C:\");

            string test = libraryPaths[1].Path;

            test = PathShim.TrimEndingDirectorySeparator(test);

            try
            {
                Assert.IsTrue(test.IsLibraryPath(app));
            }
            finally
            {
                libraryPaths[i].Delete();
                Marshal.ReleaseComObject(app);
                app = null;
            }
        }
Beispiel #4
0
        private static void test_GetDocumentsFromSelectSet()
        {
            Inventor.Application oApp  = ApplicationShim.CurrentInstance();
            SelectSet            oSSet = oApp.ActiveDocument.SelectSet;

            if (oSSet.Count == 0)
            {
                oSSet.Select(oApp.CommandManager.Pick(SelectionFilterEnum.kAllEntitiesFilter, "Select thing(s)..."));
            }


            if (oSSet.Count == 0)
            {
                return;
            }

            List <Document> documentList = new List <Document>();

            documentList = DocumentShim.GetDocumentsFromSelectSet(oSSet);

            Console.WriteLine("Number of documents in List: " + documentList.Count().ToString());
            foreach (Document i in documentList)
            {
                //    Console.WriteLine(i.FullFileName);
            }

            Console.WriteLine("Press Enter to Exit!");
            Console.ReadLine();
        }
Beispiel #5
0
        public void RemovesSetThatExists()
        {
            Inventor.Application app = ApplicationShim.Instance();
            var      path            = app.DesignProjectManager.ActiveDesignProject.TemplatesPath;
            Document doc             = app.Documents.Add(DocumentTypeEnum.kPartDocumentObject, path + "Standard.ipt", true);

            //create the test AttributeSet
            AttributeSet attributeSet = doc.AttributeSets.Add("testSet");

            AttributeShim.RemoveAttributeSet(doc, "testSet");

            bool result = false;

            foreach (AttributeSet i in doc.AttributeSets)
            {
                if (i.Name.Equals("testSet"))
                {
                    result = true;
                }
            }

            try
            {
                Assert.IsFalse(result);
            }
            finally { doc.Close(true); }
        }
        public void BadInput_Wrong()
        {
            Inventor.Application app = ApplicationShim.Instance();
            string test = @"C:\Windows\";

            Assert.IsFalse(PathShim.IsContentCenterPath(test, ref app));
        }
        public void BadInput_Empty()
        {
            Inventor.Application app = ApplicationShim.Instance();
            var test = string.Empty;

            Assert.IsFalse(PathShim.IsContentCenterPath(test, ref app));
        }
        public static string InventorShimsPath()
        {
            Inventor.Application app = ApplicationShim.Instance();
            var path = app.DesignProjectManager.ActiveDesignProject.FullFileName;
            var test = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(path), "InventorShims");

            return(test);
        }
        public void BadInput_WrongPath()
        {
            Inventor.Application app = ApplicationShim.Instance();

            var test = @"C:\Zarthastoriatarigula\the\fiverth";

            Assert.IsFalse(PathShim.IsLibraryPath(test, ref app));
        }
        public static Document CreateAssemblyDocument()
        {
            Inventor.Application app = ApplicationShim.Instance();
            var      path            = app.DesignProjectManager.ActiveDesignProject.TemplatesPath;
            Document doc             = app.Documents.Add(DocumentTypeEnum.kAssemblyDocumentObject, path + "Standard.iam", true);

            return(doc);
        }
Beispiel #11
0
        public void GoodInput()
        {
            Inventor.Application app = ApplicationShim.Instance();

            string test = app.DesignProjectManager.ActiveDesignProject.ContentCenterPath;

            Assert.IsTrue(PathShim.IsContentCenterPath(test, ref app));
        }
Beispiel #12
0
        public void BadInput_Null()
        {
            Inventor.Application app = ApplicationShim.Instance();

            string test = null;

            Assert.IsFalse(PathShim.IsLibraryPath(test, ref app));
        }
Beispiel #13
0
        public void BadInput_Empty()
        {
            Inventor.Application app = ApplicationShim.Instance();

            var test = "";

            Assert.IsFalse(PathShim.IsLibraryPath(test, ref app));
        }
        internal static Document CreatePresentationDocument()
        {
            Inventor.Application app = ApplicationShim.Instance();
            var      path            = app.DesignProjectManager.ActiveDesignProject.TemplatesPath;
            Document doc             = app.Documents.Add(DocumentTypeEnum.kPresentationDocumentObject, path + "Standard.ipn", true);

            return(doc);
        }
Beispiel #15
0
        public void GoodInput_NoTrailingSlash()
        {
            Inventor.Application app = ApplicationShim.Instance();

            string test = app.DesignProjectManager.ActiveDesignProject.ContentCenterPath;

            test = PathShim.TrimEndingDirectorySeparator(test);

            Assert.IsTrue(PathShim.IsContentCenterPath(test, ref app));
        }
        public void GetsOrStartsInstance()
        {
            Inventor.Application app = ApplicationShim.Instance();
            app.Visible = true;

            var testVariable = app.AssemblyOptions.DeferUpdate;

            Assert.IsNotNull(testVariable);

            app.Quit();
            app = null;
        }
Beispiel #17
0
        public void BadInput_Null()
        {
            Inventor.Application app = ApplicationShim.Instance();
            app.Documents.CloseAll();
            DesignProject dp = app.DesignProjectManager.ActiveDesignProject;

            dp.Activate();

            string test = null;

            Assert.IsFalse(PathShim.IsContentCenterPath(test, ref app));
        }
Beispiel #18
0
        public void long_doesNotExist()
        {
            Inventor.Application app = ApplicationShim.Instance();
            var path = app.DesignProjectManager.ActiveDesignProject.TemplatesPath;
            var doc  = app.Documents.Add(DocumentTypeEnum.kPartDocumentObject, path + "Standard.ipt", true);

            string test = "";

            try {
                Assert.AreEqual(doc.GetPropertyValue("Inventor User Defined Properties", "Bob"), test);
            }
            finally{ doc.Close(true); }
        }
Beispiel #19
0
        public void returnsFalse()
        {
            Inventor.Application app = ApplicationShim.Instance();

            //Application object is not attribute capable.
            var result = AttributeShim.ObjectIsAttributeCapable(app);

            try
            {
                Assert.IsFalse(result);
            }
            finally {  }
        }
Beispiel #20
0
        public void long_doesNotExist()
        {
            Inventor.Application app = ApplicationShim.Instance();
            var path = app.DesignProjectManager.ActiveDesignProject.TemplatesPath;
            var doc  = app.Documents.Add(DocumentTypeEnum.kPartDocumentObject, path + "Standard.ipt", true);

            Property test = doc.GetProperty("Inventor Summary Information", "Bob");

            try {
                Assert.IsNull(test);
            }
            finally { doc.Close(true); }
        }
Beispiel #21
0
        public void long_native()
        {
            Inventor.Application app = ApplicationShim.Instance();
            var path = app.DesignProjectManager.ActiveDesignProject.TemplatesPath;
            var doc  = app.Documents.Add(DocumentTypeEnum.kPartDocumentObject, path + "Standard.ipt", true);

            Property test   = doc.PropertySets["Inventor Summary Information"]["Title"];
            Property result = doc.GetProperty("Inventor Summary Information", "Title");

            try {
                Assert.AreEqual(test, result);
            }
            finally { doc.Close(true); }
        }
        public void ParameterDoesNotExist_returnsNull()
        {
            Inventor.Application app = ApplicationShim.Instance();
            var      path            = app.DesignProjectManager.ActiveDesignProject.TemplatesPath;
            Document doc             = app.Documents.Add(DocumentTypeEnum.kPartDocumentObject, path + "Standard.ipt", true);

            Parameter test = doc.GetParameter("testing");

            try
            {
                Assert.IsNull(test);
            }
            finally { doc.Close(true); }
        }
        public void BadInput_WrongPath(string testString)
        {
            Inventor.Application app = ApplicationShim.Instance();

            try
            {
                Assert.IsFalse(testString.IsLibraryPath(app));
            }
            finally
            {
                Marshal.ReleaseComObject(app);
                app = null;
            }
        }
Beispiel #24
0
        public void long_custom()
        {
            Inventor.Application app = ApplicationShim.Instance();
            var path = app.DesignProjectManager.ActiveDesignProject.TemplatesPath;
            var doc  = app.Documents.Add(DocumentTypeEnum.kPartDocumentObject, path + "Standard.ipt", true);

            doc.PropertySets["Inventor User Defined Properties"].Add("Bob", "Stuff");
            Property test = doc.PropertySets["Inventor User Defined Properties"]["Stuff"];

            try {
                Assert.AreEqual(doc.GetProperty("Inventor User Defined Properties", "Stuff"), test);
            }
            finally { doc.Close(true); }
        }
Beispiel #25
0
        public void DoesNotExist_returnsFalse()
        {
            Inventor.Application app = ApplicationShim.Instance();
            var      path            = app.DesignProjectManager.ActiveDesignProject.TemplatesPath;
            Document doc             = app.Documents.Add(DocumentTypeEnum.kPartDocumentObject, path + "Standard.ipt", true);

            var result = AttributeShim.AttributeSetExists(doc, "testSet");

            try
            {
                Assert.IsFalse(result);
            }
            finally { doc.Close(true); }
        }
Beispiel #26
0
        public void short_native()
        {
            Inventor.Application app = ApplicationShim.Instance();
            var path = app.DesignProjectManager.ActiveDesignProject.TemplatesPath;
            var doc  = app.Documents.Add(DocumentTypeEnum.kPartDocumentObject, path + "Standard.ipt", true);

            string test = "Bob";

            doc.PropertySets["Inventor Summary Information"]["Title"].Value = test;

            try {
                Assert.AreEqual(doc.GetPropertyValue("Title"), test);
            }
            finally { doc.Close(true); }
        }
Beispiel #27
0
        public void long_custom()
        {
            Inventor.Application app = ApplicationShim.Instance();
            var path = app.DesignProjectManager.ActiveDesignProject.TemplatesPath;
            var doc  = app.Documents.Add(DocumentTypeEnum.kPartDocumentObject, path + "Standard.ipt", true);

            string test = "Bob";

            doc.SetPropertyValue("Inventor User Defined Properties", "Stuff", test);
            string result = (string)doc.PropertySets["Inventor User Defined Properties"]["Stuff"].Value;

            try {
                Assert.AreEqual(test, result);
            }
            finally { doc.Close(true); }
        }
Beispiel #28
0
        public void returnsTrue()
        {
            Inventor.Application app = ApplicationShim.Instance();
            var path = app.DesignProjectManager.ActiveDesignProject.TemplatesPath;

            //Document object is attribute capable.
            Document doc = app.Documents.Add(DocumentTypeEnum.kPartDocumentObject, path + "Standard.ipt", true);

            var result = AttributeShim.ObjectIsAttributeCapable(doc);

            try
            {
                Assert.IsTrue(result);
            }
            finally { doc.Close(true); }
        }
        public void GoodInput()
        {
            Inventor.Application app = ApplicationShim.Instance();

            string test = app.DesignProjectManager.ActiveDesignProject.ContentCenterPath;

            try
            {
                Assert.IsTrue(test.IsContentCenterPath(app));
            }
            finally
            {
                Marshal.ReleaseComObject(app);
                app = null;
            }
        }
        public void NoParameter_ReturnsEmpty()
        {
            Inventor.Application app = ApplicationShim.Instance();
            var      path            = app.DesignProjectManager.ActiveDesignProject.TemplatesPath;
            Document doc             = app.Documents.Add(DocumentTypeEnum.kPartDocumentObject, path + "Standard.ipt", true);

            var testing = doc.GetParameterValue("testing");

            try
            {
                Assert.AreEqual("", testing);
            }
            finally
            {
                doc.Close(true);
            }
        }