コード例 #1
0
ファイル: CategoryUtil.cs プロジェクト: bimone/IFC-for-Revit
        public static void TryToCreateMaterialAssocation(ExporterIFC exporterIFC, BodyData bodyData,
                                                         Element elementType, Element element, GeometryElement exportGeometry, IFCAnyHandle typeStyle,
                                                         FamilyTypeInfo typeInfo)
        {
            if (bodyData != null && bodyData.RepresentationItemInfo != null &&
                bodyData.RepresentationItemInfo.Count > 0)
            {
                CreateMaterialAssociationWithShapeAspect(exporterIFC,
                                                         elementType, typeStyle, bodyData.RepresentationItemInfo);
                return;
            }

            bool addedMaterialAssociation = false;

            IList <ElementId> matIds = BodyExporter.GetMaterialIdsFromGeometryOrParameters(exportGeometry,
                                                                                           elementType, element);

            if (matIds.Count > 0)
            {
                CreateMaterialAssociation(exporterIFC, typeStyle, matIds);
                addedMaterialAssociation = true;

                if (typeInfo.MaterialIdList.Count == 0)
                {
                    typeInfo.MaterialIdList = matIds;
                }
            }

            if (!addedMaterialAssociation)
            {
                CreateMaterialAssociation(exporterIFC, typeStyle, typeInfo.MaterialIdList);
            }

            return;
        }