/// <summary>
      /// Creates a handle representing an IfcSpace and assigns it to the file.
      /// </summary>
      /// <param name="file">The file.</param>
      /// <param name="guid">The GUID.</param>
      /// <param name="ownerHistory">The owner history.</param>
      /// <param name="name">The name.</param>
      /// <param name="description">The description.</param>
      /// <param name="objectType">The object type.</param>
      /// <param name="objectPlacement">The object placement.</param>
      /// <param name="representation">The representation object.</param>
      /// <param name="longName">The long name.</param>
      /// <param name="compositionType">The composition type.</param>
      /// <param name="internalOrExternal">Specify if it is an exterior space (i.e. part of the outer space) or an interior space.</param>
      /// <param name="elevation">The elevation with flooring measurement.</param>
      /// <returns>The handle.</returns>
      public static IFCAnyHandle CreateSpace(IFCFile file, string guid, IFCAnyHandle ownerHistory,
          string name, string description, string objectType, IFCAnyHandle objectPlacement, IFCAnyHandle representation,
          string longName, IFCElementComposition compositionType, IFCInternalOrExternal internalOrExternal, double? elevation)
      {
         ValidateSpatialStructureElement(guid, ownerHistory, name, description, objectType, objectPlacement, representation, longName, compositionType);

         IFCAnyHandle space = CreateInstance(file, IFCEntityType.IfcSpace);
         if (ExporterCacheManager.ExportOptionsCache.ExportAs4)
         {
            // In IFC4 the position of the attribute is replaced with PreDefinedType
            IFCAnyHandleUtil.SetAttribute(space, "PreDefinedType", IFC4.IFCSpaceType.SPACE);
         }
         else
         {
            // set this attribute only when it is exported to format PRIOR to IFC4. The attribute has been removed/replaced in IFC4 and the property is moved to property set Pset_SpaceCommon.IsExternal
            IFCAnyHandleUtil.SetAttribute(space, "InteriorOrExteriorSpace", internalOrExternal);
         }
         IFCAnyHandleUtil.SetAttribute(space, "ElevationWithFlooring", elevation);
         SetSpatialStructureElement(space, guid, ownerHistory, name, description, objectType, objectPlacement, representation, longName, compositionType);
         return space;
      }
      /// <summary>
      /// Creates an IfcSite and assigns it to the file.
      /// </summary>
      /// <param name="file">The file.</param>
      /// <param name="guid">The GUID.</param>
      /// <param name="ownerHistory">The owner history.</param>
      /// <param name="name">The name.</param>
      /// <param name="description">The description.</param>
      /// <param name="objectType">The object type.</param>
      /// <param name="objectPlacement">The object placement.</param>
      /// <param name="representation">The product representation.</param>
      /// <param name="longName">The long name.</param>
      /// <param name="compositionType">The composition type.</param>
      /// <param name="latitude">The latitude.</param>
      /// <param name="longitude">The longitude.</param>
      /// <param name="elevation">The elevation.</param>
      /// <param name="landTitleNumber">The title number.</param>
      /// <param name="address">The address.</param>
      /// <returns>The handle.</returns>
      public static IFCAnyHandle CreateSite(IFCFile file,
          string guid, IFCAnyHandle ownerHistory, string name, string description, string objectType,
          IFCAnyHandle objectPlacement, IFCAnyHandle representation, string longName,
          IFCElementComposition compositionType, IList<int> latitude, IList<int> longitude,
          double? elevation, string landTitleNumber, IFCAnyHandle address)
      {
         ValidateSpatialStructureElement(guid, ownerHistory, name, description, objectType, objectPlacement, representation, longName, compositionType);
         IFCAnyHandleUtil.ValidateSubTypeOf(address, true, IFCEntityType.IfcPostalAddress);

         IFCAnyHandle site = CreateInstance(file, IFCEntityType.IfcSite);
         IFCAnyHandleUtil.SetAttribute(site, "RefLatitude", latitude);
         IFCAnyHandleUtil.SetAttribute(site, "RefLongitude", longitude);
         IFCAnyHandleUtil.SetAttribute(site, "RefElevation", elevation);
         IFCAnyHandleUtil.SetAttribute(site, "LandTitleNumber", landTitleNumber);
         IFCAnyHandleUtil.SetAttribute(site, "SiteAddress", address);
         SetSpatialStructureElement(site, guid, ownerHistory, name, description, objectType, objectPlacement, representation, longName, compositionType);
         return site;
      }
 /// <summary>
 /// Sets attributes to IfcSpatialStructureElement.
 /// </summary>
 /// <param name="spatialStructureElement">The IfcSpatialStructureElement.</param>
 /// <param name="guid">The GUID.</param>
 /// <param name="ownerHistory">The owner history.</param>
 /// <param name="name">The name.</param>
 /// <param name="description">The description.</param>
 /// <param name="objectType">The object type.</param>
 /// <param name="objectPlacement">The object placement.</param>
 /// <param name="representation">The representation object.</param>
 /// <param name="longName">The long name.</param>
 /// <param name="compositionType">The composition type.</param>
 private static void SetSpatialStructureElement(IFCAnyHandle spatialStructureElement,
     string guid, IFCAnyHandle ownerHistory, string name, string description, string objectType,
     IFCAnyHandle objectPlacement, IFCAnyHandle representation, string longName, IFCElementComposition compositionType)
 {
    IFCAnyHandleUtil.SetAttribute(spatialStructureElement, "LongName", longName);
    IFCAnyHandleUtil.SetAttribute(spatialStructureElement, "CompositionType", compositionType);
    SetProduct(spatialStructureElement, guid, ownerHistory, name, description, objectType, objectPlacement, representation);
 }
      /// <summary>
      /// Validates the values to be set to IfcSpatialStructureElement.
      /// </summary>
      /// <param name="guid">The GUID.</param>
      /// <param name="ownerHistory">The owner history.</param>
      /// <param name="name">The name.</param>
      /// <param name="description">The description.</param>
      /// <param name="objectType">The object type.</param>
      /// <param name="objectPlacement">The object placement.</param>
      /// <param name="representation">The representation object.</param>
      /// <param name="longName">The long name.</param>
      /// <param name="compositionType">The composition type.</param>
      private static void ValidateSpatialStructureElement(string guid, IFCAnyHandle ownerHistory, string name, string description, string objectType,
          IFCAnyHandle objectPlacement, IFCAnyHandle representation, string longName, IFCElementComposition compositionType)
      {
         //longName can be optional

         ValidateProduct(guid, ownerHistory, name, description, objectType, objectPlacement, representation);
      }
      /// <summary>
      /// Creates a handle representing an IfcBuildingStorey and assigns it to the file.
      /// </summary>
      /// <param name="file">The file.</param>
      /// <param name="guid">The GUID.</param>
      /// <param name="ownerHistory">The owner history.</param>
      /// <param name="name">The name.</param>
      /// <param name="description">The description.</param>
      /// <param name="objectType">The object type.</param>
      /// <param name="objectPlacement">The object placement.</param>
      /// <param name="representation">The representation object.</param>
      /// <param name="longName">The long name.</param>
      /// <param name="compositionType">The composition type.</param>
      /// <param name="elevation">The elevation with flooring measurement.</param>
      /// <returns>The handle.</returns>
      public static IFCAnyHandle CreateBuildingStorey(IFCFile file, string guid, IFCAnyHandle ownerHistory,
          string name, string description, string objectType, IFCAnyHandle objectPlacement, IFCAnyHandle representation,
          string longName, IFCElementComposition compositionType, double elevation)
      {
         ValidateSpatialStructureElement(guid, ownerHistory, name, description, objectType, objectPlacement, representation, longName, compositionType);

         IFCAnyHandle buildingStorey = CreateInstance(file, IFCEntityType.IfcBuildingStorey);
         IFCAnyHandleUtil.SetAttribute(buildingStorey, "Elevation", elevation);
         SetSpatialStructureElement(buildingStorey, guid, ownerHistory, name, description, objectType, objectPlacement, representation, longName, compositionType);
         return buildingStorey;
      }
      /// <summary>
      /// Creates an IfcBuilding, and assigns it to the file.
      /// </summary>
      /// <param name="file">The file.</param>
      /// <param name="guid">The GUID.</param>
      /// <param name="ownerHistory">The owner history.</param>
      /// <param name="name">The name.</param>
      /// <param name="description">The description.</param>
      /// <param name="objectType">The object type.</param>
      /// <param name="objectPlacement">The object placement.</param>
      /// <param name="representation">The representation object.</param>
      /// <param name="longName">The long name.</param>
      /// <param name="compositionType">The composition type.</param>
      /// <param name="elevationOfRefHeight">Elevation above sea level of the reference height used for all storey elevation measures, equals to height 0.0.</param>
      /// <param name="elevationOfTerrain">Elevation above the minimal terrain level around the foot print of the building, given in elevation above sea level.</param>
      /// <param name="buildingAddress">Address given to the building for postal purposes.</param>
      /// <returns>The handle.</returns>
      public static IFCAnyHandle CreateBuilding(IFCFile file, string guid, IFCAnyHandle ownerHistory,
          string name, string description, string objectType, IFCAnyHandle objectPlacement, IFCAnyHandle representation,
          string longName, IFCElementComposition compositionType, double? elevationOfRefHeight, double? elevationOfTerrain, IFCAnyHandle buildingAddress)
      {
         IFCAnyHandleUtil.ValidateSubTypeOf(buildingAddress, true, IFCEntityType.IfcPostalAddress);
         ValidateSpatialStructureElement(guid, ownerHistory, name, description, objectType, objectPlacement, representation, longName, compositionType);

         IFCAnyHandle building = CreateInstance(file, IFCEntityType.IfcBuilding);
         IFCAnyHandleUtil.SetAttribute(building, "ElevationOfRefHeight", elevationOfRefHeight);
         IFCAnyHandleUtil.SetAttribute(building, "ElevationOfTerrain", elevationOfTerrain);
         IFCAnyHandleUtil.SetAttribute(building, "BuildingAddress", buildingAddress);
         SetSpatialStructureElement(building, guid, ownerHistory, name, description, objectType, objectPlacement, representation, longName, compositionType);
         return building;
      }
