Example #1
0
 private static Autodesk.DesignScript.Geometry.Point InternalConvert(Autodesk.Revit.DB.Point geom)
 {
     return(geom.ToProtoType());
 }
Example #2
0
        private void RevitGeometryObjectFromGraphicItem(IGraphicItem item, ref List <GeometryObject> geoms)
        {
            var geom = item as PolyCurve;

            if (geom != null)
            {
                // We extract the curves explicitly rather than using PolyCurve's ToRevitType
                // extension method.  There is a potential issue with CurveLoop which causes
                // this method to introduce corrupt GNodes.
                foreach (var c in geom.Curves())
                {
                    // Tesselate the curve.  This greatly improves performance when
                    // we're dealing with NurbsCurve's with high knot count, commonly
                    // results of surf-surf intersections.
                    geoms.AddRange(Tessellate(c));
                }

                return;
            }

            var point = item as Point;

            if (point != null)
            {
                Autodesk.Revit.DB.Point pnt = null;
                try
                {
                    pnt = DocumentManager.Instance.CurrentUIApplication.Application.Create.NewPoint(point.ToXyz());
                }
                catch (Exception)
                {
                }
                finally
                {
                    if (pnt != null)
                    {
                        geoms.Add(pnt);
                    }
                }
                return;
            }

            var curve = item as Curve;

            if (curve != null)
            {
                // Tesselate the curve.  This greatly improves performance when
                // we're dealing with NurbsCurve's with high knot count, commonly
                // results of surf-surf intersections.
                geoms.AddRange(Tessellate(curve));
                return;
            }

            var surf = item as Surface;

            if (surf != null)
            {
                geoms.AddRange(Tessellate(surf));
                return;
            }

            var solid = item as Solid;

            if (solid != null)
            {
                geoms.AddRange(Tessellate(solid));
            }
        }
 private static Autodesk.DesignScript.Geometry.Point InternalConvert(Autodesk.Revit.DB.Point geom)
 {
     return(Point.ByCoordinates(geom.Coord.X, geom.Coord.Y, geom.Coord.Z));
 }