Beispiel #1
0
def main():
    to_delete = []

    rs.ProjectOsnaps(False)

    positive_object = rs.GetObject("select positive object", 16)
    negative_object = rs.GetObject("select negative object", 16)
    rs.HideObject(negative_object)

    polysurface, face = GetSubSurface("select tenon surface")
    to_delete.append(face)

    normal = rs.VectorUnitize(rs.SurfaceNormal(face, (0.5, 0.5)))
    plane = rs.PlaneFromNormal(rs.EvaluateSurface(face, 0.5, 0.5), normal)
    rs.ViewCPlane(plane=plane)
    rs.ProjectOsnaps(True)

    tenon_rects = rs.GetObjects(message="select tenon curves", filter=4)

    tenon_faces = []
    for rect in tenon_rects:
        tenon_faces.append(rs.AddPlanarSrf(rect)[0])

    rs.ShowObject(negative_object)

    rs.ProjectOsnaps(False)
    height_pt = rs.GetPoint("enter height point")

    # compule a vector normal to plane of the desired height
    extrude_vec_a = rs.EvaluateSurface(face, 0.5, 0.5)
    dist = rs.DistanceToPlane(plane, height_pt)
    extrude_vec_b = [dist * el for el in normal]
    extrude_vec_b = rs.VectorAdd(extrude_vec_a, extrude_vec_b)
    extrude_curve = rs.AddCurve((extrude_vec_a, extrude_vec_b))
    to_delete.append(extrude_curve)

    tenons = []
    for tenon_face in tenon_faces:
        tenon = rs.ExtrudeSurface(tenon_face, extrude_curve)
        tenons.append(tenon)

    rs.BooleanUnion([positive_object] + tenons, delete_input=False)
    rs.BooleanDifference([negative_object], tenons, delete_input=False)

    to_delete.append(positive_object)
    to_delete.append(negative_object)

    rs.DeleteObjects(to_delete)
    rs.DeleteObjects(tenon_faces)
    rs.DeleteObjects(tenons)
Beispiel #2
0
def EvaluateSurfaceParam(ref_srf, u_val, v_val):
    normalized = (u_val, v_val)
    parameter = rs.SurfaceParameter(ref_srf, normalized)

    print "Surface parameter: ", parameter

    return rs.EvaluateSurface(ref_srf, parameter[0], parameter[1])
    def distance(self):

        Udomain = rs.SurfaceDomain(self.strsrf, 0)
        Vdomain = rs.SurfaceDomain(self.strsrf, 1)

        stepU = (Udomain[1] - Udomain[0]) / self.intu
        stepV = (Vdomain[1] - Vdomain[0]) / self.intv

        #PLOT POINTS ON SURFACE)
        for i in range(self.intu + 1):
            for j in range(self.intv + 1):

                #define u and v in terms of step values and i and j
                u = Udomain[0] + stepU * i
                v = Vdomain[0] + stepV * j

                point = rs.EvaluateSurface(self.strsrf, u, v)

                crvParam = rs.CurveClosestPoint(self.Crv, point)
                crvPoints = rs.EvaluateCurve(self.Crv, crvParam)

                if rs.Distance(point, crvPoints) < 400:
                    self.dis[(i, j)] = rs.Distance(point, crvPoints)
                else:
                    self.dis[(i, j)] = 1300

        return self.dis
Beispiel #4
0
def uv_points_from_surface(srf, u_div, v_div):
    """Creates a nested uv point list from a surface.

    Parameters
    ----------
    srf : System.Guid
        The surface identifier.
    u_div : int
        Number of poinst in u direction
    v_div : int
        Number of poinst in v direction

    Returns
    -------
    list[list[:rhino:`Rhino.Geometry.Point3d`]]
        Points for every uv division.

    """
    u_domain = rs.SurfaceDomain(srf, 0)
    v_domain = rs.SurfaceDomain(srf, 1)
    u_step = (u_domain[1] - u_domain[0]) / (u_div - 1)
    v_step = (v_domain[1] - v_domain[0]) / (v_div - 1)

    uv_points = [[None for _ in range(v_div)] for _ in range(u_div)]

    for u in range(u_div):
        for v in range(v_div):
            uv = (u_domain[0] + u_step * u, v_domain[0] + v_step * v)
            uv_points[u][v] = rs.EvaluateSurface(srf, uv[0], uv[1])

    return uv_points
