Esempio n. 1
0
        /// <summary>
        /// A new IfcPoint instance given a vector.
        /// </summary>
        /// <typeparam name="T">The IfcPoint type</typeparam>
        /// <param name="s">The model</param>
        /// <param name="v">The vector</param>
        /// <param name="scaleUp">Whether to scale up the vector onto model scale</param>
        /// <returns>A new point</returns>
        public static T NewIfcPoint <T>(this IModel s, XbimVector3D v, bool scaleUp = false) where T : IIfcCartesianPoint, IInstantiableEntity
        {
            var p           = s.Instances.New <T>();
            var coordinates = scaleUp ? v.ToDoubleModelScale(s.ModelFactors) : v.ToDouble();

            foreach (var c in coordinates)
            {
                p.Coordinates.Add(c);
            }

            return(p);
        }
Esempio n. 2
0
        /// <summary>
        /// A new IfcDirection instance given a vector.
        /// </summary>
        /// <typeparam name="T">The IfcPoint type</typeparam>
        /// <param name="s">The model</param>
        /// <param name="v">The vector</param>
        /// <param name="scaleUp">Whether to scale up the vector onto model scale</param>
        /// <returns>A new direction</returns>
        public static T NewIfcDirection <T>(this IModel s, XbimVector3D v, bool scaleUp = false) where T : IIfcDirection, IInstantiableEntity
        {
            var d           = s.Instances.New <T>();
            var coordinates = scaleUp ? v.ToDoubleModelScale(s.ModelFactors) : v.ToDouble();

            foreach (var c in coordinates)
            {
                d.DirectionRatios.Add(c);
            }

            return(d);
        }