Beispiel #1
0
        /// <summary>
        /// Create a property set for a given element.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The element being created.</param>
        /// <param name="parameterGroupMap">The parameters of the element.  Cached for performance.</param>
        /// <returns>The name of the property set created, if it was created, and a Boolean value if it should be added to the property set list.</returns>
        public override Tuple <string, bool> CreatePropertySet(Document doc, Element element, IFCObjectDefinition objDef, IFCParameterSetByGroup parameterGroupMap)
        {
            IDictionary <string, IFCData> parametersToAdd = new Dictionary <string, IFCData>();
            Category category = IFCPropertySet.GetCategoryForParameterIfValid(element, Id);

            foreach (KeyValuePair <Tuple <string, ForgeTypeId, AllowedValues>, double> property in DoubleProperties)
            {
                string    name = property.Key.Item1;
                Parameter existingParameter = null;
                if (!parameterGroupMap.TryFindParameter(name, out existingParameter))
                {
                    ForgeTypeId valueType = property.Key.Item2;
                    // If we aren't scaling values, all length values have come from Attributes
                    // and so will always be in feet.
                    ForgeTypeId unitType = (!Importer.TheProcessor.ScaleValues && valueType == SpecTypeId.Length) ?
                                           UnitTypeId.Feet : null;
                    IFCPropertySet.AddParameterDouble(doc, element, category, objDef, name, valueType, unitType, property.Value, Id);
                    continue;
                }

                switch (existingParameter.StorageType)
                {
                case StorageType.String:
                    existingParameter.Set(property.Value.ToString());
                    break;

                case StorageType.Double:
                    existingParameter.Set(property.Value);
                    break;

                default:
                    Importer.TheLog.LogError(Id, "couldn't create parameter: " + name + " of storage type: " + existingParameter.StorageType.ToString(), false);
                    break;
                }
            }

            foreach (KeyValuePair <string, string> property in StringProperties)
            {
                string    name = property.Key;
                Parameter existingParameter = null;
                if (!parameterGroupMap.TryFindParameter(name, out existingParameter))
                {
                    IFCPropertySet.AddParameterString(doc, element, category, objDef, property.Key, property.Value, Id);
                    continue;
                }

                switch (existingParameter.StorageType)
                {
                case StorageType.String:
                    existingParameter.Set(property.Value);
                    break;

                default:
                    Importer.TheLog.LogError(Id, "couldn't create parameter: " + name + " of storage type: " + existingParameter.StorageType.ToString(), false);
                    break;
                }
            }

            return(Tuple.Create("\"" + EntityType.ToString() + "\"", false));
        }
