Beispiel #1
0
        /// <summary>
        /// Import a collection of Geometry (Solid, Curve, Surface, etc) into Revit as an ImportInstance.
        /// </summary>
        /// <param name="geometry">A single piece of geometry</param>
        /// <returns></returns>
        public static ImportInstance ByGeometry(Autodesk.DesignScript.Geometry.Geometry geometry)
        {
            if (geometry == null)
            {
                throw new ArgumentNullException("geometry");
            }

            // Create a temp file name to export to
            var fn = System.IO.Path.GetTempPath() + Guid.NewGuid().ToString() + ".sat";

            var translation = Vector.ByCoordinates(0, 0, 0);

            Robustify(ref geometry, ref translation);

            var exported_fn = geometry.ExportToSAT(fn);

            return(new ImportInstance(exported_fn, translation.ToXyz()));
        }
Beispiel #2
0
        /// <summary>
        /// Import a collection of Geometry (Solid, Curve, Surface, etc) into Revit as an ImportInstance.
        /// </summary>
        /// <param name="geometry">A single piece of geometry</param>
        /// <returns></returns>
        public static ImportInstance ByGeometry(Autodesk.DesignScript.Geometry.Geometry geometry)
        {
            if (geometry == null)
            {
                throw new ArgumentNullException("geometry");
            }

            // transform geometry from dynamo unit system (m) to revit (ft)
            geometry = geometry.InHostUnits();

            var translation = Vector.ByCoordinates(0, 0, 0);

            Robustify(ref geometry, ref translation);

            // Export to temporary file
            var fn          = System.IO.Path.GetTempPath() + Guid.NewGuid().ToString() + ".sat";
            var exported_fn = geometry.ExportToSAT(fn);

            return(new ImportInstance(exported_fn, translation.ToXyz()));
        }