Ejemplo n.º 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)
Ejemplo n.º 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()
Ejemplo n.º 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()
Ejemplo n.º 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()
Ejemplo n.º 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)
Ejemplo n.º 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)