Beispiel #2
0
        /// <summary>
        /// Creates or populates Revit element params based on the information contained in this class.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The element.</param>
        protected override void CreateParametersInternal(Document doc, Element element)
        {
            base.CreateParametersInternal(doc, element);
            string parameterName = "LandTitleNumber";

            // TODO: move this to new shared parameter names override function.
            if (element is ProjectInfo)
            {
                parameterName = "IfcSite " + parameterName;
            }

            if (element != null)
            {
                string landTitleNumber = LandTitleNumber;
                if (!string.IsNullOrWhiteSpace(landTitleNumber))
                {
                    Category category = IFCPropertySet.GetCategoryForParameterIfValid(element, Id);
                    IFCPropertySet.AddParameterString(doc, element, category, this, parameterName, landTitleNumber, Id);
                }
            }

            ForgeTypeId lengthUnits = null;

            if (!Importer.TheProcessor.ScaleValues)
            {
                lengthUnits = IFCImportFile.TheFile.IFCUnits.GetIFCProjectUnit(SpecTypeId.Length)?.Unit;
            }

            Importer.TheProcessor.PostProcessSite(Id, RefLatitude,
                                                  RefLongitude, RefElevation, LandTitleNumber, lengthUnits,
                                                  ObjectLocation?.TotalTransform);
        }
        /// <summary>
        /// Set the Element.Name property if possible, and add an "IfcName" parameter to an element containing the original name of the generating entity.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The created element.</param>
        /// <param name="category">The element's category.</param>
        private void SetName(Document doc, Element element, Category category)
        {
            if (element == null)
            {
                return;
            }

            string revitName = GetName(null);

            if (!string.IsNullOrWhiteSpace(revitName))
            {
                try
                {
                    if (CanSetRevitName(element))
                    {
                        element.Name = revitName;
                    }
                }
                catch
                {
                }
            }

            string name = string.IsNullOrWhiteSpace(Name) ? "" : Name;

            // 2015: Revit links don't show the name of a selected item inside the link.
            // 2015: DirectShapes don't have a built-in "Name" parameter.
            IFCPropertySet.AddParameterString(doc, element, category, this, IFCSharedParameters.IfcName, Name, Id);
        }
        /// <summary>
        /// Add a parameter "IfcMaterial" to an element containing the name(s) of the materials of the generating entity.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The created element.</param>
        /// <param name="category">The element's category.</param>
        /// <remarks>Note that this field contains the names of the materials, and as such is not parametric in any way.</remarks>
        private void SetMaterialParameter(Document doc, Element element, Category category)
        {
            if (category == null)
            {
                return;
            }

            string materialNames = null;

            IList <string> materialsAndThickness = GetMaterialsNamesAndThicknesses();

            foreach (string val in materialsAndThickness)
            {
                if (materialNames == null)
                {
                    materialNames = val;
                }
                else
                {
                    materialNames += ";" + val;
                }
            }
            if (materialNames != null)
            {
                IFCPropertySet.AddParameterString(doc, element, category, this, IFCSharedParameters.IfcMaterial, materialNames, Id);
            }
        }
        /// <summary>
        /// Set the Element.Name property if possible, and add an "IfcName" parameter to an element containing the original name of the generating entity.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The created element.</param>
        /// <param name="category">The element's category.</param>
        private void SetName(Document doc, Element element, Category category)
        {
            if (element == null)
            {
                return;
            }

            string revitName = GetName(null);

            if (!string.IsNullOrWhiteSpace(revitName))
            {
                if (CanSetRevitName(element))
                {
                    if (!SuccessfullySetName(element, revitName))
                    {
                        if (!SuccessfullySetName(element, revitName + " " + Id))
                        {
                            Importer.TheLog.LogWarning(Id, "Couldn't set element name.", false);
                        }
                    }
                }
            }

            string name = string.IsNullOrWhiteSpace(Name) ? "" : Name;

            // 2015: Revit links don't show the name of a selected item inside the link.
            // 2015: DirectShapes don't have a built-in "Name" parameter.
            IFCPropertySet.AddParameterString(doc, element, category, this, IFCSharedParameters.IfcName, Name, Id);
        }
Beispiel #6
0
        /// <summary>
        /// Add parameter "IfcSystem" to an element containing the name(s) of the system(s) of the generating entity.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The created element.</param>
        /// <remarks>Note that this field contains the names of the systems, and as such is not parametric in any way.</remarks>
        private void SetSystemParameter(Document doc, Element element)
        {
            string systemNames = null;

            foreach (IFCGroup assignmentGroup in AssignmentGroups)
            {
                if (!(assignmentGroup is IFCSystem))
                {
                    continue;
                }

                string name = assignmentGroup.Name;
                if (string.IsNullOrWhiteSpace(name))
                {
                    continue;
                }

                if (systemNames == null)
                {
                    systemNames = name;
                }
                else
                {
                    systemNames += ";" + name;
                }
            }

            if (systemNames != null)
            {
                IFCPropertySet.AddParameterString(doc, element, "IfcSystem", systemNames, Id);
            }
        }
