예제 #1
0
def unclamp():
    """(Un)Clamp the curve N"""
    global N, C, dialog

    if N.isClamped():
        N = N.unclamp()
    else:
        N = N.clamp()
    print(N)
    drawNurbs(N, color=red, linewidth=3, clear=False)
예제 #2
0
def removeAllKnots():
    """Remove all removable knots."""
    global N, dialog

    dialog.acceptData()
    res = dialog.results
    tol = res['tol']
    N = N.removeAllKnots(tol=tol)
    print(N)
    drawNurbs(N, color=blue)
    zoomAll()
예제 #3
0
def insertKnot():
    """Insert a knot in the knot vector of Nurbs curve N."""
    global N, dialog

    dialog.acceptData()
    res = dialog.results
    u = eval('[%s]' % res['u'])
    N = N.insertKnots(u)
    print(N)
    drawNurbs(N, color=red, knotsize=5)
    zoomAll()
예제 #4
0
def removeKnot():
    """Remove a knot from the knot vector of Nurbs curve N."""
    global N, dialog

    dialog.acceptData()
    res = dialog.results
    ur = res['ur']
    m = res['m']
    tol = res['tol']
    N = N.removeKnot(ur, m, tol)
    print(N)
    drawNurbs(N, color=blue, knotsize=5)
    zoomAll()
예제 #5
0
def decompose():
    """Decompose Nurbs curve N"""
    global N, C, dialog

    N1 = N.decompose()
    print(N1)
    drawNurbs(N1, color=black, knotsize=10, knot_values=False)
    zoomAll()
    C = BezierSpline(control=N1.coords.toCoords(), degree=N1.degree)
    #draw(C, color=blue)

    for i, Ci in enumerate(C.split()):
        print(Ci)
        Ci.setProp(i)
        draw(Ci, color=i, linewidth=5)
예제 #6
0
def showCurve(reverse=False):
    """Select and show a Nurbs curve."""
    global N, dialog

    if dialog:
        dialog.acceptData()
        res = dialog.results
        curv = res['curv']
    else:
        curv = ''

    N = createNurbs(curv)
    if reverse:
        N = N.reverse()
    print(N)
    drawNurbs(N, color=blue, knotsize=5)