Beispiel #5
0
def addRail(obj):
    point1 = rs.EvaluateSurface(obj, 0, 0)
    vec = rs.CreateVector(0, 0, height)
    point2 = rs.CopyObject(point1, vec)
    line = rs.AddLine(point1, point2)
    if point2: rs.DeleteObjects(point2)
    return line
Beispiel #6
0
def uv_points_from_surface(srf, u_div, v_div):
    """Creates a nested uv point list from a surface.

    Parameters
    ----------
    srf : Rhino surface
        The object identifier
    u_div : int
        Number of poinst in u direction
    v_div : int
        Number of poinst in v direction

    Returns
    -------
    2D array (nested list)
        Points for every uv division.

    """
    u_domain = rs.SurfaceDomain(srf, 0)
    v_domain = rs.SurfaceDomain(srf, 1)
    u_step = (u_domain[1] - u_domain[0]) / (u_div - 1)
    v_step = (v_domain[1] - v_domain[0]) / (v_div - 1)

    uv_points = [[None for _ in range(v_div)] for _ in range(u_div)]

    for u in range(u_div):
        for v in range(v_div):
            uv = (u_domain[0] + u_step * u, v_domain[0] + v_step * v)
            uv_points[u][v] = rs.EvaluateSurface(srf, uv[0], uv[1])

    return uv_points
Beispiel #7
0
def create_quad_mesh(srf,u_div,v_div):
    
  
    
    u_domain = rs.SurfaceDomain(srf, 0)
    v_domain = rs.SurfaceDomain(srf, 1)
    u = (u_domain[1] - u_domain[0]) / (u_div - 1)
    v = (v_domain[1] - v_domain[0]) / (v_div - 1)
    
    #pts =  [[None for i in range(v_div)] for j in range(u_div)]
    mesh_pts = []
    for i in xrange(u_div):
        for j in xrange(v_div):
            #pts[i][j] = rs.EvaluateSurface (srf, u_domain[0] + u * i, v_domain[0] + v * j)
            mesh_pts.append(rs.EvaluateSurface (srf, u_domain[0] + u * i, v_domain[0] + v * j))
            
    faces = []        
    for i in xrange(u_div-1):
         for j in xrange(v_div-1):       
             faces.append(((i*v_div)+j,((i+1)*v_div)+j,((i+1)*v_div)+j+1,(i*v_div)+j+1))

    mesh = Mesh()
    
    for i,pt in enumerate(mesh_pts):
        mesh.add_vertex(str(i),{'x' : pt[0], 'y' : pt[1], 'z' : pt[2]})
    
    for face in faces:
        mesh.add_face(face)  
    
    return mesh        
Beispiel #8
0
def RandomPtOnSrf(srf):
    if srf is None:
        print "Not a surface"
        return

    dom_u = rs.SurfaceDomain(srf, 0)
    dom_v = rs.SurfaceDomain(srf, 1)

    counter = 0
    while True:
        pt_u = random.uniform(dom_u[0], dom_u[1])
        pt_v = random.uniform(dom_v[0], dom_v[1])
        pt = rs.EvaluateSurface(srf, pt_u, pt_v)

        if type(srf
                ) == rc.DocObjects.ObjectType.Extrusion:  #If extrusion objects
            temp = rs.coercesurface(srf)
            testSrf = temp.ToBrep()
        else:
            testSrf = srf
        testPt = testSrf.ClosestPoint(pt)
        d = rs.Distance(testPt, pt)
        if d > rs.UnitAbsoluteTolerance():
            return pt
        else:
            counter += 1
def ArrayPointsOnSurface(srf):
    ptList = []

    # Get the number of rows
    rows = 51

    # Get the number of columns
    cols = 51

    # Get the domain of the surface
    u, v = rs.SurfaceDomain(srf, 0), rs.SurfaceDomain(srf, 1)

    # Turn off redrawing (faster)
    rs.EnableRedraw(False)

    # Add the points
    for i in range(rows):
        s = u[0] + ((u[1] - u[0]) / (rows - 1)) * i
        for j in range(cols):
            t = v[0] + ((v[1] - v[0]) / (cols - 1)) * j
            pt = rs.EvaluateSurface(srf, s, t)
            obj = rs.AddPoint(pt)  # add the point
            ptList.append(obj)

    return ptList

    # Turn on redrawing
    rs.EnableRedraw(True)
Beispiel #10
0
def _point_in_surface(id):
    v = rh.BrepClosestPoint(id, rawu0)
    if v:
        return fromPt(v[0])
    else:
        u, v = rh.SurfaceDomain(id, 0), rh.SurfaceDomain(id, 1)
        return rh.EvaluateSurface(id, u[0], v[0])
