Beispiel #1
0
        public void ReadMat(ModelDoc2 swDoc)
        {
            AssemblyDoc swADoc;

            object[] varComp;
            double[] varMatProp;


            swADoc = (AssemblyDoc)swDoc;

            varComp = (object[])swADoc.GetComponents(true);
            int I = 0;

            for (I = 0; I < varComp.Length; I++)
            {
                Component2 swComp = default(Component2);
                swComp = (Component2)varComp[I];

                varMatProp = (double[])swComp.GetModelMaterialPropertyValues(swComp.ReferencedConfiguration);
                if (!((varMatProp == null)))
                {
                    Debug.Print(swComp.Name2 + "(" + I + ")" + "ConfigName : " + swComp.ReferencedConfiguration + "MatProp : ");
                    Debug.Print("Red: " + (varMatProp[0]) * 255.0);
                    Debug.Print("Green: " + (varMatProp[1]) * 255.0);
                    Debug.Print("Blue: " + (varMatProp[2]) * 255.0);
                    Debug.Print("Ambient: " + (varMatProp[3]) * 100.0 + "%");
                    Debug.Print("Diffuse: " + (varMatProp[4]) * 100.0 + "%");
                    Debug.Print("Specularity: " + (varMatProp[5]) * 100.0 + "%");
                    Debug.Print("Shininess: " + (varMatProp[6]) * 100.0 + "%");
                    Debug.Print("Transparency: " + (varMatProp[7]) * 100.0 + "%");
                    Debug.Print("Emission: " + (varMatProp[8]) * 100.0 + "%");
                }

                Debug.Print("");
            }
        }