Beispiel #7
0
        /// <summary>
        /// Add a parameter "IfcMaterial" to an element containing the name(s) of the materals of the generating entity.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The created parameter.</param>
        /// <remarks>Note that this field contains the names of the materials, and as such is not parametric in any way.</remarks>
        private void setMaterialParameter(Document doc, Element element)
        {
            IList <IFCMaterial> materials = GetMaterials();
            string materialNames          = null;

            foreach (IFCMaterial material in materials)
            {
                string name = material.Name;
                if (string.IsNullOrWhiteSpace(name))
                {
                    continue;
                }

                if (materialNames == null)
                {
                    materialNames = name;
                }
                else
                {
                    materialNames += ";" + name;
                }
            }

            if (materialNames != null)
            {
                IFCPropertySet.AddParameterString(doc, element, "IfcMaterial", materialNames, Id);
            }
        }
Beispiel #8
0
        /// <summary>
        /// Creates or populates Revit element params based on the information contained in this class.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The element.</param>
        protected override void CreateParametersInternal(Document doc, Element element)
        {
            base.CreateParametersInternal(doc, element);

            if (element != null)
            {
                Category category = IFCPropertySet.GetCategoryForParameterIfValid(element, Id);
                if (category != null)
                {
                    Parameter operationTypeParameter = element.get_Parameter(BuiltInParameter.DOOR_OPERATION_TYPE);
                    if (operationTypeParameter != null)
                    {
                        operationTypeParameter.Set(OperationType.ToString());
                    }
                    IFCPropertySet.AddParameterString(doc, element, category, "IfcOperationType", OperationType.ToString(), Id);

                    Parameter constructionTypeParameter = element.get_Parameter(BuiltInParameter.DOOR_CONSTRUCTION_TYPE);
                    if (constructionTypeParameter != null)
                    {
                        constructionTypeParameter.Set(ConstructionType.ToString());
                    }
                    IFCPropertySet.AddParameterString(doc, element, category, "IfcConstructionType", ConstructionType.ToString(), Id);
                }
            }
        }
        /// <summary>
        /// Create property sets for a given element.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The element being created.</param>
        /// <param name="propertySetsCreated">A concatenated string of property sets created, used to filter schedules.</returns>
        /// <param name="propertySetListName">The name of the parameter that contains the property set list name.</param>
        /// <param name="propertySets">The list of properties.</param>
        protected void CreatePropertySetsBase(Document doc, Element element, string propertySetsCreated, string propertySetListName,
                                              IDictionary <string, IFCPropertySetDefinition> propertySets)
        {
            if (propertySetsCreated == null)
            {
                propertySetsCreated = "";
            }

            if (propertySets != null && propertySets.Count > 0)
            {
                IFCParameterSetByGroup parameterGroupMap = IFCParameterSetByGroup.Create(element);
                foreach (IFCPropertySetDefinition propertySet in propertySets.Values)
                {
                    Tuple <string, bool> newPropertySetCreated = propertySet.CreatePropertySet(doc, element, this, parameterGroupMap);
                    if (newPropertySetCreated == null || !newPropertySetCreated.Item2 || string.IsNullOrWhiteSpace(newPropertySetCreated.Item1))
                    {
                        continue;
                    }

                    if (propertySetsCreated == "")
                    {
                        propertySetsCreated = newPropertySetCreated.Item1;
                    }
                    else
                    {
                        propertySetsCreated += ";" + newPropertySetCreated.Item1;
                    }
                }
            }
            // Add property set-based parameters.
            // We are going to create this "fake" parameter so that we can filter elements in schedules based on their property sets.
            Category category = IFCPropertySet.GetCategoryForParameterIfValid(element, Id);

            IFCPropertySet.AddParameterString(doc, element, category, this, propertySetListName, propertySetsCreated, Id);
        }
Beispiel #10
0
        /// <summary>
        /// Creates or populates Revit element params based on the information contained in this class.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The element.</param>
        protected override void CreateParametersInternal(Document doc, Element element)
        {
            base.CreateParametersInternal(doc, element);

            if (element != null)
            {
                IFCPropertySet.AddParameterString(doc, element, "Flow Direction", FlowDirection.ToString(), Id);
            }
        }