Beispiel #11
0
def ArrayPointsOnSurface():
    # Get the surface object
    surface_id = rs.GetObject("Select surface", rs.filter.surface)
    if surface_id is None: return

    # Get the number of rows
    rows = rs.GetInteger("Number of rows", 2, 2)
    if rows is None: return

    # Get the number of columns
    columns = rs.GetInteger("Number of columns", 2, 2)
    if columns is None: return

    # Get the number of columns
    hairlength = rs.GetInteger("Length of Hair", 2, 2)
    if hairlength is None: return

    # Get the domain of the surface
    U = rs.SurfaceDomain(surface_id, 0)
    V = rs.SurfaceDomain(surface_id, 1)
    if U is None or V is None: return

    # Add the points
    for i in xrange(0, rows):
        param0 = U[0] + (((U[1] - U[0]) / (rows - 1)) * i)
        for j in xrange(0, columns):
            param1 = V[0] + (((V[1] - V[0]) / (columns - 1)) * j)
            point = rs.EvaluateSurface(surface_id, param0, param1)
            rs.AddPoint(point)
            arrNormal = rs.SurfaceNormal(surface_id, point)
            rs.AddLine(point, point - arrNormal * hairlength)
Beispiel #12
0
def remapping(mesh, surface_guid):
    """Remap a planar mesh in space uv on a spatial surface in space xyz.

    Parameters
    ----------
    planar_mesh : Mesh
        A planar mesh to remap on the surface.
    spatial_surface : Rhino surface guid
        A spatial Rhino surface on which to remap the mesh.

    Returns
    -------
    mesh: Mesh
        The remapped mesh.

    Raises
    ------
    -

    """

    for vkey in mesh.vertices():
        u, v, w = mesh.vertex_coordinates(vkey)
        x, y, z = rs.EvaluateSurface(surface_guid, u, v)
        attr = mesh.vertex[vkey]
        attr['x'] = x
        attr['y'] = y
        attr['z'] = z

    return mesh
Beispiel #13
0
def faces():
    surfaces = rs.GetObjects("select surfaces", filter=rs.filter.surface)

    points = [
        rs.EvaluateSurface(surface, *rs.SurfaceParameter(surface, (0.5, 0.5)))
        for surface in surfaces
    ]
    x = reduce(lambda s, point: s + point.X, points, 0) / len(points)
    y = reduce(lambda s, point: s + point.Y, points, 0) / len(points)
    z = reduce(lambda s, point: s + point.Z, points, 0) / len(points)

    # find the center of the object
    mass_center = rs.AddPoint(x, y, z)

    extrude_curves = {}
    # find the appropriate extrusion curve with the lowest dot product
    for surface in surfaces:
        surface_center = rs.EvaluateSurface(
            surface, *rs.SurfaceParameter(surface, (0.5, 0.5)))
        center_vector = rs.VectorCreate(surface_center, mass_center)

        normals = []
        normals.append(
            rs.SurfaceNormal(surface, rs.SurfaceParameter(surface,
                                                          (0.5, 0.5))))
        normals.append(-rs.SurfaceNormal(
            surface, rs.SurfaceParameter(surface, (0.5, 0.5))))

        if (rs.VectorDotProduct(normals[0], center_vector) <
                rs.VectorDotProduct(normals[1], center_vector)):
            extrude_curve = normals[0]
        else:
            extrude_curve = normals[1]
        extrude_curve = rs.VectorUnitize(extrude_curve)
        extrude_curve = rs.VectorScale(extrude_curve, 0.25)
        extrude_curve = [
            surface_center,
            rs.VectorAdd(surface_center, extrude_curve)
        ]
        extrude_curve = rs.AddCurve(extrude_curve)

        rs.ExtrudeSurface(surface, extrude_curve)
        rs.DeleteObject(extrude_curve)
        rs.DeleteObject(surface)

    rs.DeleteObject(mass_center)
Beispiel #14
0
def getSrfFrame(srf):
    domainU = rs.SurfaceDomain(srf, 0)
    domainV = rs.SurfaceDomain(srf, 1)
    u = domainU[1] / 2.0
    v = domainV[1] / 2.0
    point = rs.EvaluateSurface(srf, u, v)
    param = rs.SurfaceClosestPoint(srf, point)
    return rs.SurfaceFrame(srf, param)
