コード例 #1
0
    def left(spt, ept):
        l_base = rs.PointAdd(spt, bh)
        l_height = rs.PointAdd(ept, bh)
        rs.AddCylinder(l_base, l_height, radius)

        #build columns
        for i in range(b_lst[3]):
            rs.AddCylinder(spt, l_base, b_lst[4])
            spt = rs.PointAdd(spt, col_spacing)
            l_base = rs.PointAdd(l_base, col_spacing)
コード例 #2
0
 def right(spt, ept):
     width = [stair_width, 0, 0]
     r_base = rs.PointAdd(rs.PointAdd(spt, bh), width)
     r_height = rs.PointAdd(rs.PointAdd(ept, bh), width)
     rs.AddCylinder(r_base, r_height, radius)
     #build columns
     for i in range(b_lst[3]):
         rs.AddCylinder(rs.PointAdd(spt, width), r_base, b_lst[4])
         spt = rs.PointAdd(spt, col_spacing)
         r_base = rs.PointAdd(r_base, col_spacing)
コード例 #3
0
 def __init__(self, x=0, y=0, z=0):
     rt.Turtle.__init__(self)
     self._shape = rs.AddCylinder(rg.Plane.WorldXY, 4, 1, cap=True)
     #self._shape =rs.GetObject("Select the runner")
     self.setColor(255, 0, 0)
     self.penUp()
     self.goto(x, y, z)
コード例 #4
0
 def right():
     r_curve = rs.CopyObject(curve, [0, 0, b_lst[1]])
     rs.AddPipe(r_curve, 0, b_lst[2], cap=1)
     rs.DeleteObjects(r_curve)
     pts = [rs.EvaluateCurve(curve, t) for t in ref_pts]
     for i in range(b_lst[3]):
         base = rs.PointAdd(pts[i], [0, 0, b_lst[1]])
         rs.AddCylinder(pts[i], base, b_lst[4])
コード例 #5
0
ファイル: rhino3dScript.py プロジェクト: rameshwara/Siemens
def createCylinder():
    cylinderRadius = rs.GetReal(message='Of what radius? ', minimum=0.1)
    x1, y1, z1 = [float(n) for n in raw_input('From where?: "x y z"').split()]
    x2, y2, z2 = [float(n) for n in raw_input('To where?: "x y z"').split()]
    id = rs.AddCylinder((x1, y1, z1), (x2, y2, z2), cylinderRadius, cap=True)
    cylinders.append(id)
    rs.SetUserText(id, key="Cylinder", value=str(len(cylinders)))
    print('Done.')
コード例 #6
0
    def drawEdge(self,nodes):
        p1 = self.posVec
        p2 = nodes[self.parentID].posVec
        self.geom.append(rs.AddLine(p1,p2))

        pNormal = rs.VectorSubtract(p2,p1)
        height = rs.VectorLength(pNormal)
        plane = rs.PlaneFromNormal(p1,pNormal)
        radius = self.radius
        self.geom.append(rs.AddCylinder(plane,height,radius))
コード例 #7
0
def PlaceCircle(x, y, radius, layer):
    if (layer != 1) and (layer != 16):
        return None
    object = rs.AddCylinder((x, y, 0), 0.1, radius)
    index = rs.AddMaterialToObject(object)
    if layer == 1:
        rs.MaterialColor(index, (255, 0, 0))
    if layer == 16:
        rs.MaterialColor(index, (0, 0, 255))
        rs.MoveObject(object, (0, 0, -boardThickness - 0.1))
    return object
 def cylinders(self, num):
     a = rs.GetPoint("Enter start point")
     p = rs.AddPoint(a)
     h = rs.GetReal("Enter the height")
     for i in range(0, num):
         a.X = a.X + 4
         h = h + 5
         r = 2
         cylinder = rs.AddCylinder(a, h, r)
         color02 = [i * 3, i * 2, 255 - i * 6]  #magenta
         rs.ObjectColor(cylinder, color02)