Beispiel #11
0
        /// <summary>
        /// Creates or populates Revit element params based on the information contained in this class.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The element.</param>
        protected override void CreateParametersInternal(Document doc, Element element)
        {
            base.CreateParametersInternal(doc, element);

            if (element != null)
            {
                Category category = IFCPropertySet.GetCategoryForParameterIfValid(element, Id);
                IFCPropertySet.AddParameterString(doc, element, category, this, "Flow Direction", FlowDirection.ToString(), Id);
            }
        }
Beispiel #12
0
        /// <summary>
        /// Creates or populates Revit element params based on the information contained in this class.
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="element"></param>
        protected override void CreateParametersInternal(Document doc, Element element)
        {
            base.CreateParametersInternal(doc, element);

            if (element != null)
            {
                // Set "IfcElevation" parameter.
                IFCPropertySet.AddParameterDouble(doc, element, "IfcElevation", SpecTypeId.Length, m_Elevation, Id);
            }
        }
        /// <summary>
        /// Add a parameter "IfcDescription" to an element containing the description of the generating entity.
        /// If the element has the built-in parameter ALL_MODEL_DESCRIPTION, populate that also.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The created parameter.</param>
        /// <param name="category">The element's category.</param>
        private void SetDescription(Document doc, Element element, Category category)
        {
            // If the element has the built-in ALL_MODEL_DESCRIPTION parameter, populate that also.
            // We will create/populate the parameter even if the description is empty or null.
            string description = string.IsNullOrWhiteSpace(Description) ? string.Empty : Description;

            Importer.TheProcessor.SetStringParameter(element, Id, BuiltInParameter.ALL_MODEL_DESCRIPTION, description, true);

            IFCPropertySet.AddParameterString(doc, element, category, this, IFCSharedParameters.IfcDescription, description, Id);
        }
Beispiel #14
0
        /// <summary>
        /// Creates or populates Revit element params based on the information contained in this class.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The element.</param>
        protected override void CreateParametersInternal(Document doc, Element element)
        {
            base.CreateParametersInternal(doc, element);

            if (element != null)
            {
                Category category = IFCPropertySet.GetCategoryForParameterIfValid(element, Id);

                // Set "ElevationWithFlooring" parameter.
                IFCPropertySet.AddParameterDouble(doc, element, category, "ElevationWithFlooring", SpecTypeId.Length, ElevationWithFlooring, Id);

                // Set "PredefinedType" parameter.
                if (PredefinedType != null)
                {
                    if (IFCImportFile.TheFile.SchemaVersionAtLeast(IFCSchemaVersion.IFC4Obsolete))
                    {
                        IFCPropertySet.AddParameterString(doc, element, category, "PredefinedType", PredefinedType, Id);
                    }
                    else
                    {
                        IFCPropertySet.AddParameterString(doc, element, category, "InteriorOrExteriorSpace", PredefinedType, Id);
                    }
                }

                // Set "IfcZone" parameter.
                string zoneNames = null;
                foreach (IFCGroup zone in AssignmentGroups)
                {
                    if (!(zone is IFCZone))
                    {
                        continue;
                    }

                    string name = zone.Name;
                    if (string.IsNullOrWhiteSpace(name))
                    {
                        continue;
                    }

                    if (zoneNames == null)
                    {
                        zoneNames = name;
                    }
                    else
                    {
                        zoneNames += ";" + name;
                    }
                }

                if (zoneNames != null)
                {
                    IFCPropertySet.AddParameterString(doc, element, category, "IfcZone", zoneNames, Id);
                }
            }
        }
        /// <summary>
        /// Create a property set for a given element.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The element being created.</param>
        /// <param name="parameterGroupMap">The parameters of the element.  Cached for performance.</param>
        /// <returns>The name of the property set created, if it was created, and a Boolean value if it should be added to the property set list.</returns>
        public override Tuple <string, bool> CreatePropertySet(Document doc, Element element, IFCParameterSetByGroup parameterGroupMap)
        {
            IDictionary <string, IFCData> parametersToAdd = new Dictionary <string, IFCData>();
            Category category = IFCPropertySet.GetCategoryForParameterIfValid(element, Id);

            foreach (KeyValuePair <Tuple <string, ForgeTypeId, AllowedValues>, double> property in DoubleProperties)
            {
                string    name = property.Key.Item1;
                Parameter existingParameter = null;
                if (!parameterGroupMap.TryFindParameter(name, out existingParameter))
                {
                    IFCPropertySet.AddParameterDouble(doc, element, category, name, property.Key.Item2, property.Value, Id);
                    continue;
                }

                switch (existingParameter.StorageType)
                {
                case StorageType.String:
                    existingParameter.Set(property.Value.ToString());
                    break;

                case StorageType.Double:
                    existingParameter.Set(property.Value);
                    break;

                default:
                    Importer.TheLog.LogError(Id, "couldn't create parameter: " + name + " of storage type: " + existingParameter.StorageType.ToString(), false);
                    break;
                }
            }

            foreach (KeyValuePair <string, string> property in StringProperties)
            {
                string    name = property.Key;
                Parameter existingParameter = null;
                if (!parameterGroupMap.TryFindParameter(name, out existingParameter))
                {
                    IFCPropertySet.AddParameterString(doc, element, category, property.Key, property.Value, Id);
                    continue;
                }

                switch (existingParameter.StorageType)
                {
                case StorageType.String:
                    existingParameter.Set(property.Value);
                    break;

                default:
                    Importer.TheLog.LogError(Id, "couldn't create parameter: " + name + " of storage type: " + existingParameter.StorageType.ToString(), false);
                    break;
                }
            }

            return(Tuple.Create("\"" + EntityType.ToString() + "\"", false));
        }
