/// <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> /// 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) { IFCFile file = exporterIFC.GetFile(); HashSet <IFCAnyHandle> itemSet = new HashSet <IFCAnyHandle>(items); IFCAnyHandle newShapeRepresentation = IFCInstanceExporter.CreateShapeRepresentation(file, contextOfItems, identifier, representationType, itemSet); if (IFCAnyHandleUtil.IsNullOrHasNoValue(newShapeRepresentation)) { return(newShapeRepresentation); } // We are using the DWG export layer table to correctly map category to DWG layer for the // IfcPresentationLayerAsssignment. exporterIFC.RegisterShapeForPresentationLayer(element, categoryId, newShapeRepresentation); return(newShapeRepresentation); }
/// <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, ISet<IFCAnyHandle> items) { IFCAnyHandle newShapeRepresentation = CreateBaseShapeRepresentation(exporterIFC, contextOfItems, identifier, representationType, items); if (IFCAnyHandleUtil.IsNullOrHasNoValue(newShapeRepresentation)) return newShapeRepresentation; // Search for old "IFCCadLayer" or new "IfcPresentationLayer". string ifcCADLayer = null; if ((ParameterUtil.GetStringValueFromElementOrSymbol(element, "IFCCadLayer", out ifcCADLayer) == null) || string.IsNullOrWhiteSpace(ifcCADLayer)) { if ((ParameterUtil.GetStringValueFromElementOrSymbol(element, "IfcPresentationLayer", 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> /// 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="identifierOpt"> /// The identifier for the representation. /// </param> /// <param name="representationTypeOpt"> /// 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, ElementId categoryId, IFCAnyHandle contextOfItems, IFCLabel identifierOpt, IFCLabel representationTypeOpt, HashSet<IFCAnyHandle> items) { IFCFile file = exporterIFC.GetFile(); IFCAnyHandle newShapeRepresentation = file.CreateShapeRepresentation(contextOfItems, identifierOpt, representationTypeOpt, items); if (!newShapeRepresentation.HasValue) return newShapeRepresentation; // We are using the DWG export layer table to correctly map category to DWG layer for the // IfcPresentationLayerAsssignment. exporterIFC.RegisterShapeForPresentationLayer(categoryId, newShapeRepresentation); return newShapeRepresentation; }
/// <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) { IFCFile file = exporterIFC.GetFile(); HashSet<IFCAnyHandle> itemSet = new HashSet<IFCAnyHandle>(items); IFCAnyHandle newShapeRepresentation = IFCInstanceExporter.CreateShapeRepresentation(file, contextOfItems, identifier, representationType, itemSet); if (IFCAnyHandleUtil.IsNullOrHasNoValue(newShapeRepresentation)) return newShapeRepresentation; // We are using the DWG export layer table to correctly map category to DWG layer for the // IfcPresentationLayerAsssignment. exporterIFC.RegisterShapeForPresentationLayer(element, categoryId, newShapeRepresentation); return newShapeRepresentation; }