Exemplo n.º 1
0
 public static RevSurface ToRhinoSurface(this DB.CylindricalFace face) => FromCylindricalSurface
 (
     face.Origin,
     face.get_Radius(0),
     face.get_Radius(1),
     face.Axis,
     face.get_Radius(0).GetLength(),
     face.GetBoundingBox()
 );
Exemplo n.º 2
0
 public static RevSurface ToRhinoSurface(DB.CylindricalFace face, double relativeTolerance) => FromCylindricalSurface
 (
     face.Origin,
     face.get_Radius(0),
     face.get_Radius(1),
     face.Axis,
     face.get_Radius(0).GetLength(),
     face.GetBoundingBox(),
     relativeTolerance
 );
Exemplo n.º 3
0
        public static Surface ExtractSurface(Autodesk.Revit.DB.CylindricalFace face, IEnumerable <PolyCurve> edgeLoops)
        {
            // Note: Internal representation of the cone
            // S(u, v) = Origin + cos(u)*Radius[0] + sin(u)*Radius[1] + v*Axis

            edgeLoops = edgeLoops.ToList();

            // Get some data from the face
            var axis = face.Axis.ToVector();
            var x    = face.get_Radius(0).ToVector();
            var y    = face.get_Radius(1).ToVector();
            var rad  = x.Length;
            var oax  = face.Origin.ToPoint();

            // project closest point on edge loop onto axis
            // this gives a more reliable origin as the revit origin
            // could be anywhere on the axis
            var pt         = edgeLoops.First().StartPoint;
            var dir        = pt.Subtract(oax.AsVector());
            var projLength = dir.AsVector().Dot(axis);
            var o          = oax.Add(axis.Normalized().Scale(projLength));

            // We don't know the start and end point of the cylindrical surface
            // so we use the maxLength of the edgeLoops as a conservative guess
            var maxLength = edgeLoops.Max(pc => pc.Length);

            // Get the "base point" of the cylinder
            var basePoint = o.Add(axis.Reverse().Scale(2 * maxLength));

            // Build the "base circle" of the cylinder
            var pl1 = Autodesk.DesignScript.Geometry.Plane.ByOriginXAxisYAxis(basePoint, x.Normalized(), y.Normalized());
            var c1  = Circle.ByPlaneRadius(pl1, rad);

            // extrude the cylindrical surface - again using the conservative maxLength
            return(c1.Extrude(axis.Scale(4 * maxLength)));
        }
Exemplo n.º 4
0
 static public bool IsVertical(CylindricalFace f)
 {
     return(IsVertical(f.Axis));
 }
Exemplo n.º 5
0
 public static RevSurface ToRhinoSurface(this DB.CylindricalFace face, double relativeTolerance) => RawDecoder.ToRhinoSurface(face, relativeTolerance);