Example #7
0
        /// <summary>
        /// Creates an IfcBuildingElementProxy, and assigns it to the file.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="guid">The GUID.</param>
        /// <param name="ownerHistory">The owner history.</param>
        /// <param name="name">The name.</param>
        /// <param name="description">The description.</param>
        /// <param name="objectType">The object type.</param>
        /// <param name="objectPlacement">The object placement.</param>
        /// <param name="representation">The geometric representation of the entity.</param>
        /// <param name="elementTag">The tag that represents the entity.</param>
        /// <param name="compositionType">The element composition of the proxy.</param>
        /// <returns>The handle.</returns>
        public static IFCAnyHandle CreateBuildingElementProxy(IFCFile file, string guid, IFCAnyHandle ownerHistory, string name, string description, string objectType,
            IFCAnyHandle objectPlacement, IFCAnyHandle representation, string elementTag, IFCElementComposition? compositionType)
        {
            ValidateElement(guid, ownerHistory, name, description, objectType, objectPlacement, representation, elementTag);

            IFCAnyHandle buildingElementProxy = CreateInstance(file, IFCEntityType.IfcBuildingElementProxy);
            IFCAnyHandleUtil.SetAttribute(buildingElementProxy, "CompositionType", compositionType);
            SetElement(buildingElementProxy, guid, ownerHistory, name, description, objectType, objectPlacement, representation, elementTag);
            return buildingElementProxy;
        }