コード例 #9
0
def CreateCircle():
    # user input for sizes
    # center = rs.GetPoint("Center point of circle")
    total_num = rs.GetInteger("total number of circs? ")

    for i in range(total_num):
        x = random.randint(-30, 30)
        y = random.randint(-30, 30)
        z = random.randint(0, 15)
        radius = random.randint(5, 20)
        height = random.randint(5, 50)
        objectID = rs.AddCylinder((x, y, z), height, radius)
        print objectID
コード例 #10
0
def main():

    cyls = []
    radius = 0

    gname = "Enclosure"

    extantGroups = rs.GroupNames()
    print "groups: ", extantGroups
    enclosures = [s for s in extantGroups if "Enclosure" in s]
    print "enclosures: ", enclosures

    if rs.IsGroup("Enclosure"):
        num = len(enclosures)
        gname += "_" + ` num `
    encGroup = rs.AddGroup(gname)
    print "group: ", encGroup

    focus = rs.GetPoint("center of fence")
    if (focus is None): return
    rpt = rs.GetPoint("enclosure radius", focus)
    if (rpt is None): return
    else:
        radius = (rpt - focus).Length
        rs.AddObjectsToGroup(rs.AddCircle(focus, radius), encGroup)

    count = rs.GetInteger("number of cylinders")
    if (count is None): return
    cyldiam = rs.GetReal("cylinder diameter")
    if (cyldiam is None): return
    minheight = rs.GetReal("minimum height")
    if (minheight is None): return
    maxheight = rs.GetReal("maximum height")
    if (maxheight is None): return
    #   arcjitter = rs.GetReal("amount of arc jitter")
    #   if (arcjitter is None): return
    #   radialjitter = rs.GetReal("amount of radial jitter")
    #   if (radialjitter is None): return

    for i in range(count):
        cyl = rs.AddCylinder(rpt, random.uniform(minheight, maxheight),
                             cyldiam / 2, True)
        rs.RotateObject(cyl, focus, (360 / count) * (i + 1))
        cyls.append(cyl)
    if cyls: rs.AddObjectsToGroup(cyls, encGroup)
    print "Enclosure built:"
    print "focus: (", focus, ")"
    print "radius:", radius
    print "cylinders:", count, "ranging from", minheight, "to", maxheight, "units in length."
コード例 #11
0
ファイル: RSTurtle.py プロジェクト: alireza116/RSTurtle
 def cylinder(self, r, h):
     p = rs.rs.PointCoordinates(self.point)
     cylinder = rs.AddCylinder(p, h, r)
コード例 #12
0
rs.DeleteObjects(rs.ObjectsByLayer('Default'))
filepath = '/Users/time/Documents/UW/04_code/dmg_helmholtz/data/panel_geometry.json'

with open(filepath, 'r') as fp:
    data = json.load(fp)

rs.AddTextDot('S', data['src'])

hr_pts = data['hr_pts']
nr = data['nr']
nl = data['nl']
br = data['br']
bl = data['bl']
for i, hr_pt in enumerate(hr_pts):
    r = nr[i]
    npt = [hr_pt[0], hr_pt[1], hr_pt[2] - nl[i]]
    # bpt = [hr_pt[0], hr_pt[1], hr_pt[2] - nl = bl]
    rs.AddCylinder(hr_pt, -nl[i], r, cap=False)
    rs.AddCylinder(npt, -bl[i], br[i], cap=False)

recs = data['recs']
ps = data['pressures']
minp = min(ps)
maxp = max(ps)
for i, rec in enumerate(recs):
    pt = rs.AddPoint(rec)
    p = ps[i]
    i = (((p - minp) * (1 - 0)) / (maxp - minp)) + 0
    color = i_to_rgb(i)
    rs.ObjectColor(pt, color)
コード例 #13
0
def PlaceCircle(x, y, radius, layer):
    if (layer != 1) and (layer != 16):
        return None
    object = rs.AddCylinder((x, y, 0), 0.1, radius)
    ColorAndMove(object, layer)
    return object