Beispiel #16
0
        /// <summary>
        /// Creates or populates Revit element params based on the information contained in this class.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The element.</param>
        protected override void CreateParametersInternal(Document doc, Element element)
        {
            base.CreateParametersInternal(doc, element);

            if (element != null)
            {
                Category category = (ContainedIn != null) || (ConnectedFrom != null) ?
                                    IFCPropertySet.GetCategoryForParameterIfValid(element, Id) : null;
                if (ContainedIn != null)
                {
                    string guid = ContainedIn.GlobalId;
                    if (!string.IsNullOrWhiteSpace(guid))
                    {
                        IFCPropertySet.AddParameterString(doc, element, category, this, "IfcElement ContainedIn IfcGUID", guid, Id);
                    }

                    string name = ContainedIn.Name;
                    if (!string.IsNullOrWhiteSpace(name))
                    {
                        IFCPropertySet.AddParameterString(doc, element, category, this, "IfcElement ContainedIn Name", name, Id);
                    }
                }

                if (ConnectedFrom != null)
                {
                    string guid = ConnectedFrom.GlobalId;
                    if (!string.IsNullOrWhiteSpace(guid))
                    {
                        IFCPropertySet.AddParameterString(doc, element, category, this, "IfcPort ConnectedFrom IfcGUID", guid, Id);
                    }

                    string name = ConnectedFrom.Name;
                    if (!string.IsNullOrWhiteSpace(name))
                    {
                        IFCPropertySet.AddParameterString(doc, element, category, this, "IfcPort ConnectedFrom Name", name, Id);
                    }
                }

                if (ConnectedTo != null)
                {
                    string guid = ConnectedTo.GlobalId;
                    if (!string.IsNullOrWhiteSpace(guid))
                    {
                        IFCPropertySet.AddParameterString(doc, element, category, this, "IfcPort ConnectedTo IfcGUID", guid, Id);
                    }

                    string name = ConnectedTo.Name;
                    if (!string.IsNullOrWhiteSpace(name))
                    {
                        IFCPropertySet.AddParameterString(doc, element, category, this, "IfcPort ConnectedTo Name", name, Id);
                    }
                }
            }
        }
