Ejemplo n.º 1
0
        public void RemovesNonExisting_noCrash()
        {
            var doc = tests.TestUtilities.CreatePartDocument();

            //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); }
        }
Ejemplo n.º 2
0
        public void CreateSetThatExists_noCrash()
        {
            var doc = tests.TestUtilities.CreatePartDocument();

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

            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); }
        }
Ejemplo n.º 3
0
        public void returnsTrue()
        {
            var doc = tests.TestUtilities.CreatePartDocument();

            var result = AttributeShim.ObjectIsAttributeCapable(doc);

            try
            {
                Assert.IsTrue(result);
            }
            finally { doc.Close(true); }
        }
Ejemplo n.º 4
0
        public void DoesNotExist_returnsFalse()
        {
            var doc = tests.TestUtilities.CreatePartDocument();

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

            try
            {
                Assert.IsFalse(result);
            }
            finally { doc.Close(true); }
        }
Ejemplo n.º 5
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 {  }
        }
Ejemplo n.º 6
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); }
        }
Ejemplo n.º 7
0
        public void DoesExist_returnsTrue()
        {
            var doc = tests.TestUtilities.CreatePartDocument();

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

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

            try
            {
                Assert.IsTrue(result);
            }
            finally { doc.Close(true); }
        }
Ejemplo n.º 8
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); }
        }
Ejemplo n.º 9
0
        public void Double_SetNew()
        {
            var doc = tests.TestUtilities.CreatePartDocument();

            //create the test Attribute
            double test = 16.00;

            AttributeShim.SetAttributeValue(doc, "testSet", "testAttribute", test);
            var result = doc.AttributeSets["testSet"]["testAttribute"].Value;

            try
            {
                Assert.AreEqual(result, test);
            }
            finally { doc.Close(true); }
        }
Ejemplo n.º 10
0
        public void AttDoesExist_returnsTrue()
        {
            var doc = tests.TestUtilities.CreatePartDocument();

            //create the test attribute
            AttributeSet attributeSet = doc.AttributeSets.Add("testSet");
            Attribute    _            = attributeSet.Add("testAttribute", ValueTypeEnum.kStringType, "test string");

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

            try
            {
                Assert.IsTrue(result);
            }
            finally { doc.Close(true); }
        }
Ejemplo n.º 11
0
        public void Integer_SetExisting()
        {
            var doc = tests.TestUtilities.CreatePartDocument();

            //create the test Attribute
            var test = 16;

            AttributeShim.SetAttributeValue(doc, "testSet", "testAttribute", 19);
            AttributeShim.SetAttributeValue(doc, "testSet", "testAttribute", test);
            var result = doc.AttributeSets["testSet"]["testAttribute"].Value;

            try
            {
                Assert.AreEqual(result, test);
            }
            finally { doc.Close(true); }
        }
Ejemplo n.º 12
0
        public void Bool_SetNew()
        {
            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 Attribute
            var test = true;

            AttributeShim.SetAttributeValue(doc, "testSet", "testAttribute", test);
            var result = doc.AttributeSets["testSet"]["testAttribute"].Value;

            try
            {
                Assert.AreEqual(1, result);
            }
            finally { doc.Close(true); }
        }
Ejemplo n.º 13
0
        public void GetExisting_works()
        {
            var doc = tests.TestUtilities.CreatePartDocument();

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

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

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

            try
            {
                Assert.AreEqual(result, test);
            }
            finally { doc.Close(true); }
        }
Ejemplo n.º 14
0
        public void DoesExist_returnsTrue()
        {
            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 attribute
            AttributeSet attributeSet = doc.AttributeSets.Add("testSet");
            Attribute    _            = attributeSet.Add("testAttribute", ValueTypeEnum.kStringType, "test string");


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

            try
            {
                Assert.IsTrue(result);
            }
            finally { doc.Close(true); }
        }
Ejemplo n.º 15
0
        public void CreateSetThatDoesntExist()
        {
            var doc = tests.TestUtilities.CreatePartDocument();

            //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); }
        }
Ejemplo n.º 16
0
        public void GetExisting_works()
        {
            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 Attribute
            var          test         = "test string";
            AttributeSet attributeSet = doc.AttributeSets.Add("testSet");

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


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


            try
            {
                Assert.AreEqual(result, test);
            }
            finally { doc.Close(true); }
        }