示例#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;
            }
        }
示例#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));
        }
示例#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); }
        }
示例#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);
        }
示例#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); }
        }
示例#9
0
        public void GoodInput()
        {
            Inventor.Application app = ApplicationShim.Instance();

            string test = app.DesignProjectManager.ActiveDesignProject.ContentCenterPath;

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

            string test = null;

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

            var test = "";

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

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

            Assert.IsFalse(PathShim.IsLibraryPath(test, ref app));
        }
示例#13
0
        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);
        }
示例#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);
        }
示例#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);
        }
示例#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;
        }
示例#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));
        }
示例#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); }
        }
示例#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 {  }
        }
示例#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); }
        }
示例#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); }
        }
示例#23
0
        public void BadInput_WrongPath(string testString)
        {
            Inventor.Application app = ApplicationShim.Instance();

            try
            {
                Assert.IsFalse(testString.IsLibraryPath(app));
            }
            finally
            {
                Marshal.ReleaseComObject(app);
                app = null;
            }
        }
示例#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); }
        }
示例#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); }
        }
示例#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); }
        }
示例#28
0
        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;
            }
        }
示例#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); }
        }
示例#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); }
        }