Beispiel #15
0
def srfPtZPair(srf):
    domainU = rs.SurfaceDomain(srf, 0)
    domainV = rs.SurfaceDomain(srf, 1)
    u = domainU[1] / 2.0
    v = domainV[1] / 2.0
    point = rs.EvaluateSurface(srf, u, v)
    el = round(point.Z, 3)
    return [srf, el]
def get_dist(p):
    param = rs.SurfaceClosestPoint(surf, p)
    cp = rs.EvaluateSurface(surf, param[0], param[1])
    #n = rs.SurfaceNormal(surf,param)
    #dv = map_values(param,axis.Domain[0],axis.Domain[1],0,1)
    #r = (1-dv)*start_radius + dv*end_radius
    d = rs.Distance(p, cp) - thickness / 2.0
    return d
def evaluatedeviation( surface_id, threshold, sample ):
    r2point = rs.SurfaceClosestPoint(surface_id, sample)#Returns the UV parameter of the point on a surface that is closest to a test point.
    if not r2point: return
    r3point = rs.EvaluateSurface(surface_id, r2point[0], r2point[1])#evaluates the surface with UV parameters(U=[0] and v[1])
    if not r3point: return
    deviation = rs.Distance(r3point, sample)#sample refers to the previous point
    if deviation<=threshold: return#if deviation is less than threshold do nothing
    rs.AddPoint(sample)#if deviation is more than threshold add point
    rs.AddLine(sample, r3point)#if deviation is more than threshold add line
Beispiel #18
0
def makeBrep(srf):
    point1 = rs.EvaluateSurface(srf, 0, 0)
    vec = rs.CreateVector(0, 0, height)
    point2 = rs.CopyObject(point1, vec)
    line = rs.AddLine(point1, point2)
    brep = rs.ExtrudeSurface(srf, line)
    if point2: rs.DeleteObjects(point2)
    if line: rs.DeleteObjects(line)
    return brep
def RecursiveSphere(surface, generation):
    if generation > 0:
        domainU = rs.SurfaceDomain(surface, 0)
        domainV = rs.SurfaceDomain(surface, 1)
        randomU1 = random.uniform(domainU[0], domainU[1])
        randomV1 = random.uniform(domainV[0], domainV[1])
        randomU2 = random.uniform(domainU[0], domainU[1])
        randomV2 = random.uniform(domainV[0], domainV[1])
        randomU3 = random.uniform(domainU[0], domainU[1])
        randomV3 = random.uniform(domainV[0], domainV[1])
        point1 = rs.EvaluateSurface(surface, randomU1, randomV1)
        point2 = rs.EvaluateSurface(surface, randomU2, randomV2)
        point3 = rs.EvaluateSurface(surface, randomU3, randomV3)
        newsphere1 = NewSphere(point, 1000 / (4 - generation))
        newsphere2 = NewSphere(point, 1000 / (4 - generation))
        newsphere3 = NewSphere(point, 1000 / (4 - generation))
        RecursiveSphere(newsphere1, generation - 1)
        RecursiveSphere(newsphere2, generation - 1)
        RecursiveSphere(newsphere3, generation - 1)
Beispiel #20
0
def moveSrftoZ(srf):
    domainU = rs.SurfaceDomain(srf, 0)
    domainV = rs.SurfaceDomain(srf, 1)
    u = domainU[1] / 2.0
    v = domainV[1] / 2.0
    point = rs.EvaluateSurface(srf, u, v)
    # vec = [0, 0, point.Z]
    # vec = rs.VectorReverse(vec)
    # vec = [0,0,vec.Z]
    rs.MoveObjects(srf, rs.VectorReverse([0, 0, point.Z]))
