Example #1
0
        /// <summary>
        /// Add a string parameter to an element.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The element.</param>
        /// <param name="category">The category of the element.</param>
        /// <param name="objDef">The IFCObjectDefinition that created the element.</param>
        /// <param name="name">The enum corresponding to the parameter name.</param>
        /// <param name="parameterValue">The parameter value.</param>
        /// <param name="parameterSetId">The id of the containing parameter set, for reporting errors.</param>
        /// <returns>True if the parameter was successfully added, false otherwise.</returns>
        public static bool AddParameterString(Document doc, Element element, Category category, IFCObjectDefinition objDef, IFCSharedParameters name, string parameterValue, int parameterSetId)
        {
            if (doc == null || element == null || category == null || objDef == null)
            {
                return(false);
            }

            string parameterName = objDef.GetSharedParameterName(name, element is ElementType);

            bool?processedParameter = Importer.TheProcessor.ProcessParameter(objDef.Id, parameterSetId, parameterName, parameterValue);

            if (processedParameter.HasValue)
            {
                return(processedParameter.Value);
            }

            Parameter parameter = AddParameterBase(doc, element, category, parameterName, parameterSetId, SpecTypeId.String.Text);

            if (parameter == null)
            {
                return(false);
            }

            parameter.Set(parameterValue);
            return(true);
        }
        /// <summary>
        /// Add a string parameter to an element.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The element.</param>
        /// <param name="objDef">The IFCObjectDefinition that created the element.</param>
        /// <param name="name">The enum corresponding to the parameter name.</param>
        /// <param name="parameterValue">The parameter value.</param>
        /// <param name="parameterSetId">The id of the containing parameter set, for reporting errors.</param>
        /// <returns>True if the parameter was successfully added, false otherwise.</returns>
        public static bool AddParameterString(Document doc, Element element, IFCObjectDefinition objDef, IFCSharedParameters name, string parameterValue, int parameterSetId)
        {
            if (objDef == null)
            {
                return(false);
            }

            string parameterName = objDef.GetSharedParameterName(name);

            Parameter parameter = AddParameterBase(doc, element, parameterName, parameterSetId, ParameterType.Text);

            if (parameter == null)
            {
                return(false);
            }

            parameter.Set(parameterValue);
            return(true);
        }
        /// <summary>
        /// Add a string parameter to an element.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The element.</param>
        /// <param name="objDef">The IFCObjectDefinition that created the element.</param>
        /// <param name="name">The enum corresponding to the parameter name.</param>
        /// <param name="parameterValue">The parameter value.</param>
        /// <param name="parameterSetId">The id of the containing parameter set, for reporting errors.</param>
        /// <returns>True if the parameter was successfully added, false otherwise.</returns>
        public static bool AddParameterString(Document doc, Element element, IFCObjectDefinition objDef, IFCSharedParameters name, string parameterValue, int parameterSetId)
        {
            if (objDef == null)
                return false;

            string parameterName = objDef.GetSharedParameterName(name);

            Parameter parameter = AddParameterBase(doc, element, parameterName, parameterSetId, ParameterType.Text);
            if (parameter == null)
                return false;

            parameter.Set(parameterValue);
            return true;
        }