Esempio n. 1
0
        /// <summary>
        /// Sets IFCValue aggregate attribute for the handle.
        /// </summary>
        /// <remarks>
        /// If values collection is null, the attribute will be unset.
        /// </remarks>
        /// <param name="handle">The handle.</param>
        /// <param name="name">The attribute name.</param>
        /// <param name="values">The values.</param>
        /// <exception cref="ArgumentException">If the name is null or empty.</exception>
        public static void SetAttribute(IFCAnyHandle handle, string name, ICollection <IFCData> values)
        {
            if (String.IsNullOrEmpty(name))
            {
                throw new ArgumentException("The name is empty.", "name");
            }

            if (values != null)
            {
                if (values.Contains(null))
                {
                    throw new ArgumentException("The collection contains null values.", "values");
                }

                IFCAggregate aggregateAttribute = handle.CreateAggregateAttribute(name);
                if (aggregateAttribute != null)
                {
                    foreach (IFCData value in values)
                    {
                        aggregateAttribute.Add(value);
                    }
                }
            }
        }