Beispiel #21
0
 def inter_S_B(s, div, Lis, br):
     udiv = div
     vdiv = div
     srf = rs.AddSphere((s[1]), ((s[2]) * 2.5))
     u = rs.SurfaceDomain(srf, 0)
     v = rs.SurfaceDomain(srf, 1)
     pts = []
     for i in range(0, udiv + 1, 1):
         for j in range(0, vdiv + 1, 1):
             pt = (i / udiv, j / vdiv, 0)
             srfP = rs.SurfaceParameter(srf, pt)
             newpt = rs.EvaluateSurface(srf, srfP[0], srfP[1])
             pts.append(rs.AddPoint(newpt))
     lig = []
     lid = []
     for p in pts:
         lig.append(rs.AddLine((Lis[0])[1], p))
         lid.append(rs.AddLine((Lis[0])[2], p))
     ig = []
     id = []
     for i in lig:
         for u in br:
             if type(rs.CurveBrepIntersect(i, (u[0]))) == tuple:
                 ig.append((rs.CurveBrepIntersect(i, (u[0]))) +
                           (u[1], ))
             else:
                 ig.append((rs.CurveBrepIntersect(i, (u[0]))))
     for i in lid:
         for u in br:
             if type(rs.CurveBrepIntersect(i, (u[0]))) == tuple:
                 id.append((rs.CurveBrepIntersect(i, (u[0]))) +
                           (u[1], ))
             else:
                 id.append((rs.CurveBrepIntersect(i, (u[0]))))
     if len(id) == 0:
         self.AddRuntimeMessage(
             war,
             "it doesn't seem like there's any geometries connected")
         raise Exception('noGeo')
     intg = 0
     for i in ig:
         if type(i) is tuple:
             intg += (1 * (i[-1]))
     intd = 0
     for i in id:
         if type(i) is tuple:
             intd += (1 * (i[-1]))
     difg = len(ig) - intg
     if difg <= 0:
         difg = 0.1
     difd = len(id) - intd
     if difd <= 0:
         difd = 0.1
     return [(((math.log10(difg * 100 / len(ig))) * 35.3) - 70.6),
             (((math.log10(difd * 100 / len(id))) * 35.3) - 70.6)]
Beispiel #22
0
    def descent(self, points=None):
        """"""
        if not points:
            points = self.heightfield()

        tol = rs.UnitAbsoluteTolerance()

        descent = []

        if rs.IsPolysurface(self.guid):
            rs.EnableRedraw(False)
            faces = {}
            for p0 in points:
                p = p0[:]
                p[2] -= 2 * tol
                bcp = rs.BrepClosestPoint(self.guid, p)
                uv = bcp[1]
                index = bcp[2][1]
                try:
                    face = faces[index]
                except (TypeError, IndexError):
                    face = rs.ExtractSurface(self.guid, index, True)
                    faces[index] = face
                p1 = rs.EvaluateSurface(face, uv[0], uv[1])
                vector = [p1[_] - p0[_] for _ in range(3)]
                descent.append((p0, vector))
            rs.DeleteObjects(faces.values())
            rs.EnableRedraw(True)
        elif rs.IsSurface(self.guid):
            for p0 in points:
                p = p0[:]
                p[2] -= 2 * tol
                bcp = rs.BrepClosestPoint(self.guid, p)
                uv = bcp[1]
                p1 = rs.EvaluateSurface(self.guid, uv[0], uv[1])
                vector = [p1[_] - p0[_] for _ in range(3)]
                descent.append((p0, vector))
        else:
            raise RhinoSurfaceError('object is not a surface')

        return descent
Beispiel #23
0
def evaluatedeviation( surface_id, threshold, sample ):
    r2point = rs.SurfaceClosestPoint(surface_id, sample)
    if not r2point: return

    r3point = rs.EvaluateSurface(surface_id, r2point[0], r2point[1])
    if not r3point: return

    deviation = rs.Distance(r3point, sample)
    if deviation<=threshold: return

    rs.AddPoint(sample)
    rs.AddLine(sample, r3point)
Beispiel #24
0
def isoframe(srf, uv, spacing, vec):
    points = intervalpts(srf, uv, spacing)
    sweeps = []
    for i in points:
        point = rs.EvaluateSurface(srf, i[0], i[1])
        parameter = rs.SurfaceClosestPoint(srf, point)
        plane = rs.SurfaceFrame(srf, parameter)
        crv = rs.ExtractIsoCurve(srf, parameter, flipBool(uv))
        direction = rs.CurveTangent(crv, 0)
        newplane = rs.PlaneFromNormal(point, direction, plane.ZAxis)
        sweeps.append(sweepSec(crv, newplane, vec))
    return sweeps
