예제 #1
0
        public static Line FromRevit(Autodesk.Revit.DB.Line revitLine)
        {
            if (revitLine == null)
            {
                throw new ArgumentNullException();
            }

            var line = new Line
            {
                StartPoint = PointInterop.FromRevit(revitLine.GetEndPoint(0)),
                EndPoint   = PointInterop.FromRevit(revitLine.GetEndPoint(1))
            };

            return(line);
        }
        public static Wall FromRevit(Autodesk.Revit.DB.Wall revitWall)
        {
            var wall = new Wall();

            wall.Thickness = revitWall.Width;

            // note : this will only work with unconnected walls
            // futher logic would be needed to handle the other cases
            wall.Height = revitWall.get_Parameter(Autodesk.Revit.DB.BuiltInParameter.WALL_USER_HEIGHT_PARAM).AsDouble();

            // get the base curve
            var locationCurve = revitWall.Location as Autodesk.Revit.DB.LocationCurve;

            wall.BaseLine = new Line()
            {
                StartPoint = PointInterop.FromRevit(locationCurve.Curve.GetEndPoint(0)),
                EndPoint   = PointInterop.FromRevit(locationCurve.Curve.GetEndPoint(1))
            };

            return(wall);
        }