Beispiel #17
0
        /// <summary>
        /// Creates or populates Revit element params based on the information contained in this class.
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="element"></param>
        protected override void CreateParametersInternal(Document doc, Element element)
        {
            base.CreateParametersInternal(doc, element);

            if (element != null)
            {
                // Set "IfcElevation" parameter.
                Category category = IFCPropertySet.GetCategoryForParameterIfValid(element, Id);
                IFCPropertySet.AddParameterDouble(doc, element, category, this, "IfcElevation", SpecTypeId.Length, UnitTypeId.Feet, Elevation, Id);
            }
        }
        /// <summary>
        /// Creates or populates Revit element params based on the information contained in this class.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The element.</param>
        protected override void CreateParametersInternal(Document doc, Element element)
        {
            base.CreateParametersInternal(doc, element);

            if (element != null)
            {
                IFCPropertySet.AddParameterString(doc, element, "IfcPredefinedType", PredefinedType, Id);

                IFCPropertySet.AddParameterString(doc, element, "IfcAssemblyPlace", AssemblyPlace.ToString(), Id);
            }
        }
Beispiel #19
0
        /// <summary>
        /// Creates or populates Revit element params based on the information contained in this class.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The element.</param>
        protected override void CreateParametersInternal(Document doc, Element element)
        {
            base.CreateParametersInternal(doc, element);

            if (element != null)
            {
                Category category = IFCPropertySet.GetCategoryForParameterIfValid(element, Id);
                IFCPropertySet.AddParameterString(doc, element, category, this, "IfcPredefinedType", PredefinedType, Id);
                IFCPropertySet.AddParameterString(doc, element, category, this, "IfcAssemblyPlace", AssemblyPlace.ToString(), Id);
            }
        }
Beispiel #20
0
      /// <summary>
      /// Creates or populates Revit element params based on the information contained in this class.
      /// </summary>
      /// <param name="doc">The document.</param>
      /// <param name="element">The element.</param>
      protected override void CreateParametersInternal(Document doc, Element element)
      {
         base.CreateParametersInternal(doc, element);

         if (element != null)
         {
            // Set "ObjectTypeOverride" parameter.
            string objectTypeOverride = ObjectType;
            if (!string.IsNullOrWhiteSpace(objectTypeOverride))
               IFCPropertySet.AddParameterString(doc, element, "ObjectTypeOverride", objectTypeOverride, Id);
         }
      }
Beispiel #21
0
        /// <summary>
        /// Creates or populates Revit element params based on the information contained in this class.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The element.</param>
        protected override void CreateParametersInternal(Document doc, Element element)
        {
            base.CreateParametersInternal(doc, element);

            if (element != null)
            {
                if (!string.IsNullOrWhiteSpace(ElementType))
                {
                    IFCPropertySet.AddParameterString(doc, element, "IfcElementType", ElementType, Id);
                }
            }
        }
Beispiel #22
0
        /// <summary>
        /// Creates or populates Revit element params based on the information contained in this class.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The element.</param>
        protected override void CreateParametersInternal(Document doc, Element element)
        {
            base.CreateParametersInternal(doc, element);

            if (element != null)
            {
                if (!string.IsNullOrWhiteSpace(ElementType))
                {
                    Category category = IFCPropertySet.GetCategoryForParameterIfValid(element, Id);
                    IFCPropertySet.AddParameterString(doc, element, category, "IfcElementType", ElementType, Id);
                }
            }
        }