Example #8
0
        /// <summary>
        /// Creates a handle representing an IfcSpace and assigns it to the file.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="guid">The GUID.</param>
        /// <param name="ownerHistory">The owner history.</param>
        /// <param name="name">The name.</param>
        /// <param name="description">The description.</param>
        /// <param name="objectType">The object type.</param>
        /// <param name="objectPlacement">The object placement.</param>
        /// <param name="representation">The representation object.</param>
        /// <param name="longName">The long name.</param>
        /// <param name="compositionType">The composition type.</param>
        /// <param name="internalOrExternal">Specify if it is an exterior space (i.e. part of the outer space) or an interior space.</param>
        /// <param name="elevation">The elevation with flooring measurement.</param>
        /// <returns>The handle.</returns>
        public static IFCAnyHandle CreateSpace(IFCFile file, string guid, IFCAnyHandle ownerHistory,
            string name, string description, string objectType, IFCAnyHandle objectPlacement, IFCAnyHandle representation,
            string longName, IFCElementComposition compositionType, IFCInternalOrExternal internalOrExternal, double? elevation)
        {
            ValidateSpatialStructureElement(guid, ownerHistory, name, description, objectType, objectPlacement, representation, longName, compositionType);

            IFCAnyHandle space = CreateInstance(file, IFCEntityType.IfcSpace);
            IFCAnyHandleUtil.SetAttribute(space, "InteriorOrExteriorSpace", internalOrExternal);
            IFCAnyHandleUtil.SetAttribute(space, "ElevationWithFlooring", elevation);
            SetSpatialStructureElement(space, guid, ownerHistory, name, description, objectType, objectPlacement, representation, longName, compositionType);
            return space;
        }