コード例 #14
0
fscrv = [pfCurves,ftipArc]
fscrv = flatten(fscrv)
"""
bfCurves = []
bbCurves = []

_tipArc = rs.ProjectCurveToSurface(_tipArc, cylsrf[8], (0, 0, -1))
for i in range(8):
    bfCurves.append(pfCurves[i])
    bbCurves.append(pbCurves[i])

bfCurves.append(_tipArc)
bbCurves.append(_tipArc)

faceSurface = rs.AddLoftSrf(bfCurves)
backSurface = rs.AddLoftSrf(bbCurves)

bSrf = rs.JoinSurfaces((faceSurface, backSurface))
allBlades = []

for i in range(Z):
    allBlades.append(
        rs.RotateObject(bSrf, cPoint, (360 / Z) * i, (1, 0, 0), True))

hub = rs.AddCylinder(rs.WorldYZPlane(), hl, .2 * D / 2)
hub = rs.MoveObject(hub, (-hl / 1.5, 0, 0))

Geo = [allBlades, hub]
Geo = flatten(Geo)
コード例 #15
0
    def __generate_individual_levels(self, crosssectionplane, loft_height):
        cplane = rs.ViewCPlane(None, crosssectionplane)
        level_points = []
        spikiness = self.emotion_properties["spikiness"]  # max spikiness = 1
        scaling_factor_aid = 0.2 * spikiness
        #draws profile curves on each spine level
        for i in xrange(self.emotion_properties["horizontal_AR"][loft_height]
                        ["points_in_curve"]):
            scaling_factor = 1 - scaling_factor_aid if i % 2 == 0 else 1  #ranges from a difference in 0.8 and 1 (no difference)
            angle = 2 * math.pi * i / self.emotion_properties["horizontal_AR"][
                loft_height]["points_in_curve"]
            x_point = scaling_factor * self.dimensions[
                "actual_height"] * self.dimensions[
                    "vertical_AR"] * self.emotion_properties["vertical_AR"][
                        loft_height] * self.emotion_properties[
                            "horizontal_AR"][loft_height][
                                "level_horizontal_AR_x"] * math.cos(angle) / 2
            y_point = scaling_factor * self.dimensions[
                "actual_height"] * self.dimensions[
                    "vertical_AR"] * self.emotion_properties["vertical_AR"][
                        loft_height] * self.emotion_properties[
                            "horizontal_AR"][loft_height][
                                "level_horizontal_AR_y"] * math.sin(angle) / 2
            z_point = 0
            point = rs.XformCPlaneToWorld([x_point, y_point, z_point], cplane)
            level_points.append(rs.AddPoint(point))

        connecting_point = level_points[0]
        level_points.append(rs.AddPoint(connecting_point))

        level_curve = rs.AddCurve(
            level_points, self.emotion_properties["horizontal_AR"][str(
                loft_height)]["horizontal_smoothness"])

        #twists curve start point 180deg if it is below the spine_x point (to make sure loft doesn't twist)
        crvStart = rs.CurveStartPoint(level_curve)
        if crvStart[0] <= self.x_points[int(loft_height) - 1]:
            crvDomain = rs.CurveDomain(level_curve)
            rs.CurveSeam(level_curve, (crvDomain[0] + crvDomain[1]) / 2)

        # add planar surface to top and bottom of bottle
        if loft_height == "5" or loft_height == "1":
            rs.AddPlanarSrf(level_curve)

        # hide curves and points on level profiles
        rs.HideObjects(level_curve)
        rs.HideObjects(level_points)

        # object finishing features
        if (self.object_id == "Bottle"):
            if loft_height == "5":
                rs.AddCylinder(cplane, 14.5, 7.4, cap=True)

        if (self.object_id == "Chair"):
            if loft_height == "5":
                rs.AddCylinder(cplane, 14.5, 7.4, cap=True)

        if (self.object_id == "Jewelry"):
            if loft_height == "5":
                major_radius = 5.0
                minor_radius = major_radius - 1.5
                # rotated_cplane = rs.RotatePlane(cplane, 45.0, cplane.XAxis)
                direction = rs.AddPoint((0, 0, 1))
                rs.AddTorus(cplane.Origin, major_radius, minor_radius,
                            direction)

        if (self.object_id == "Totem"):
            if loft_height == "1":
                base_width = 80
                base_length = 60
                base_depth = -10
                base_points = [(-base_width / 2, -base_length / 2, 0),
                               (base_width / 2, -base_length / 2, 0),
                               (base_width / 2, base_length / 2, 0),
                               (-base_width / 2, base_length / 2, 0),
                               (-base_width / 2, -base_length / 2, base_depth),
                               (base_width / 2, -base_length / 2, base_depth),
                               (base_width / 2, base_length / 2, base_depth),
                               (-base_width / 2, base_length / 2, base_depth)]
                rs.AddBox(base_points)

        return level_curve
コード例 #16
0
def make_hinge(num_knuckles, knuckle_height, knuckle_radius, thickness,
               leaf_length, gap, add_vents):

    origin = [0, 0, 0]
    hinge_height = num_knuckles * knuckle_height

    ######################################################################
    # Make pin with caps

    cap_radius = knuckle_radius - 0.5 * thickness - gap
    cap_height = thickness

    cap_bottom = rs.AddCylinder(origin, cap_height, cap_radius)

    cap_top = rs.AddCylinder([0, 0, hinge_height - cap_height], cap_height,
                             cap_radius)

    pin_radius = knuckle_radius - (gap + thickness)

    pin = rs.AddCylinder(origin, hinge_height, pin_radius)

    pin = rs.BooleanUnion([pin, cap_bottom, cap_top])

    ######################################################################
    # Make knuckle and holes

    right_knuckle = rs.AddCylinder(origin, hinge_height, knuckle_radius)

    knuckle_pin_hole = rs.AddCylinder(origin, hinge_height,
                                      knuckle_radius - thickness)

    knuckle_bottom_hole = rs.AddCylinder(origin, cap_height + gap,
                                         cap_radius + gap)

    knuckle_top_hole = rs.AddCylinder([0, 0, hinge_height - cap_height - gap],
                                      cap_height + gap, cap_radius + gap)

    ######################################################################
    # Make leaves

    right_p0 = (0, knuckle_radius, 0)
    right_p1 = (leaf_length, knuckle_radius - thickness, hinge_height)

    right_leaf = rs.AddBox(mz.box_verts_from_corners(right_p0, right_p1))

    right_leaf = rs.BooleanUnion([right_knuckle, right_leaf])

    right_leaf, = rs.BooleanDifference(
        [right_leaf],
        [knuckle_pin_hole, knuckle_bottom_hole, knuckle_top_hole])

    mirror_leaf = rs.XformMirror(origin, (1, 0, 0))

    left_leaf = rs.TransformObject(right_leaf, mirror_leaf, True)

    ######################################################################
    # Cut out alternating knuckles

    z0 = 0
    sz = knuckle_radius + gap

    left_boxes = []
    right_boxes = []

    vent_height = knuckle_height - 4 * thickness

    for stage in range(num_knuckles):

        z1 = z0 + knuckle_height

        if stage == 0:
            cur_z0 = z0
        else:
            cur_z0 = z0 - 0.5 * gap

        if stage == num_knuckles - 1:
            cur_z1 = z1
        else:
            cur_z1 = z1 + 0.5 * gap

        knuckle_box = rs.AddBox(
            mz.box_verts_from_corners((-sz, -sz, cur_z0), (sz, sz, cur_z1)))

        if stage % 2 == 0:
            left_boxes.append(knuckle_box)
        else:
            right_boxes.append(knuckle_box)

        if add_vents:
            zmid = z0 + 0.5 * knuckle_height
            za = zmid - 0.5 * vent_height
            zb = zmid + 0.5 * vent_height
            mid_box = rs.AddBox(
                mz.box_verts_from_corners((-sz, -pin_radius - gap, za),
                                          (sz, pin_radius + gap, zb)))

            if stage % 2 == 0:
                right_boxes.append(mid_box)
            else:
                left_boxes.append(mid_box)

        z0 += knuckle_height

    left_leaf, = rs.BooleanDifference([left_leaf], left_boxes)
    right_leaf, = rs.BooleanDifference([right_leaf], right_boxes)

    rs.SelectObjects([left_leaf, right_leaf, pin])
    rs.Command('MergeAllFaces')
コード例 #17
0
import rhinoscriptsyntax as rs

Radius = 50
radius = 3.0
height = 100

rs.AddCone((0, 0, 0), height, Radius, True)
rs.AddCylinder((20, 0, 0), height, Radius, True)
rs.AddSphere((40, 0, 6), Radius)
rs.AddTorus((60, 0, 3), Radius, radius)
コード例 #18
0
def TreeMassing():
    try:

        litre = rs.GetReal("Enter the root ball litres, max 2000 Litres", 400)
        soilDepth = rs.GetReal('Enter the soil depth available in m', 0.8)
        matureHeight = rs.GetReal('Enter the mature tree height in m', 5)
        dbh = rs.GetReal(
            'Enter the DBH at maturity in m, if unknown hit Enter', 0)
        userPt = rs.GetPoint('Pick a point to place rootball')

        rs.EnableRedraw(False)

        # Dictionery for litre size to pot Rootball Diameter [0] / Rootball Height [1] / Calliper [2] / Height [3] / Spread [4]
        # Figures obtained from https://winterhill.com.au/tree-sizes/
        PotDict = {
            25: [0.300, 0.250, 0.020, 1.000, 0.500],
            45: [0.420, 0.350, 0.025, 2.000, 1.000],
            75: [0.465, 0.500, 0.035, 2.500, 2.000],
            100: [0.520, 0.560, 0.050, 3.500, 2.000],
            200: [0.700, 0.625, 0.070, 4.500, 3.000],
            400: [0.980, 0.715, 0.090, 6.000, 4.000],
            600: [1.200, 0.600, 0.100, 6.000, 5.000],
            800: [1.300, 0.600, 0.120, 7.000, 5.000],
            1000: [1.500, 0.600, 0.150, 8.000, 5.000],
            2000: [2.000, 0.800, 0.200, 9.000, 5.000],
        }

        def closest(lst, K):

            return lst[min(range(len(lst)), key=lambda i: abs(lst[i]-K))]

        def scale():
            system = rs.UnitSystem()
            if system == 2 or system == 3 or system == 4:
                scaleFactorDict = {2: 1000, 3: 100, 4: 1}
                scaleFactor = scaleFactorDict[system]
                return scaleFactor

            if system != 2 or system != 3 or system != 4:
                return None

        s = scale()

        if s == None:
            rs.MessageBox(
                "This tool is can only be used in mm, cm or m model units")
            return None

        # Calc for standard soil requirements as per Australian Standards

        if dbh == 0:
            dbh = ((matureHeight / 100) * 4) * 1000  # Gives a DBH in mm
        # Gives a required soil volume in M3
        reqSoil = (matureHeight * dbh) / 100
        reqSoilRadius = math.sqrt(reqSoil / ((math.pi)*soilDepth))

        # Add soil puck to doc
        reqSoilRadiusCyl = rs.AddCylinder(
            userPt, (soilDepth*s), (reqSoilRadius*s), cap=True)
        rs.ObjectColor(reqSoilRadiusCyl, (150, 75, 0))

        # Calc for size of rootball as per standard pot sizes
        litreMatch = closest(list(PotDict.keys()), litre)
        dia = (PotDict[litreMatch])[0]
        height = (PotDict[litreMatch])[1]

        # Add Rootball to doc
        rootballCyl = rs.AddCylinder(userPt, (height*s), ((dia/2)*s))
        rs.ObjectColor(rootballCyl, (0, 128, 0))
        vec = (0, 0, ((soilDepth*s) - (height*s)))
        rs.MoveObject(rootballCyl, vec)

        # Add Tree model based on Dict
        calliper = (PotDict[litreMatch])[2]
        treeHeight = (PotDict[litreMatch])[3]
        spread = (PotDict[litreMatch])[4]
        vec02 = (0, 0, (((soilDepth*s) - (height*s))) + (height*s))

        treeTrunk = rs.AddCylinder(userPt, (treeHeight*s), (calliper*s))
        rs.ObjectColor(treeTrunk, (101, 67, 33))
        rs.MoveObject(treeTrunk, vec02)
        canopy = rs.AddSphere(userPt, ((spread/2)*s))
        rs.ObjectColor(canopy, (33, 101, 67))
        vec03 = (0, 0, (((soilDepth*s) - (height*s))) +
                 (height*s) + (treeHeight*s) - ((spread/2)*s))
        rs.MoveObject(canopy, vec03)

        # Various Text Annotation
        txt1 = rs.AddText('Rootball ' + 'Height = ' + str(height*s) + ', Diameter = ' + str(dia*s), userPt,
                          height=(.1*s), font="Arial", font_style=0, justification=2)

        txt2 = rs.AddText('Soil Volume Requirement = ' + str(reqSoil) + ' m3', (userPt.X, (userPt.Y - (.2*s)), userPt.Z),
                          height=(.1*s), font="Arial", font_style=0, justification=2)

        block = rs.AddBlock((reqSoilRadiusCyl, rootballCyl, treeTrunk, canopy, txt1, txt2), userPt,
                            ("Rootball and Soil " + (str(random.random()))), delete_input=True)
        rs.BlockDescription(block, 'Rootball ' + 'Height = ' + str(height*s) + ', Diameter = ' + str(dia*s)
                            + ', Soil Volume Requirement = ' + str(reqSoil) + ' m3')

        guid = rs.InsertBlock(block, userPt)
        rs.ObjectName(guid, 'Rootball ' + 'Height = ' + str(height*s) + ', Diameter = ' + str(dia*s)
                            + ', Soil Volume Requirement = ' + str(reqSoil) + ' m3')

        rs.EnableRedraw(True)

    except:
        print("Failed to execute")
        rs.EnableRedraw(True)
        return
コード例 #19
0
 def twig_gen(self, base_radius, top_radius, height):
   return rs.AddCylinder(rs.WorldXYPlane(), height, base_radius)
コード例 #20
0
import rhinoscriptsyntax as rs
all = rs.AllObjects()
rs.DeleteObjects(all)

plane1 = rs.PlaneFromFrame([0, 0, 0], [0, 1, 0], [1, 0, 0])
plane2 = rs.PlaneFromFrame([0, 0, 6], [0, 1, 0], [1, 0, 0])
plane3 = rs.PlaneFromFrame([0, 0, 40], [0, 1, 0], [1, 0, 0])

nose = rs.AddCone(plane2, 6, 20, cap=True)
nose2 = rs.AddCone(plane3, 24, 5, cap=True)
hat1 = rs.AddCylinder(plane1, 110, 20, cap=True)
hat2 = rs.AddCylinder(plane1, -6, 10, cap=True)
hat3 = rs.AddCylinder(plane2, -10, 12, cap=True)
##neck=rs.AddCylinder ((0,0,-35), 10, 5, cap=True)
コード例 #21
0
import rhinoscriptsyntax as rs

# rs.AddPoint( - syntax tip
myPoint = rs.AddPoint((1, 2, 3))

# rs.AddSphere(center, radius)
myRadius = 3
mySpere = rs.AddSphere(myPoint, myRadius)

# skapa en kone
myCone = rs.AddCone((1, 2, 3), 20, 10)

# skapa en cylinder
myCone = rs.AddCylinder((0, -10, 0), 2, 10)

# skapa en linje
myPoint_2 = rs.AddPoint((0, 0, 0))
myPoint_3 = rs.AddPoint((10, 0, 0))
rs.AddLine(myPoint_2, myPoint_3)
コード例 #22
0
def createCylinderCake():
    for i in range(10):
        point1 = rs.CreatePoint(0, 0, -i)
        rs.AddCylinder(point1, 10, i)
コード例 #23
0
        base_btm_origin,
        (-BEAM_HEIGHT * tan(pi/3), -BEAM_HEIGHT * tan(pi/3), BEAM_HEIGHT))
    )

    base = rss.BooleanUnion((
        rss.JoinSurfaces(
            [rss.AddSrfPt(base_btm_pts), rss.AddSrfPt(base_top_pts)]
            + quad_rotate_object(rss.AddSrfPt((
                base_btm_pts[0],
                base_btm_pts[1],
                base_top_pts[0],
                base_top_pts[1]
            ))),
            delete_input=True
        ),
        rss.AddCylinder((0, 0, 0), 107.5, CORE_RADIUS)
    ))


# Part 1: Layer 1

# PLANE_HEIGHT: Height where the layer is placed
PLANE_HEIGHT = 62.5

if BUILD_TARGET == 'all' or 'layer1' in BUILD_TARGET:
    beam_origin = (BEAM_HALF_LENGTH, CORE_RADIUS, PLANE_HEIGHT)
    beam_path = rss.AddPolyline((
        beam_origin,
        rss.PointAdd(beam_origin, (0, 0, 8)),
        rss.PointAdd(beam_origin, (-5, 0, BEAM_HEIGHT)),
        rss.PointAdd(beam_origin, (-BEAM_LENGTH + 5, 0, BEAM_HEIGHT)),
z = rs.AddPoint(0, 1, -.4)
j = 0
plane11 = rs.RotatePlane(plane1, 0, [0, 1, 0])
#for i in range(50):

#plane11 = rs.RotatePlane(plane1, j, [0,1,0])
#j=j+10
#rs.AddRectangle( plane11, 25.0, 25.0 )
#rs.AddCircle( plane11, 25.0 )
#rs.AddSphere ( plane11, 25.0 )

#plane11 = rs.RotatePlane(plane1, j, [0,0,1])
#j=j+10
#rs.AddRectangle( plane11, 25.0, 25.0 )

#rs.AddSphere ( plane11, 50.0 )\
head = rs.AddSphere(plane11, 25.0)
eyeL = rs.AddSphere(plane2, 5.0)
eyeR = rs.AddSphere(plane3, 5.0)
#rs.AddSphere ( plane11, 25.0 )
#rs.AddCircle( (0,0,25), 50.0 )
hat1 = rs.AddCone(plane5, -25, 25, cap=False)
nose = rs.AddCone(plane4, 15, 5, cap=True)
hat2 = rs.AddCylinder(plane6, -1, 50, cap=True)
hat2 = rs.AddTorus(plane6, 50, 2)
neck = rs.AddCylinder((0, 0, -30), 10, 5, cap=True)
#body=rs.AddCylinder ((0,0,-70), 40, 50, cap=True)
body = rs.AddCylinder((0, 0, -95), 60, 30, cap=True)
#body=rs.GetRectangle (4, (0,0,-130),)
collar = rs.AddTorus((0, 0, -35), 15, 5)
 def cylinder(self, r):
     a = rs.GetPoint("Enter start point")
     h = rs.GetReal("Enter the height")
     cylinder = rs.AddCylinder(a, h, r)
コード例 #26
0
# use rhinoscriptsyntax to get all the functions in one shot
import rhinoscriptsyntax as rs
import random
import time
import math
import Rhino

numCyls = rs.GetInteger("Number of sticks")
spread = rs.GetInteger("spread")

seed = rs.GetPoint("seed point")
print "seed point: ", seed[0], " / ", seed[1], " / ", seed[2]

pi = math.pi

if numCyls and spread and seed:

    for a in range(numCyls):
        x = seed[0]
        y = seed[1]
        z = seed[2]
        # points.append([seed[0], seed[1], seed[2]])
        offset = random.random() * spread
        stick = rs.AddCylinder([x + offset, y, z],
                               random.random() * 10,
                               random.random() * 0.5, True)
        rs.RotateObject(stick, seed, random.random() * 360)

    rs.ZoomExtents(view=None, all=True)
コード例 #27
0
def createCylinderVisual(_space):
    for i in range(10):
        point1 = rs.CreatePoint(i * spacing, 0, 0)
        rs.AddCylinder(point1, random.randint(1, spacing),
                       random.randint(1, spacing / 2))
コード例 #28
0
def createColoredCylinder(x, y, z, r, g, b):
    currentColor = [r, g, b]
    rs.AddPoint(x, y, z)
    pt = (x, y, z)
    cr = rs.AddCylinder(pt, (x + y) / 4, 5)
    rs.ObjectColor(cr, currentColor)