Beispiel #23
0
        /// <summary>
        /// Add a parameter "IfcDescription" to an element containing the description of the generating entity.
        /// If the element has the built-in parameter ALL_MODEL_DESCRIPTION, populate that also.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The created parameter.</param>
        private void SetDescription(Document doc, Element element)
        {
            // If the element has the built-in ALL_MODEL_DESCRIPTION parameter, populate that also.
            // We will create/populate the parameter even if the description is empty or null.
            string    description          = string.IsNullOrWhiteSpace(Description) ? "" : Description;
            Parameter descriptionParameter = element.get_Parameter(BuiltInParameter.ALL_MODEL_DESCRIPTION);

            if (descriptionParameter != null)
            {
                descriptionParameter.SetValueString(description);
            }
            IFCPropertySet.AddParameterString(doc, element, "IfcDescription", description, Id);
        }
        protected virtual void CreateParametersInternal(Document doc, Element element)
        {
            if (element != null)
            {
                // Set the element name.
                SetName(doc, element);

                // Set the element description.
                SetDescription(doc, element);

                // The list of materials.
                SetMaterialParameter(doc, element);

                // Set the "IfcSystem" parameter.
                SetSystemParameter(doc, element);

                // Set the element GUID.
                bool             elementIsType = (element is ElementType);
                BuiltInParameter ifcGUIDId     = GetGUIDParameter(element, elementIsType);
                Parameter        guidParam     = element.get_Parameter(ifcGUIDId);
                if (guidParam != null)
                {
                    if (!guidParam.IsReadOnly)
                    {
                        guidParam.Set(GlobalId);
                    }
                }
                else
                {
                    ExporterIFCUtils.AddValueString(element, new ElementId(ifcGUIDId), GlobalId);
                }

                // Set the "IfcExportAs" parameter.
                string ifcExportAs = IFCCategoryUtil.GetCustomCategoryName(this);
                if (!string.IsNullOrWhiteSpace(ifcExportAs))
                {
                    IFCPropertySet.AddParameterString(doc, element, "IfcExportAs", ifcExportAs, Id);
                }

                // Add property set-based parameters.
                // We are going to create this "fake" parameter so that we can filter elements in schedules based on their property sets.
                string propertySetListName = elementIsType ? "Type IfcPropertySetList" : "IfcPropertySetList";
                IFCPropertySet.AddParameterString(doc, element, propertySetListName, "", Id);

                // Set the IFCElementAssembly Parameter
                if (Decomposes != null && Decomposes is IFCElementAssembly)
                {
                    IFCPropertySet.AddParameterString(doc, element, "IfcElementAssembly", Decomposes.Name, Id);
                }
            }
        }
Beispiel #25
0
        /// <summary>
        /// Creates or populates Revit element params based on the information contained in this class.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The element.</param>
        protected override void CreateParametersInternal(Document doc, Element element)
        {
            base.CreateParametersInternal(doc, element);

            if (element != null)
            {
                Category category = IFCPropertySet.GetCategoryForParameterIfValid(element, Id);

                // Set "Tag" parameter.
                string ifcTag = Tag;
                if (!string.IsNullOrWhiteSpace(ifcTag))
                {
                    IFCPropertySet.AddParameterString(doc, element, category, "IfcTag", ifcTag, Id);
                }

                IFCFeatureElementSubtraction ifcFeatureElementSubtraction = FillsOpening;
                if (ifcFeatureElementSubtraction != null)
                {
                    IFCElement ifcElement = ifcFeatureElementSubtraction.VoidsElement;
                    if (ifcElement != null)
                    {
                        string ifcContainerName = ifcElement.Name;
                        IFCPropertySet.AddParameterString(doc, element, category, "IfcContainedInHost", ifcContainerName, Id);
                    }
                }

                // Create two parameters for each port: one for name, and one for GUID.
                // Note that Ports will never be null, as it is initialized the first time it is accessed.
                int numPorts = 0;
                foreach (IFCPort port in Ports)
                {
                    string name = port.Name;
                    string guid = port.GlobalId;

                    if (!string.IsNullOrWhiteSpace(name))
                    {
                        string parameterName = "IfcElement HasPorts Name " + ((numPorts == 0) ? "" : (numPorts + 1).ToString());
                        IFCPropertySet.AddParameterString(doc, element, category, parameterName, name, Id);
                    }

                    if (!string.IsNullOrWhiteSpace(guid))
                    {
                        string parameterName = "IfcElement HasPorts IfcGUID " + ((numPorts == 0) ? "" : (numPorts + 1).ToString());
                        IFCPropertySet.AddParameterString(doc, element, category, parameterName, guid, Id);
                    }

                    numPorts++;
                }
            }
        }
