Beispiel #1
0
def pointsToSurface(listOne, listTwo, sList):
    listOneCopy = list(listOne)
    listTwoCopy = list(listTwo)
    while True:
        if (len(listOneCopy) < 2 or len(listTwoCopy) < 2):
            break
        else:
            line = rs.AddLine(listOneCopy[0], listOneCopy[1])
            sOne = rs.ExtrudeCurvePoint(line, listTwoCopy[0])
            rs.DeleteObject(line)
            line = rs.AddLine(listTwoCopy[0], listTwoCopy[1])
            sTwo = rs.ExtrudeCurvePoint(line, listOneCopy[1])
            rs.DeleteObject(line)
            listOneCopy.pop(0)
            listTwoCopy.pop(0)
            sList.append(sOne)
            sList.append(sTwo)
Beispiel #2
0
def RunCommand(is_interactive):
    global params

    center = rs.GetPoint(message="Select center point")

    n = rs.GetInteger(message="Number of teeth",
                      number=params["n"], minimum=4)

    m = rs.GetReal(message="Gear module",
                   number=params["m"])

    pa = rs.GetReal(message="Pressure angle",
                    number=params["pa"], minimum=0, maximum=45)

    ca = rs.GetReal(message="Cone angle",
                    number=params["ca"], minimum=0, maximum=180)

    bool_opts = rs.GetBoolean(message="Output options",
                              items=(("PitchCone", "No", "Yes"),),
                              defaults=(params["pc"],))

    if None in [center, n, m, pa, ca, bool_opts]:
        return 1  # Cancel

    pc = bool_opts[0]

    params["n"] = n
    params["m"] = m
    params["pa"] = pa
    params["ca"] = ca
    params["pc"] = pc

    cplane = rs.ViewCPlane()  # Get current CPlane
    cplane = rs.MovePlane(cplane, center)
    xform = rs.XformChangeBasis(cplane, rs.WorldXYPlane())

    rs.EnableRedraw(False)
    old_plane = rs.ViewCPlane(plane=rs.WorldXYPlane())

    gear = generate_gear_crv(teeth=params["n"],
                             module=params["m"],
                             pressure_angle=params["pa"],
                             cone_angle=params["ca"])

    # Calculate pitch cone tip
    cone_tip = [0, 0, (m * n / 2) / tan(radians(ca/2))]
    bevel_gear_srf = rs.ExtrudeCurvePoint(gear, cone_tip)

    rs.ViewCPlane(plane=old_plane)
    rs.TransformObjects(bevel_gear_srf, xform)

    if pc:
        circle = generate_pitch_circle_crv(teeth=params["n"],
                                           module=params["m"])
        pitch_cone_srf = rs.ExtrudeCurvePoint(circle, cone_tip)
        rs.TransformObjects(pitch_cone_srf, xform)
        rs.DeleteObjects([gear, circle])
        rs.SelectObjects([bevel_gear_srf, pitch_cone_srf])
    else:
        rs.DeleteObject(gear)
        rs.SelectObjects(bevel_gear_srf)

    rs.EnableRedraw(True)

    return 0  # Success
Beispiel #3
0
import rhinoscriptsyntax as rs
import random

pickedCurves = rs.GetObjects("pick some curves", 4)
pickedPoints = rs.GetObjects("pick some points", 1)

for curve in pickedCurves :
    distances = []
    for point in pickedPoints :
        thisDistance = rs.Distance(point, rs.CurveMidPoint(curve))
        distances.append(thisDistance)
    distancesAndPointsPaired = zip(distances, pickedPoints)
    #print distancesAndPointsPaired
    distancesAndPointsPaired.sort()
    closestPoint = distancesAndPointsPaired[0][1]
    rs.ExtrudeCurvePoint(curve, closestPoint)
Beispiel #4
0
def loft_curve_point(curve, point):
    p = rh.PointCoordinates(point.realize()._ref)
    curve_ref = curve.realize()
    return and_delete(
        adequate_ref(curve_ref.map(lambda c: rh.ExtrudeCurvePoint(c, p))),
        curve, point)