Exemplo n.º 1
0
        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;
        }