Beispiel #26
0
        /// <summary>
        /// Creates or populates Revit element params based on the information contained in this class.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The element.</param>
        protected override void CreateParametersInternal(Document doc, Element element)
        {
            base.CreateParametersInternal(doc, element);

            if (element != null)
            {
                // Set "Tag" parameter.
                string ifcTag = Tag;
                if (!string.IsNullOrWhiteSpace(ifcTag))
                {
                    IFCPropertySet.AddParameterString(doc, element, "IfcTag", ifcTag, Id);
                }
            }
        }
        /// <summary>
        /// Create quantities for a given element.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The element being created.</param>
        /// <param name="parameterGroupMap">The parameters of the element.  Cached for performance.</param>
        /// <returns>The name of the property set created, if it was created, and a Boolean value if it should be added to the property set list.</returns>
        public override Tuple <string, bool> CreatePropertySet(Document doc, Element element, IFCObjectDefinition objDef, IFCParameterSetByGroup parameterGroupMap)
        {
            Category category = IFCPropertySet.GetCategoryForParameterIfValid(element, Id);

            string quotedName = "\"" + Name + "\"";

            ISet <string> parametersCreated = new HashSet <string>();

            foreach (IFCPhysicalQuantity quantity in IFCQuantities.Values)
            {
                quantity.Create(doc, element, category, objDef, parameterGroupMap, Name, parametersCreated);
            }

            return(Tuple.Create(quotedName, true));
        }
        /// <summary>
        /// Creates or populates Revit element params based on the information contained in this class.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The element.</param>
        protected override void CreateParametersInternal(Document doc, Element element)
        {
            base.CreateParametersInternal(doc, element);

            // TODO: Set the value in ProjectInfo if element is not created.
            if (element != null)
            {
                // Set "ObjectTypeOverride" parameter.
                string longName = LongName;
                if (!string.IsNullOrWhiteSpace(longName))
                {
                    IFCPropertySet.AddParameterString(doc, element, "LongNameOverride", longName, Id);
                }
            }
        }
Beispiel #29
0
        /// <summary>
        /// Creates or populates Revit element params based on the information contained in this class.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The element.</param>
        protected override void CreateParametersInternal(Document doc, Element element)
        {
            base.CreateParametersInternal(doc, element);

            if (element != null)
            {
                // Set "ObjectTypeOverride" parameter.
                string objectTypeOverride = ObjectType;
                if (!string.IsNullOrWhiteSpace(objectTypeOverride))
                {
                    Category category = IFCPropertySet.GetCategoryForParameterIfValid(element, Id);
                    IFCPropertySet.AddParameterString(doc, element, category, this, "ObjectTypeOverride", objectTypeOverride, Id);
                }
            }
        }
Beispiel #30
0
        /// <summary>
        /// Creates or populates Revit element params based on the information contained in this class.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The element.</param>
        protected override void CreateParametersInternal(Document doc, Element element)
        {
            base.CreateParametersInternal(doc, element);

            if (element != null)
            {
                Category category = IFCPropertySet.GetCategoryForParameterIfValid(element, Id);
                if (category != null)
                {
                    Importer.TheProcessor.SetStringParameter(element, Id, BuiltInParameter.DOOR_OPERATION_TYPE, OperationType.ToString(), false);
                    Importer.TheProcessor.SetStringParameter(element, Id, BuiltInParameter.DOOR_CONSTRUCTION_TYPE, ConstructionType.ToString(), false);

                    IFCPropertySet.AddParameterString(doc, element, category, this, "IfcOperationType", OperationType.ToString(), Id);
                    IFCPropertySet.AddParameterString(doc, element, category, this, "IfcConstructionType", ConstructionType.ToString(), Id);
                }
            }
        }