예제 #1
0
        public void AddMaterial(Document inDocument, MaterialNode inNode)
        {
            if (!m_pMaterialDict.ContainsKey(inNode.MaterialId.IntegerValue))
            {
                Autodesk.Revit.DB.Material _revitMat = inDocument.GetElement(inNode.MaterialId) as Autodesk.Revit.DB.Material;
                if (_revitMat != null && _revitMat.IsValidObject)
                {
                    BoldarcManagedFbx.Material _mat = new BoldarcManagedFbx.Material(_revitMat.Name);

                    _mat.Red          = _revitMat.Color.Red;
                    _mat.Green        = _revitMat.Color.Green;
                    _mat.Blue         = _revitMat.Color.Blue;
                    _mat.Shininess    = _revitMat.Shininess;
                    _mat.Smoothness   = _revitMat.Smoothness;
                    _mat.Transparency = _revitMat.Transparency;

                    m_pMaterialDict.Add(inNode.MaterialId.IntegerValue, _mat);
                    m_pCurrentMesh.MaterialIDPerFace.Add(m_pCurrentMesh.FaceCount, inNode.MaterialId.IntegerValue);
                }
                else
                {
                    m_pCurrentMesh.MaterialIDPerFace.Add(m_pCurrentMesh.FaceCount, -1);
                }
            }
            else
            {
                m_pCurrentMesh.MaterialIDPerFace.Add(m_pCurrentMesh.FaceCount, inNode.MaterialId.IntegerValue);
            }
        }
예제 #2
0
        public void AddMaterial(Document inDocument, MaterialNode inNode)
        {
            if (!m_pMaterialDict.ContainsKey(inNode.MaterialId.IntegerValue))
            {
                Autodesk.Revit.DB.Material _revitMat = inDocument.GetElement(inNode.MaterialId) as Autodesk.Revit.DB.Material;
                if (_revitMat != null && _revitMat.IsValidObject)
                {
                    BoldarcManagedFbx.Material _mat = new BoldarcManagedFbx.Material(_revitMat.Name);

                    _mat.Red = _revitMat.Color.Red;
                    _mat.Green = _revitMat.Color.Green;
                    _mat.Blue = _revitMat.Color.Blue;
                    _mat.Shininess = _revitMat.Shininess;
                    _mat.Smoothness = _revitMat.Smoothness;
                    _mat.Transparency = _revitMat.Transparency;

                    m_pMaterialDict.Add(inNode.MaterialId.IntegerValue, _mat);
                    m_pCurrentMesh.MaterialIDPerFace.Add(m_pCurrentMesh.FaceCount, inNode.MaterialId.IntegerValue);
                }
                else
                    m_pCurrentMesh.MaterialIDPerFace.Add(m_pCurrentMesh.FaceCount, -1);
            }
            else
                m_pCurrentMesh.MaterialIDPerFace.Add(m_pCurrentMesh.FaceCount, inNode.MaterialId.IntegerValue);
        }