Exemple #1
0
        /// <summary>
        /// Creates a shape representation and register it to shape representation layer.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="categoryId">The category id.</param>
        /// <param name="contextOfItems">The context for which the different subtypes of representation are valid.</param>
        /// <param name="identifier">The identifier for the representation.</param>
        /// <param name="representationType">The type handle for the representation.</param>
        /// <param name="items">Collection of geometric representation items that are defined for this representation.</param>
        /// <returns>The handle.</returns>
        public static IFCAnyHandle CreateShapeRepresentation(ExporterIFC exporterIFC, Element element, ElementId categoryId, IFCAnyHandle contextOfItems,
                                                             string identifier, string representationType, ICollection <IFCAnyHandle> items)
        {
            IFCAnyHandle newShapeRepresentation = CreateBaseShapeRepresentation(exporterIFC, contextOfItems, identifier, representationType, items);

            if (IFCAnyHandleUtil.IsNullOrHasNoValue(newShapeRepresentation))
            {
                return(newShapeRepresentation);
            }

            string ifcCADLayer = null;

            if ((ParameterUtil.GetStringValueFromElementOrSymbol(element, "IFCCadLayer", out ifcCADLayer) == null) || string.IsNullOrWhiteSpace(ifcCADLayer))
            {
                ifcCADLayer = ExporterStateManager.GetCurrentCADLayerOverride();
            }

            // We are using the DWG export layer table to correctly map category to DWG layer for the
            // IfcPresentationLayerAsssignment, if it is not overridden.
            if (!string.IsNullOrWhiteSpace(ifcCADLayer))
            {
                ExporterCacheManager.PresentationLayerSetCache.AddRepresentationToLayer(ifcCADLayer, newShapeRepresentation);
            }
            else
            {
                exporterIFC.RegisterShapeForPresentationLayer(element, categoryId, newShapeRepresentation);
            }

            return(newShapeRepresentation);
        }
 /// <summary>
 /// The constructor that sets the current CAD layer override string.  Will do nothing if the string in invalid or null.
 /// </summary>
 /// <param name="overrideString">The value.</param>
 public CADLayerOverrideSetter(string overrideString)
 {
     if (!string.IsNullOrWhiteSpace(overrideString))
     {
         ExporterStateManager.PushCADLayerOverride(overrideString);
         m_ValidString = true;
     }
 }