コード例 #1
0
ファイル: srftest.py プロジェクト: tkahng/ironpythontest
def divCrv(srf, pts, uv, vec, eq):
    param = map(lambda x: rs.SurfaceClosestPoint(srf, x), pts)
    railcrv = map(lambda x: rs.ExtractIsoCurve(srf, x, trp.intFlipBool(uv)),
                  param)
    frames = map(lambda x, y, z: sweepRail(srf, x, vec, y, z), railcrv, param,
                 pts)
    # rs.DeleteObject(domaincrv)
    return railcrv
コード例 #2
0
ファイル: srftest.py プロジェクト: tkahng/ironpythontest
def getDiv(srf, dist, uv, eq):
    domaincrv = rs.ExtractIsoCurve(srf, [0, 0], uv)
    crvLen = rs.CurveLength(domaincrv)
    newdist = setDist(crvLen, dist, eq)
    pts = rs.DivideCurveLength(domaincrv, newdist)
    pts.pop(0)
    pts.pop(-1)
    rs.DeleteObject(domaincrv)
    return pts
コード例 #3
0
ファイル: frameSrf.py プロジェクト: tkahng/ironpythontest
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
コード例 #4
0
def offsetCurveOnSurface():
    curve = rs.GetObject("sel curve", 4)
    num = rs.GetReal("Offset Distance:", 200)
    points = rs.DivideCurve(curve, num)
    surface = rs.GetObject("sel surface", 8)
    offset_ptsA0 = []
    offset_ptsA1 = []
    offset_ptsB0 = []
    offset_ptsB1 = []

    rs.EnableRedraw(False)
    for point in points:
        parameter = rs.SurfaceClosestPoint(surface, point)
        crv = rs.ExtractIsoCurve(surface, parameter, 2)
        #create sphere at end
        try:
            offsetEndPtsA = offsetCrvEndPt(crv[0], num)
            rs.DeleteObject(crv[0])
        except IndexError:
            offsetEndPtsA = None

        try:
            offsetEndPtsB = offsetCrvEndPt(crv[1], num)
            rs.DeleteObject(crv[1])
        except IndexError:
            offsetEndPtsB = None
        #offset_points.append(offset_point)

        if not (offsetEndPtsA is None):
            offset_ptsA0.append(offsetEndPtsA[0])
            offset_ptsA1.append(offsetEndPtsA[1])
        if not (offsetEndPtsB is None):
            offset_ptsB0.append(offsetEndPtsB[0])
            offset_ptsB1.append(offsetEndPtsB[1])

    rs.EnableRedraw(True)
    rs.AddInterpCurve(offset_ptsA0)
    rs.AddInterpCurve(offset_ptsA1)
    rs.AddInterpCurve(offset_ptsB0)
    rs.AddInterpCurve(offset_ptsB1)
コード例 #5
0
def equidistanceoffset():
    srf_id = rs.GetObject("Pick surface to offset", 8, True, True)
    if not srf_id: return

    offset = rs.GetReal("Offset distance", 1.0, 0.0)
    if not offset: return

    udomain = rs.SurfaceDomain(srf_id, 0)
    ustep = (udomain[1] - udomain[0]) / 200
    rs.EnableRedraw(False)

    offsetvertices = []
    u = udomain[0]
    while u <= (udomain[1] + 0.5 * ustep):
        isocurves = rs.ExtractIsoCurve(srf_id, (u, 0), 1)
        if isocurves:
            t = BSearchCurve(isocurves[0], offset, 0.001)
            if t is not None:
                offsetvertices.append(rs.EvaluateCurve(isocurves[0], t))
            rs.DeleteObjects(isocurves)
        u += ustep

    if offsetvertices: rs.AddInterpCrvOnSrf(srf_id, offsetvertices)
    rs.EnableRedraw(True)
コード例 #6
0
ファイル: srftest.py プロジェクト: tkahng/ironpythontest
def getEnds(srf, uv):
    domaincrv = rs.ExtractIsoCurve(srf, [0, 0], uv)
    return [rs.CurveStartPoint(domaincrv), rs.CurveEndPoint(domaincrv)]
    rs.DeleteObject(domaincrv)