Example #1
0
        public void BadInput_Empty()
        {
            Inventor.Application app = ApplicationShim.Instance();
            var test = string.Empty;

            Assert.IsFalse(PathShim.IsContentCenterPath(test, ref app));
        }
        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;
            }
        }
Example #3
0
        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));
        }
Example #4
0
        public void CreateSetThatDoesntExist()
        {
            Inventor.Application app = ApplicationShim.Instance();
            var      path            = app.DesignProjectManager.ActiveDesignProject.TemplatesPath;
            Document doc             = app.Documents.Add(DocumentTypeEnum.kPartDocumentObject, path + "Standard.ipt", true);

            //try to remove an attributeSet that does not exist.  Will this crash?
            AttributeShim.CreateAttributeSet(doc, "testSet");


            bool result = false;

            foreach (AttributeSet i in doc.AttributeSets)
            {
                if (i.Name.Equals("testSet"))
                {
                    result = true;
                }
            }
            try
            {
                Assert.IsTrue(result);
            }
            finally { doc.Close(true); }
        }
Example #5
0
        public void RemovesNonExisting_noCrash()
        {
            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");

//            Inventor.Attribute attribute = attributeSet.Add("testAttribute", ValueTypeEnum.kStringType, "test string");

            AttributeShim.RemoveAttribute(doc, "testSet", "testAttribute");

            bool result = false;

            foreach (Inventor.Attribute i in doc.AttributeSets["testSet"])
            {
                if (i.Name.Equals("testAttribute"))
                {
                    result = true;
                }
            }

            try
            {
                Assert.IsFalse(result);
            }
            finally { doc.Close(true); }
        }
        public static string WorkspacePath()
        {
            Inventor.Application app = ApplicationShim.Instance();
            var path = app.DesignProjectManager.ActiveDesignProject.WorkspacePath;

            return(path);
        }
Example #7
0
        public void BadInput_Wrong()
        {
            Inventor.Application app = ApplicationShim.Instance();
            string test = @"C:\Windows\";

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

            var doc2 = doc.ReturnSpecificDocumentObject();

            //var tt = doc2.GetPropertyValue("Author");
            var tt = PropertyShim.GetPropertyValue(doc2, "Author");
            //only exists in ParDocuments
            PartComponentDefinition test = null;

            try
            {
                test = doc2.ComponentDefinition;
            }
            catch { }

            try
            {
                Assert.IsNotNull(test);
            }
            finally { doc.Close(true); }
        }
Example #9
0
        public void GoodInput()
        {
            Inventor.Application app = ApplicationShim.Instance();

            string test = app.DesignProjectManager.ActiveDesignProject.ContentCenterPath;

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

            string test = null;

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

            var test = "";

            Assert.IsFalse(PathShim.IsLibraryPath(test, ref app));
        }
Example #12
0
        public void BadInput_WrongPath()
        {
            Inventor.Application app = ApplicationShim.Instance();

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

            Assert.IsFalse(PathShim.IsLibraryPath(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);
        }
Example #14
0
        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);
        }
Example #15
0
        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);
        }
Example #16
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;
        }
Example #18
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));
        }
Example #19
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); }
        }
Example #20
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 {  }
        }
Example #21
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); }
        }
Example #22
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 BadInput_WrongPath(string testString)
        {
            Inventor.Application app = ApplicationShim.Instance();

            try
            {
                Assert.IsFalse(testString.IsLibraryPath(app));
            }
            finally
            {
                Marshal.ReleaseComObject(app);
                app = null;
            }
        }
Example #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); }
        }
Example #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); }
        }
        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); }
        }
Example #27
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); }
        }
        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;
            }
        }
Example #29
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); }
        }
Example #30
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); }
        }