Beispiel #25
0
    def heightfield(self, density=10, over_space=True):
        """"""
        try:
            du, dv = density
        except TypeError:
            du = density
            dv = density

        du = int(du)
        dv = int(dv)

        xyz = []

        rs.EnableRedraw(False)

        if rs.IsPolysurface(self.guid):
            faces = rs.ExplodePolysurfaces(self.guid)
        elif rs.IsSurface(self.guid):
            faces = [self.guid]
        else:
            raise RhinoSurfaceError('object is not a surface')

        if over_space:
            for guid in faces:
                face = RhinoSurface(guid)
                uv = face.space(density)
                for u, v in uv:
                    xyz.append(list(rs.EvaluateSurface(face.guid, u, v)))
        else:
            for guid in faces:
                bbox = rs.BoundingBox(guid)
                xmin = bbox[0][0]
                xmax = bbox[1][0]
                ymin = bbox[0][1]
                ymax = bbox[3][1]
                xstep = 1.0 * (xmax - xmin) / (du - 1)
                ystep = 1.0 * (ymax - ymin) / (dv - 1)
                seeds = []
                for i in xrange(du):
                    for j in xrange(dv):
                        seed = xmin + i * xstep, ymin + j * ystep, 0
                        seeds.append(seed)
                points = map(list,
                             rs.ProjectPointToSurface(seeds, guid, [0, 0, 1]))
                xyz += points

        if len(faces) > 1:
            rs.DeleteObjects(faces)

        rs.EnableRedraw(True)

        return xyz
def XYZ_To_UVW(srf_id, pXYZ):
    pUVW = []
    for point in pXYZ:
        uvClosest = rs.SurfaceClosestPoint(srf_id, point)
        ptClosest = rs.EvaluateSurface(srf_id, uvClosest)
        srfNormal = rs.SurfaceNormal(srf_id, uvClosest)
        pPositive = rs.PointAdd(ptClosest, srfNormal)
        pNegative = rs.PointSubtract(ptClosest, srfNormal)
        fDistance = rs.Distance(ptClosest, point)
        if rs.Distance(point,pPositive) > rs.Distance(point, pNegative):
            fDistance = -fDistance
        pUVW.append( (uvClosest[0], uvClosest[1], fDistance) )
    return pUVW
Beispiel #27
0
def ConvertToUVW(srf_id, xyz_points):
    uvw_points = []
    for point in xyz_points:
        Suv = rs.SurfaceClosestPoint(srf_id, point)
        Sxyz = rs.EvaluateSurface(srf_id, Suv)
        Snormal = rs.SurfaceNormal(srf_id, Suv)
        dirPos = rs.PointAdd(Sxyz, Snormal)
        dirNeg = rs.PointSubtract(Sxyz, Snormal)
        Sdist = rs.Distance(Sxyz, point)
        if rs.Distance(point, dirPos) > rs.Distance(point, dirNeg):
            Sdist = -Sdist
        uvw_points.append((Suv(0), Suv(1), Sdist))
    return uvw_points
Beispiel #28
0
def RandomPtOnSrf(srf):
    if srf is None:
        print "Not a surface"
        return
    dom_u = rs.SurfaceDomain(srf, 0)
    dom_v = rs.SurfaceDomain(srf, 1)
    
    while True:
        pt_u = random.uniform(dom_u[0], dom_u[1])
        pt_v = random.uniform(dom_v[0], dom_v[1])
        pt = rs.EvaluateSurface(srf, pt_u, pt_v)
        if rs.IsPointOnSurface(srf, pt):
            return pt
def RecurseSurface(srf_id, u0, u1, v0, v1):
    A = rs.EvaluateSurface(srf_id, (u0, v0))
    B = rs.EvaluateSurface(srf_id, (u1, v0))
    C = rs.EvaluateSurface(srf_id, (u1, v1))
    D = rs.EvaluateSurface(srf_id, (u0, v1))

    gauss = SurfaceCurvature(srf_id, u0, u1, v0, v1)
    diag = rs.Distance(A, C)
    factor = abs(diag * gauss)

    print "Gauss:", round(gauss, 4),
    print "    Diagonal:", round(diag, 2),
    print "    Factor:", round(factor, 3)

    if factor < 10:
        rs.AddCurve((A, B, C, D, A), 3)
    else:
        um = u0 + 0.5 * (u1 - u0)
        vm = v0 + 0.5 * (v1 - v0)
        RecurseSurface(srf_id, u0, um, v0, vm)
        RecurseSurface(srf_id, um, u1, v0, vm)
        RecurseSurface(srf_id, u0, um, vm, v1)
        RecurseSurface(srf_id, um, u1, vm, v1)
Beispiel #30
0
    def point_uv_to_xyz(self, uv):
        """Return the XYZ point from the inverse mapping of a UV point based on the UV parameterisation of the surface.

        Parameters
        ----------
        uv : list
            (u, v, 0) coordinates.

        Returns
        -------
        list
            The (x, y, z) coordinates of the inverse-mapped point.

        """
        return tuple(rs.EvaluateSurface(self.guid, *uv))