コード例 #1
0
ファイル: A02a.py プロジェクト: liudz/SteelSystem
def addplane(m, n, dx, dy):
    for i in range(m):
        for j in range(n):
            plane = rs.WorldXYPlane()
            origin = (i * dx, j * dy, 0)
            newplane = rs.MovePlane(plane, origin)
            rs.AddPlaneSurface(newplane, dx, dy)
コード例 #2
0
ファイル: RingSize_cmd.py プロジェクト: talitw/rhino-ringsize
def RunCommand(is_interactive):
    ringSize = rs.GetReal("Ring size", 8.5, 0, 16)
    center = rs.GetPoint("Location")

    plane = rs.MovePlane(rs.ViewCPlane(), center)
    radius = (11.63 + 0.8128 * ringSize) * 0.5
    objId = rs.AddCircle(plane, radius)
    rs.SelectObject(objId)
コード例 #3
0
ファイル: shlPlotVolumes.py プロジェクト: SHLFab/shl-toolbox
def get_brep_section_planes(brep, section_heights):
    base_plane = wge.get_brep_base_plane(brep)
    section_planes = []
    for height in section_heights:
        new_plane = rs.MovePlane(base_plane, [
            base_plane.OriginX, base_plane.OriginY, base_plane.OriginZ + height
        ])
        section_planes.append(new_plane)
    return section_planes
コード例 #4
0
ファイル: shlPlotVolumes.py プロジェクト: SHLFab/shl-toolbox
def get_drawing_planes(section_dims, baseplane, increment):
    """generate planes for placing the bottom-left corner of output curves."""
    drawing_planes = [baseplane]
    p = baseplane  #temp plane
    for dim in section_dims[:-1]:
        o = [p.OriginX + dim.X + increment, p.OriginY, p.OriginZ]
        p = rs.MovePlane(p, o)
        drawing_planes.append(p)
    return drawing_planes
コード例 #5
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)

    r = rs.GetReal(message="Outside Diameter", number=params["r"])

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

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

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

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

    pc = bool_opts[0]

    params["n"] = n
    params["m"] = m
    params["r"] = r
    params["pa"] = pa
    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_with_outside(teeth=params["n"],
                                          module=params["m"],
                                          outside_diam=params["r"],
                                          pressure_angle=params["pa"])

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

    rs.EnableRedraw(True)

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

    return 0  # Success
コード例 #6
0
ファイル: shlCutTerrain.py プロジェクト: SHLFab/shl-toolbox
def get_section_planes(brep, thickness):
    bb = rs.BoundingBox(brep)

    start_height = bb[0].Z
    end_height = bb[4].Z
    xy_plane = rs.WorldXYPlane()
    heights = wut.frange(start_height, end_height, thickness)

    planes = [rs.MovePlane(xy_plane, [0, 0, z]) for z in heights]

    return planes
コード例 #7
0
 def createNewPopulation(self):
     x = 0
     y = 0
     for p in range(0, self.totalPopulation):
         if (x > numCols - 1):
             x = 0
             y += 1
         newLoc = rs.MovePlane(rs.WorldXYPlane(), (x * 20, y * -10, 0))
         d = DNA()
         pl = Plane(newLoc, d, p)
         self.population.append(pl)
         x += 1
コード例 #8
0
def CreateCircle(circumference=None):
    center = rs.GetPoint("Center point of circle")
    if center:
        plane = rs.MovePlane(rs.ViewCPlane(), center)
        length = circumference
        if length is None: length = rs.GetReal("Circle circumference")
        if length and length > 0:
            radius = length / (2 * math.pi)
            objectId = rs.AddCircle(plane, radius)
            rs.SelectObject(objectId)
            return length
    return None
コード例 #9
0
ファイル: shlLaserSheet.py プロジェクト: SHLFab/shl-toolbox
def RunCommand( is_interactive ):	
	margin = 5
	L, W = 810, 455
	basept = Rhino.Geometry.Point3d(0,0,0)

	L = unit_convert(L)
	W = unit_convert(W)
	margin = unit_convert(margin)
	go = Rhino.Input.Custom.GetPoint()
	opt_L = Rhino.Input.Custom.OptionDouble(L,0.2,10000)
	opt_W = Rhino.Input.Custom.OptionDouble(W,0.2,10000)

	go.SetCommandPrompt("Pick lower left corner of lasercut area or Enter to place at origin. Default sheet size is L=%.2f, W=%.2f" % (L,W))
	go.AddOptionDouble("Length", opt_L)
	go.AddOptionDouble("Width", opt_W)
	go.AcceptNothing(True)

	while True:
		res = go.Get()
		if res == Rhino.Input.GetResult.Option:
			continue
		elif res == Rhino.Input.GetResult.Cancel:
			return
		elif res == Rhino.Input.GetResult.Nothing:
			pass
		elif res == Rhino.Input.GetResult.Point:
			basept = go.Point()
		break
	
	layer_dict = wla.get_lcut_layers()
	plane = rs.WorldXYPlane()
	plane = rs.MovePlane(plane,basept)
	inner_rect = rs.AddRectangle(plane,L-margin*2,W-margin*2)
	plane = rs.MovePlane(plane, rs.PointAdd(basept, [-margin,-margin,0]))
	outer_rect = rs.AddRectangle(plane, L, W)
	rs.ObjectLayer([inner_rect, outer_rect],"XXX_LCUT_00-GUIDES")
	rs.SelectObjects([inner_rect,outer_rect])
	return True
コード例 #10
0
    def evolvePlanes(self):
        x = 0
        y = 0
        for i in range(0, self.totalPopulation):
            if (x > numCols - 1):
                x = 0
                y += 1
            newLoc = rs.MovePlane(rs.WorldXYPlane(), (x * 20, y * -10, 0))
            a = random.choice(self.selectedPlanes.values())
            b = random.choice(self.selectedPlanes.values())
            d = self.crossover(a, b)
            d.mutate()
            pl = Plane(newLoc, d, i)

            self.population.append(pl)
            x += 1
コード例 #11
0
def createAirplane():
    #CREATE FUSELAGE
    rectangleFuselage = rs.AddRectangle(rs.WorldXYPlane(), Fw, Fh)
    endPointsF = rs.PolylineVertices(rectangleFuselage)
    fPtsB = offsetPoints(Fpb, endPointsF[0], endPointsF[1])
    fPtsR = offsetPoints(Fpr, endPointsF[1], endPointsF[2])
    fPtsT = offsetPoints(Fpt, endPointsF[2], endPointsF[3])
    fPtsL = offsetPoints(Fpl, endPointsF[3], endPointsF[0])
    fPtsL.append(fPtsB[0])
    fCurveOpen = rs.AddCurve(fPtsB + fPtsR + fPtsT + fPtsL, 2)

    #CREATE WING SLOT
    wingSlotStart = rs.VectorAdd(endPointsF[0], (Fwx, Fwy, 0))
    wingSlotEnd = rs.VectorAdd(wingSlotStart,
                               (Fw - Fwx + maxPointOffset * 2, 0, 0))
    wingSlot = rs.AddLine(wingSlotStart, wingSlotEnd)
    wingSlotOffset = rs.OffsetCurve(wingSlot, (0, 1, 0), 1 / 32)
    rs.AddLine(rs.CurveStartPoint(wingSlot),
               rs.CurveStartPoint(wingSlotOffset))

    #CREATE WING
    wPlaneOffY = Wh + 1
    wPlaneOffX = Fw / 2
    wingPlane = rs.MovePlane(rs.WorldXYPlane(), (wPlaneOffX, -wPlaneOffY, 0))
    rectangleWing = rs.AddRectangle(wingPlane, Ww, Wh)
    endPointsW = rs.PolylineVertices(rectangleWing)
    wPtsB = offsetPoints(Wpb, endPointsW[0], endPointsW[1])
    wPtsR = offsetPoints(Wps, endPointsW[1], endPointsW[2])
    wPtsT = offsetPoints(Wpt, endPointsW[2], endPointsW[3])
    wPtsT.append(endPointsW[3])
    wPtsB.insert(0, endPointsW[0])
    wingCurve = rs.AddCurve(wPtsB + wPtsR + wPtsT)
    #wingLine = rs.AddLine(endPointsW[3],endPointsW[0])
    rs.MirrorObject(wingCurve, endPointsW[3], endPointsW[0], True)

    #CREATE WING GROOVE
    wingGrooveStart = rs.VectorAdd(endPointsW[3], (-1 / 64, maxPointOffset, 0))
    wingGrooveEnd = rs.VectorAdd(wingGrooveStart,
                                 (0, -(maxPointOffset + Wh * Wsd), 0))
    wingGroove = rs.AddLine(wingGrooveStart, wingGrooveEnd)
    wingGrooveOffset = rs.OffsetCurve(wingGroove, (1, 0, 0), -1 / 32)
    rs.AddLine(rs.CurveEndPoint(wingGroove),
               rs.CurveEndPoint(wingGrooveOffset))

    #DELETE RECTANGLES
    rs.DeleteObject(rectangleFuselage)
    rs.DeleteObject(rectangleWing)
コード例 #12
0
import System
import clr
clr.AddReference("Grasshopper")
import rhinoscriptsyntax as rs
from Grasshopper import DataTree
import Rhino.Geometry as rg
import ghpythonlib.components as ghc
import ghpythonlib.treehelpers as ght

a = []
# Checks whether the input geometry is brep, mesh or curve
# If it is a brep or mesh, the input height is used to create the contour, in 
# the given height
# Curves are then projected onto world xy-plane
for i in range (len(geometry)):
    if (geometry[i].ToString().split(".")[-1]).Contains("Brep"):
        a.append(geometry[i].CreateContourCurves(geometry[i],rs.MovePlane(rs.WorldXYPlane(),[0,0,height])))
    elif (geometry[i].ToString().split(".")[-1]).Contains("Mesh"):
        a.append(geometry[i].CreateContourCurves(geometry[i],rs.MovePlane(rs.WorldXYPlane(),[0,0,height])))
    elif (geometry[i].ToString().split(".")[-1]).Contains("Curve"):
        a.append(geometry[i].ProjectToPlane(geometry[i],rs.WorldXYPlane()))

a = ght.list_to_tree(a)
a.Flatten()
コード例 #13
0
ファイル: Exporter.py プロジェクト: naysok/Rhino6_Export_FBX
def mesh_spheres(count):
    tmp_sp = []
    for i in xrange(count):
        tmp_sp.append(ghpc.MeshSphere(
            rs.MovePlane(rs.WorldXYPlane(), (i,i,0)), 0.5, 8, 8))
    return tmp_sp
コード例 #14
0
def SampleGardenPath():

    # Acquire information for the garden path
    start_point = rs.GetPoint('Start point of path')
    if start_point is None: return

    end_point = rs.GetPoint('End point of path', start_point)
    if end_point is None: return

    half_width = rs.GetDistance(start_point, None, 'First width point',
                                'Half width of path')
    if half_width is None: return

    tile_radius = rs.GetReal('Radius of tiles', 1.0)
    if tile_radius is None: return
    if tile_radius <= 0.0: return

    tile_spacing = rs.GetReal('Distance between tiles', 1.0)
    if tile_spacing is None: return
    if tile_spacing < 0.0: return

    # To increase speed, disable redrawing
    rs.EnableRedraw(False)

    # Calculate angles
    angle_rc = rs.Angle(start_point, end_point)
    angle = angle_rc[0]
    length = rs.Distance(start_point, end_point)
    width = half_width * 2
    angle_p90 = angle + 90.0
    angle_m90 = angle - 90.0

    # Draw the outline of the path
    polyline = []
    polyline.append(rs.Polar(start_point, angle_m90, half_width))
    polyline.append(rs.Polar(polyline[0], angle, length))
    polyline.append(rs.Polar(polyline[1], angle_p90, width))
    polyline.append(rs.Polar(polyline[2], angle + 180.0, length))
    polyline.append(polyline[0])
    rs.AddPolyline(polyline)

    # Draw the rows of tiles
    plane = rs.WorldXYPlane()
    distance = tile_radius + tile_spacing
    offset = 0.0

    while (distance <= length - tile_radius):

        # Place one row of tiles given polyline along path and possibly offset it
        first = rs.Polar(start_point, angle, distance)
        current = rs.Polar(first, angle_p90, offset)
        next = current

        while (rs.Distance(first, next) < half_width - tile_radius):
            plane = rs.MovePlane(plane, next)
            rs.AddCircle(plane, tile_radius)
            next = rs.Polar(next, angle_p90,
                            tile_spacing + tile_radius + tile_radius)

        next = rs.Polar(current, angle_m90,
                        tile_spacing + tile_radius + tile_radius)

        while (rs.Distance(first, next) < half_width - tile_radius):
            plane = rs.MovePlane(plane, next)
            rs.AddCircle(plane, tile_radius)
            next = rs.Polar(next, angle_m90,
                            tile_spacing + tile_radius + tile_radius)

        distance = distance + ((tile_spacing + tile_radius + tile_radius) *
                               math.sin(60.0 * 180.0 / math.pi))

        if (offset == 0.0):
            offset = (tile_spacing + tile_radius + tile_radius) * math.cos(
                60.0 * 180.0 / math.pi)
        else:
            offset = 0.0

    rs.EnableRedraw(True)
コード例 #15
0
def rc_plot_volumes(use_epsilon):
    #get sticky
    default_thickness = sticky["defaultThickness"] if sticky.has_key(
        "defaultThickness") else 5.5

    go = Rhino.Input.Custom.GetObject()
    go.GeometryFilter = Rhino.DocObjects.ObjectType.Brep

    opt_thickness = Rhino.Input.Custom.OptionDouble(default_thickness, 0.2,
                                                    1000)
    opt_sections = Rhino.Input.Custom.OptionToggle(False, "No", "Yes")
    opt_inplace = Rhino.Input.Custom.OptionToggle(False, "No", "Yes")
    opt_heights = Rhino.Input.Custom.OptionToggle(False, "No", "Yes")

    go.SetCommandPrompt("Select breps to extract plan cuts")
    go.AddOptionDouble("Thickness", opt_thickness)

    go.GroupSelect = True
    go.SubObjectSelect = False
    go.AcceptEnterWhenDone(True)
    go.AcceptNothing(True)
    go.EnableClearObjectsOnEntry(False)
    go.EnableUnselectObjectsOnExit(False)
    go.GroupSelect = True
    go.SubObjectSelect = False
    go.DeselectAllBeforePostSelect = False

    res = None
    bHavePreselectedObjects = False

    while True:
        res = go.GetMultiple(1, 0)
        #If new option entered, redraw a possible result
        if res == Rhino.Input.GetResult.Option:
            # print res
            go.EnablePreSelect(False, True)
            continue
        #If not correct
        elif res != Rhino.Input.GetResult.Object:
            return Rhino.Commands.Result.Cancel
        if go.ObjectsWerePreselected:
            bHavePreselectedObjects = True
            go.EnablePreSelect(False, True)
            continue
        break

    rs.EnableRedraw(False)

    global THICKNESS
    THICKNESS = opt_thickness.CurrentValue

    global LCUT_INDICES
    LCUT_INDICES = wla.get_lcut_layers()

    #Get brep representations of objects
    brep_geo_list = []
    for i in xrange(go.ObjectCount):
        b_obj = go.Object(i).Object()
        brep_geo_list.append(b_obj.Geometry)

    #...brep conversion may be necessary
    new_brep_list = []
    for i, geo in enumerate(brep_geo_list):
        if geo.GetType() != Rhino.Geometry.Brep:
            new_brep_list.append(wru.extrusion_to_brep(geo))
        else:
            new_brep_list.append(geo)

    #set base for output.
    xbase = 0
    ybase = 0
    #set the amount to move up from the bottom of the brep for cutting the lower outline.
    #this should be replaced by a projection of the bottom face of the brep.
    epsilon = D_TOL * 2

    select_items = []
    for i, brep in enumerate(new_brep_list):

        #get label prefix and bounding dims for this brep
        bdims = wge.get_bounding_dims(brep)
        baseplane = rs.MovePlane(rs.WorldXYPlane(), [xbase, ybase, 0])
        label_letter = wut.number_to_letter(i)
        label_prefix = label_letter + "-"

        #prepare heights and labels for each section cut
        num_sections = 1
        remaining_thickness = 0
        cuts_at = [epsilon] if use_epsilon else [0]
        brep_label = label_letter
        section_labels = [label_letter]

        num_sections, remaining_thickness, cuts_at = get_section_division(
            bdims.Z, THICKNESS)
        if use_epsilon: cuts_at[0] = epsilon
        brep_label = label_letter + " r: " + str(round(remaining_thickness, 2))
        section_labels = [label_prefix + str(i) for i in xrange(len(cuts_at))]

        #get section information for each cut
        section_planes = get_brep_section_planes(brep, cuts_at)

        #get lowest curve info
        section_curves, section_dims = [[], []]
        for i, plane in enumerate(section_planes):
            curve, dims = [0, 0]
            if (not use_epsilon) and (i == 0):
                curve, dims = get_lowest_curve_info(brep, D_TOL * 2)
            else:
                curve, dims = get_section_curve_info_multi_no_ortho(
                    brep, plane)
            section_curves.append(curve)
            section_dims.append(dims)

        ##DO WORK HERE##
        drawing_planes = get_drawing_planes(section_dims, baseplane, GAP_SIZE)

        #place curves in drawing location
        for sp, dp, sc in zip(section_planes, drawing_planes, section_curves):
            t = Rhino.Geometry.Transform.ChangeBasis(dp, sp)
            for c in sc:
                c.Transform(t)

        #THIS IS STILL A MESS: LABEL ADDING
        #draw curves and add text dots
        top_label_pt = get_brep_label_pt(brep)
        brep_textdot = rs.AddTextDot(brep_label, top_label_pt)
        rs.ObjectLayer(brep_textdot, "XXX_LCUT_00-GUIDES")

        label_pts = []
        for sc, label in zip(section_curves, section_labels):
            temp_area = 0
            for i, c in enumerate(sc):
                crv = wru.add_curve_to_layer(c, LCUT_INDICES[1])
                select_items.append(crv)
                if i == 0:
                    label_pts.append(rs.CurveAreaCentroid(crv)[0])
                    temp_area = rs.CurveArea(crv)
                else:
                    if rs.CurveArea(crv) > temp_area:
                        label_pts[-1] = rs.CurveAreaCentroid(crv)[0]
                        temp_area = rs.CurveArea(crv)

        fab_tags = wfa.add_fab_tags(label_pts, section_labels, TEXTSIZE)
        for tag in fab_tags:
            rs.ObjectLayer(tag, "XXX_LCUT_02-SCORE")
            group_name = rs.AddGroup()
            rs.AddObjectsToGroup(tag, group_name)

        ybase += max([s.Y for s in section_dims]) + GAP_SIZE * 1

        for tag in fab_tags:
            select_items.extend(tag)
        #THIS IS STILL A MESS: LABEL ADDING

    sticky["defaultThickness"] = THICKNESS

    rs.UnselectAllObjects()
    rs.SelectObjects(select_items)
    rs.Redraw()
    rs.EnableRedraw(True)
コード例 #16
0
 def CreateCircularSurface(self, b, radius):
     plane = rs.MovePlane(rs.WorldXYPlane(), (0, 0, b))
     circle = rs.AddCircle(plane, radius)
     surface = rs.AddPlanarSrf([circle])
     rs.DeleteObject(circle)
     return surface
コード例 #17
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)

    ha = rs.GetReal(message="Helix angle",
                    number=params["ha"], minimum=-45, maximum=45)

    t = rs.GetReal(message="Thickness",
                   number=params["t"], minimum=0)

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

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

    pc = bool_opts[0]

    params["n"] = n
    params["m"] = m
    params["pa"] = pa
    params["ha"] = ha
    params["t"] = t
    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"])

    pitch = abs((n * m * pi) / tan(radians(ha)))
    turns = t / pitch

    if ha < 0:
        # Left handed helix
        turns = -turns

    centerline = rs.AddLine([0, 0, 0], [0, 0, t])
    helix = rs.AddSpiral([0, 0, 0],
                         [0, 0, t],
                         pitch=pitch,
                         turns=turns,
                         radius0=(m * n) / 2)

    helical_gear_srf = rs.AddSweep2(rails=[centerline, helix], shapes=[gear])
    rs.DeleteObjects([centerline, helix, gear])

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

    if pc:
        circle = generate_pitch_circle_crv(teeth=params["n"],
                                           module=params["m"])
        pitch_cyl_srf = rs.ExtrudeCurveStraight(circle,
                                                start_point=[0, 0, 0],
                                                end_point=[0, 0, t])
        rs.TransformObjects(pitch_cyl_srf, xform)
        rs.DeleteObject(circle)
        rs.SelectObjects([helical_gear_srf, pitch_cyl_srf])
    else:
        rs.SelectObjects(helical_gear_srf)

    rs.EnableRedraw(True)

    return 0  # Success
コード例 #18
0
ファイル: shlPlotVolumes.py プロジェクト: SHLFab/shl-toolbox
def rc_plot_volumes(use_epsilon):

    go = Rhino.Input.Custom.GetObject()
    go.GeometryFilter = Rhino.DocObjects.ObjectType.Brep

    default_inplaceBool = sticky["inplaceBool"] if sticky.has_key(
        "inplaceBool") else False
    default_heightsBool = sticky["heightsBool"] if sticky.has_key(
        "heightsBool") else False

    opt_inplace = Rhino.Input.Custom.OptionToggle(default_inplaceBool, "No",
                                                  "Yes")
    opt_heights = Rhino.Input.Custom.OptionToggle(default_heightsBool, "No",
                                                  "Yes")

    go.SetCommandPrompt("Select breps to extract plan cuts")
    go.AddOptionToggle("InPlace", opt_inplace)
    go.AddOptionToggle("PrintPieceHeights", opt_heights)

    go.GroupSelect = True
    go.SubObjectSelect = False
    go.AcceptEnterWhenDone(True)
    go.AcceptNothing(True)
    go.EnableClearObjectsOnEntry(False)
    go.EnableUnselectObjectsOnExit(False)
    go.GroupSelect = True
    go.SubObjectSelect = False
    go.DeselectAllBeforePostSelect = False

    res = None
    bHavePreselectedObjects = False

    while True:
        res = go.GetMultiple(1, 0)
        #If new option entered, redraw a possible result
        if res == Rhino.Input.GetResult.Option:
            # print res
            go.EnablePreSelect(False, True)
            continue
        #If not correct
        elif res != Rhino.Input.GetResult.Object:
            return Rhino.Commands.Result.Cancel
        if go.ObjectsWerePreselected:
            bHavePreselectedObjects = True
            go.EnablePreSelect(False, True)
            continue
        break

    rs.EnableRedraw(False)

    DIRPT1 = rs.coerce3dpoint([0, 0, 0])
    DIRPT2 = rs.coerce3dpoint([1, 0.001, 0])
    global BOOL_HEIGHTS
    global LCUT_INDICES
    global SORTDIR
    BOOL_HEIGHTS = opt_heights.CurrentValue
    LCUT_INDICES = wla.get_lcut_layers()
    SORTDIR = DIRPT2 - DIRPT1

    #Get boolean for "inplace"
    INPLACE = opt_inplace.CurrentValue

    #Get brep representations of objects
    brep_geo_list = []
    for i in xrange(go.ObjectCount):
        b_obj = go.Object(i).Object()
        brep_geo_list.append(b_obj.Geometry)

    #...brep conversion may be necessary
    new_brep_list = []
    for i, geo in enumerate(brep_geo_list):
        if geo.GetType() != Rhino.Geometry.Brep:
            new_brep_list.append(wru.extrusion_to_brep(geo))
        else:
            new_brep_list.append(geo)

    #set base for output.
    xbase = 0
    ybase = 0
    #set the amount to move up from the bottom of the brep for cutting the lower outline.
    #this should be replaced by a projection of the bottom face of the brep.
    epsilon = D_TOL * 2

    select_items = []

    centroids = [
        c.GetBoundingBox(rs.WorldXYPlane()).Center for c in new_brep_list
    ]
    brep_collection = zip(centroids, new_brep_list)
    brep_collection = sorted(brep_collection, sortcompare)
    _, new_brep_list = zip(*brep_collection)

    for i, brep in enumerate(new_brep_list):
        #get lowest curve info

        #get label prefix and bounding dims for this brep
        bdims = wge.get_bounding_dims(brep)
        baseplane = rs.MovePlane(rs.WorldXYPlane(), [xbase, ybase, 0])
        label_letter = wut.number_to_letter(i)

        #prepare heights and labels for each section cut
        num_sections = 1
        remaining_thickness = 0
        cuts_at = [epsilon] if use_epsilon else [0]
        brep_label = label_letter
        section_labels = [label_letter]

        if BOOL_HEIGHTS == True:
            section_labels = [
                label + "\n" + str(round(bdims.Z, 1))
                for label in section_labels
            ]

        #get section information for each cut
        section_planes = get_brep_section_planes(brep, cuts_at)

        section_curves, section_dims = [[], []]
        for i, plane in enumerate(section_planes):
            curve, dims = [0, 0]
            if (not use_epsilon) and (i == 0):
                curve, dims = get_lowest_curve_info(brep, D_TOL * 2)
            else:
                curve, dims = get_section_curve_info_multi_no_ortho(
                    brep, plane)
            section_curves.append(curve)
            section_dims.append(dims)

        ##DO WORK HERE##
        drawing_planes = get_drawing_planes(section_dims, baseplane, GAP_SIZE)

        #place curves in drawing location
        for sp, dp, sc in zip(section_planes, drawing_planes, section_curves):
            if INPLACE == True:
                t = Rhino.Geometry.Transform.Translation(0, 0, 0)
            else:
                t = Rhino.Geometry.Transform.ChangeBasis(dp, sp)
            for c in sc:
                c.Transform(t)

        #THIS IS STILL A MESS: LABEL ADDING
        #draw curves and add text dots
        top_label_pt = get_brep_label_pt(brep)
        brep_textdot = rs.AddTextDot(brep_label, top_label_pt)
        rs.ObjectLayer(brep_textdot, "XXX_LCUT_00-GUIDES")

        label_pts = []
        for sc, label in zip(section_curves, section_labels):
            for i, c in enumerate(sc):
                crv = wru.add_curve_to_layer(c, LCUT_INDICES[1])
                select_items.append(crv)
                if i == 0:
                    label_pts.append(rs.CurveAreaCentroid(crv)[0])

        fab_tags = wfa.add_fab_tags(label_pts, section_labels, TEXTSIZE)
        for tag in fab_tags:
            rs.ObjectLayer(tag, "XXX_LCUT_02-SCORE")
            group_name = rs.AddGroup()
            rs.AddObjectsToGroup(tag, group_name)
        ybase += max([s.Y for s in section_dims]) + GAP_SIZE * 1

        for tag in fab_tags:
            select_items.extend(tag)

    sticky["inplaceBool"] = INPLACE
    sticky["heightsBool"] = BOOL_HEIGHTS

    rs.UnselectAllObjects()
    rs.SelectObjects(select_items)
    rs.Redraw()
    rs.EnableRedraw(True)
コード例 #19
0
    def createAirplane(self):
        #CREATE FUSELAGE

        rectangleFuselage = rs.AddRectangle(self.location,
                                            self.genes.values['Fw'],
                                            self.genes.values['Fh'])
        endPointsF = rs.PolylineVertices(rectangleFuselage)
        fPtsB = offsetPoints(self.genes.values['Fpb'], endPointsF[0],
                             endPointsF[1])
        fPtsR = offsetPoints(self.genes.values['Fpr'], endPointsF[1],
                             endPointsF[2])
        fPtsT = offsetPoints(self.genes.values['Fpt'], endPointsF[2],
                             endPointsF[3])
        fPtsL = offsetPoints(self.genes.values['Fpl'], endPointsF[3],
                             endPointsF[0])
        fPtsL.append(fPtsB[0])
        fCurveOpen = rs.AddCurve(fPtsB + fPtsR + fPtsT + fPtsL, 2)

        #CREATE WING SLOT
        wingSlotStart = rs.VectorAdd(
            endPointsF[0],
            (self.genes.values['Fwx'], self.genes.values['Fwy'], 0))
        wingSlotEnd = rs.VectorAdd(
            wingSlotStart,
            (self.genes.values['Fw'] - self.genes.values['Fwx'] +
             maxPointOffset * 2, 0, 0))
        wingSlot = rs.AddLine(wingSlotStart, wingSlotEnd)
        #guideLine = rs.AddLine(wingSlotStart,rs.VectorAdd(wingSlotStart,(0,0.2,0)))
        #rs.ObjectColor(guideLine,(0,0,200))
        #wingSlotOffset = rs.OffsetCurve(wingSlot,(0,1,0),1/32)
        #rs.AddLine(rs.CurveStartPoint(wingSlot),rs.CurveStartPoint(wingSlotOffset))

        #CREATE WING
        wPlaneOffY = self.genes.values['Wh'] + 1
        wPlaneOffX = self.genes.values['Fw'] / 2
        wingPlane = rs.MovePlane(self.location,
                                 (wPlaneOffX + self.location[0].X,
                                  -wPlaneOffY + self.location[0].Y, 0))
        rectangleWing = rs.AddRectangle(wingPlane, self.genes.values['Ww'],
                                        self.genes.values['Wh'])
        endPointsW = rs.PolylineVertices(rectangleWing)
        wPtsB = offsetPoints(self.genes.values['Wpb'], endPointsW[0],
                             endPointsW[1])
        wPtsR = offsetPoints(self.genes.values['Wps'], endPointsW[1],
                             endPointsW[2])
        wPtsT = offsetPoints(self.genes.values['Wpt'], endPointsW[2],
                             endPointsW[3])
        wPtsT.append(endPointsW[3])
        wPtsB.insert(0, endPointsW[0])
        wingCurve = rs.AddCurve(wPtsB + wPtsR + wPtsT)
        #wingLine = rs.AddLine(endPointsW[3],endPointsW[0])
        wingCurveM = rs.MirrorObject(wingCurve, endPointsW[3], endPointsW[0],
                                     True)

        #CREATE WING GROOVE
        wingGrooveStart = rs.VectorAdd(endPointsW[3], (0, maxPointOffset, 0))
        wingGrooveEnd = rs.VectorAdd(
            wingGrooveStart,
            (0, -(maxPointOffset +
                  self.genes.values['Wh'] * self.genes.values['Wsd']), 0))
        wingGroove = rs.AddLine(wingGrooveStart, wingGrooveEnd)
        #wingGrooveOffset = rs.OffsetCurve(wingGroove,(1,0,0),-1/32)
        #rs.AddLine(rs.CurveEndPoint(wingGroove),rs.CurveEndPoint(wingGrooveOffset))

        #DELETE RECTANGLES
        rs.DeleteObject(rectangleFuselage)
        rs.DeleteObject(rectangleWing)

        textPlane = rs.MovePlane(
            self.location,
            (self.location[0].X + .25, self.location[0].Y + .25, 0))
        text = rs.AddText(self.number, textPlane, 0.25)
        textCurves = rs.ExplodeText(text, True)
        rs.ObjectColor(textCurves, (0, 0, 200))
        planeGroup = rs.AddGroup()
        rs.AddObjectsToGroup(
            [fCurveOpen, wingCurveM, wingSlot, wingCurve, wingGroove, text],
            planeGroup)
コード例 #20
0
#coding=utf-8
import rhinoscriptsyntax as rs

plane = rs.WorldXYPlane()  #建立XY工作平面
mplane = rs.MovePlane(plane, [6, 6.5, 0])  #移动平面
rectangle = rs.AddCircle(mplane, 5)  #建立圆形
dpointsc = rs.DivideCurve(rectangle, 20)  #等分矩形
dpoints = rs.AddPoints(dpointsc)  #增加等分点
for i in range(len(dpoints)):
    rs.AddText(str(i), dpoints[i], 1)  #添加字
print(dpoints)

#sphere = rs.AddSphere(dpoints[3],1)
#cube = rs.AddBox(rs.BoundingBox(sphere))

sdpoints = dpoints[:]  #切片提取点
for i in range(len(sdpoints)):
    sphere = rs.AddSphere(sdpoints[i], 0.5)
    cube = rs.AddBox(rs.BoundingBox(sphere))
    rs.DeleteObject(sphere)  #删除不再使用的球体
    xform = rs.XformTranslation([i, i * 1.3, i * 1.3])  #分步骤执行比gh同步更灵活
    trancube = rs.TransformObject(cube, xform)
コード例 #21
0
def xf_scale(ctr, scale=(1, 1, 1)):
    if 0 in scale: raise Exception("Attempted to scale by 0%")
    pln = rs.MovePlane(rs.WorldXYPlane(), ctr)
    xs, ys, zs = scale
    xform = Rhino.Geometry.Transform.Scale(pln, xs, ys, zs)
    return xform
コード例 #22
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
コード例 #23
0
    def slicing(self, ghdoc_, path_, geometries, geometry_index, layer_height, whd):
        
        pic_size = 1000

        #######################################################################
        ### Base Size
        ### Create and Bake 
        rect_ = cg.create_rect(whd)
        bg.bake_breps(ghdoc_, rect_)

        ### Capture and Delete
        file_name = path_ + "size\\size.png"
        cmd.capture_image_size_w_all_option(file_name, pic_size, pic_size)

        ### Create and Bake
        rect_ = cg.create_rect(whd)
        bg.bake_breps(ghdoc_, rect_)

        ### Capture and Delete
        file_name = path_ + "size\\size.png"
        cmd.capture_image_size_w_all_option(file_name, pic_size, pic_size)
        #######################################################################

        slice_count = int(whd / layer_height) + 1
        # print(slice_count)

        ### Select geometry
        target = geometries[geometry_index]
        
        
        ### Slicing Loop
        sliced_surface = []
        v = []
        for i in xrange(slice_count):
            
            current_height = layer_height * i
            v.append(current_height)
            
            ### Mesh x Plane Intersection
            p = rs.MovePlane(rs.WorldXYPlane(), [0, 0, current_height])
            pl = self.slice_plane(target, p)
            
            ### Polyline to Surface
            if pl != None:
                # print(pl)
                surfaces = cg.create_surface_from_polylines(pl)
                # print(surfaces)
                # sliced_surface.append(surfaces)

                ### Bake Geometry
                bg.bake_breps(ghdoc_, surfaces)

            ### Capture and Delete
            gi_pad = "%03d"%geometry_index
            i_pad = "%05d"%i
            file_name = path_ + "{}\\{}.png".format(gi_pad, i_pad)
            cmd.capture_image_size(file_name, pic_size, pic_size)


        # return sliced_surface
        return v
        
コード例 #24
0
def expand(intStartY):  #this function expands the points in the Y direction
    global dictPointByNum  #all the global vars
    global dictPointByCord
    global cvBaseCurve
    global sfBaseSurface
    global reRadius
    global reBase
    global reDist
    global ltObjectPoint
    ltStartXY = (0, intStartY)  #this is the point we start
    if ltStartXY not in dictPointByNum:
        return 0
    quePoint = Queue.Queue(
        maxsize=0)  #get point from the queue until it is empty
    quePoint.put(dictPointByNum[ltStartXY])
    ltNeAndPo = (-1, 1)

    while quePoint.qsize() > 0:
        ptcordTmpPoint = quePoint.get(
        )  #this is the point we concern now, we also need the points near it
        ltTmpPointNum = dictPointByCord[ptcordTmpPoint]

        for intNeOrPo in ltNeAndPo:
            ltTmpPointNearNum = (ltTmpPointNum[0] + intNeOrPo,
                                 ltTmpPointNum[1])
            if ltTmpPointNearNum not in dictPointByNum:
                continue
            ptcordTmpPointNear = dictPointByNum[
                ltTmpPointNearNum]  #get the cord of the near point

            planeXYPlane = rs.WorldXYPlane()
            planeTmpPlane0 = rs.MovePlane(planeXYPlane, ptcordTmpPoint)
            planeTmpPlane1 = rs.MovePlane(planeXYPlane, ptcordTmpPointNear)
            ltInterResults = rs.IntersectSpheres(planeTmpPlane0, reRadius,
                                                 planeTmpPlane1, reRadius)
            #get the intersection results of two spheres
            if ltInterResults:
                cvInterCircle = rs.AddCircle(ltInterResults[1],
                                             ltInterResults[2])
            else:
                return
            ltTmpIntersection = rs.CurveSurfaceIntersection(
                cvInterCircle, sfBaseSurface)  #get new points
            if ltTmpIntersection is None:
                continue
            boolAdd = 0
            for ltIntersectionPoint in ltTmpIntersection:  #Add the points
                if ltIntersectionPoint[0] == 1:
                    ptcordTmpPointInter = ltIntersectionPoint[1]
                    boolInOrNot = InOrOut(ptcordTmpPointInter)
                    if boolInOrNot == 0:
                        boolAdd = 1
                        if intNeOrPo < 0:
                            AddPoint(ptcordTmpPointInter, ptcordTmpPoint,
                                     ltTmpPointNearNum, 1)
                        else:
                            AddPoint(ptcordTmpPointInter, ptcordTmpPoint,
                                     ltTmpPointNum, 1)
                else:
                    print "Impossible"
                    return -1
            if boolAdd > 0:
                quePoint.put(ptcordTmpPointNear)
            rs.DeleteObject(cvInterCircle)
        '''
		for intNeOrPoHigh in ltNeAndPo:
			if (ltTmpPointNum[0]+intNeOrPoHigh,ltTmpPointNum[1]) not in dictPointByNum:
				for intNeOrPo in ltNeAndPo:
					if intNeOrPoHigh==1:
						ltTmpPointNearNum = (ltTmpPointNum[0]-intNeOrPoHigh,ltTmpPointNum[1]+intNeOrPo)
					else:
						ltTmpPointNearNum = (ltTmpPointNum[0],ltTmpPointNum[1]+intNeOrPo)

					if ltTmpPointNearNum not in dictPointByNum:
						continue
					ptcordTmpPointNear = dictPointByNum[ltTmpPointNearNum] #get the cord of the near point
					ptcordTmpPointDist = dictPointByNum[(ltTmpPointNum[0]-intNeOrPoHigh,ltTmpPointNum[1])]
					reDistanceTmp = rs.Distance(ptcordTmpPointDist,ptcordTmpPoint)

					planeXYPlane = rs.WorldXYPlane()
					planeTmpPlane0 = rs.MovePlane(planeXYPlane, ptcordTmpPoint)
					planeTmpPlane1 = rs.MovePlane(planeXYPlane, ptcordTmpPointNear)
					ltInterResults = rs.IntersectSpheres(planeTmpPlane0, reDistanceTmp, planeTmpPlane1, reRadius)
		'''

    return 0
コード例 #25
0
ファイル: grid000.py プロジェクト: mitjanit/FormAndCode
end     = (0,100,0)

nCols = 6
nRows = 6
wSquare = 100

plane = rs.WorldXYPlane()
allRects = []
gridRects = []

# Add random rect from the grid
rs.AddLayer("Rects")
for r in range(0,nRows):
    for c in range(0, nCols):
        origin = (start[0] + wSquare*r, start[1] + wSquare*c, start[2])
        plane = rs.MovePlane(plane,origin)
        rn = random.uniform(0,10)
        if(rn<2):
            newRect = rs.AddRectangle(plane, wSquare, wSquare)
            rs.ObjectLayer(newRect, "Rects")
            gridRects.append(newRect)
            allRects.append(newRect)

# Rotate all rects from the grid
for rect in gridRects:
    for ntimes in range(1,4):
        newRect = rs.RotateObject( rect , start , 15.0*ntimes, None, True )
        rs.ObjectLayer(newRect, "Rects")
        allRects.append(newRect)

# Mirror all rects using Y axe
コード例 #26
0
    rs.AddPoint(mpoint1)  #在rhino空间中增加每次移动的点

rangeh = 4  #定义Y方向上复制点的次数
dpoints = {}  #定义空的字典,放置所有移动的点,每一横排的点放置于一个单独的列表中,作为值
mpointh = []  #放置所有点的空列表
deletep = []  #放置每一次内部循环即横排点的空列表,用于字典

#循环Y方向上的复制点的次数
for i in range(rangeh):
    matrixh = rs.XformTranslation((0, i * multiplev, 0))  #建立Y方向上的变换矩阵
    for m in range(len(mpoints)):
        pointh = rs.PointTransform(mpoints[m], matrixh)  #按照变换矩阵逐个移动每一个点
        rs.AddPoint(pointh)  #在rhino空间中增加每次移动点
        mpointh.append(pointh)  #将点加入列表
        deletep.append(pointh)
    dpoints[i] = deletep  #加入字典
    deletep = []
print(dpoints)

#提取字典键的值
hifirst = dpoints.get(1)
print(len(hifirst))

#建立矩形
plane = rs.WorldXYPlane()  #定义参考平面,建立矩形
h = 5
w = 5
for i in range(len(mpointh)):
    mplane = rs.MovePlane(plane, mpointh[i])
    rectangle = rs.AddRectangle(mplane, w, h)
コード例 #27
0
def test():

    #Assign variables to the sin and cos functions for use later.
    Sin = math.sin
    Cos = math.cos

    # Acquire information for the garden path

    # set default values for the distances
    default_hwidth = 1
    default_trad = 1
    default_tspace = 1

    # look for any previously used values stored in sticky and use those if available.
    if sc.sticky.has_key("GP_WIDTH"):
        default_hwidth = sc.sticky["GP_WIDTH"]

    if sc.sticky.has_key("GP_RAD"):
        default_trad = sc.sticky["GP_RAD"]

    if sc.sticky.has_key("GP_Space"):
        default_tspace = sc.sticky["GP_SPACE"]

        #get the path direction, length and location from two points entered by the user
    sp = rs.GetPoint("Start point of path centerline")
    if sp is None: return

    ep = rs.GetPoint("End point of path centerline", sp)
    if ep is None: return

    #now ask the user what the distances should be, offering the defaults arrived at above

    hwidth = rs.GetDistance(sp,
                            default_hwidth,
                            second_pt_msg="Half width of path")
    if hwidth is None: return

    #Store the new value in sticky for use next time
    sc.sticky["GP_WIDTH"] = hwidth

    trad = rs.GetDistance(sp, default_trad, second_pt_msg="Radius of tiles")
    if trad is None: return

    #Store  the new value in sticky for use next time
    sc.sticky["GP_RAD"] = trad

    tspace = rs.GetDistance(sp,
                            default_tspace,
                            second_pt_msg="Distance between tiles")
    if tspace is None: return

    #Store  the new value in sticky for use next time
    sc.sticky["GP_SPACE"] = tspace

    # Calculate angles

    temp = rs.Angle(sp, ep)

    pangle = temp[0]

    plength = rs.Distance(sp, ep)

    width = hwidth * 2

    angp90 = pangle + 90.0

    angm90 = pangle - 90.0

    # To increase speed, disable redrawing

    rs.EnableRedraw(False)

    # Draw the outline of the path
    #make an empty list
    pline = []

    #add points to the list
    pline.append(rs.Polar(sp, angm90, hwidth))

    pline.append(rs.Polar(pline[0], pangle, plength))

    pline.append(rs.Polar(pline[1], angp90, width))

    pline.append(rs.Polar(pline[2], pangle + 180.0, plength))

    #add the first point back on to the end of the list to close the pline
    pline.append(pline[0])

    #create the polyline from the lst of points.
    rs.AddPolyline(pline)

    # Draw the rows of tiles

    #define a plane -
    #using the WorldXY plane the reults will always be added parallel to that plane,
    #regardless of the active plane where the points are picked.

    plane = rs.WorldXYPlane()

    pdist = trad + tspace

    off = 0.0

    while (pdist <= plength - trad):

        #Place one row of tiles given distance along path

        # and possibly offset it

        pfirst = rs.Polar(sp, pangle, pdist)

        pctile = rs.Polar(pfirst, angp90, off)

        pltile = pctile

        while (rs.Distance(pfirst, pltile) < hwidth - trad):

            plane = rs.MovePlane(plane, pltile)

            rs.AddCircle(plane, trad)

            pltile = rs.Polar(pltile, angp90, tspace + trad + trad)

        pltile = rs.Polar(pctile, angm90, tspace + trad + trad)

        while (rs.Distance(pfirst, pltile) < hwidth - trad):

            plane = rs.MovePlane(plane, pltile)

            rs.AddCircle(plane, trad)

            pltile = rs.Polar(pltile, angm90, tspace + trad + trad)

        pdist = pdist + ((tspace + trad + trad) * Sin(math.radians(60)))

        if off == 0.0:

            off = (tspace + trad + trad) * Cos(math.radians(60))

        else:

            off = 0.0
コード例 #28
0
def xf_shear(ctr, vx=(1, 0, 0), vy=(0, 1, 0), vz=(0, 0, 1)):
    pln = rs.MovePlane(rs.WorldXYPlane(), ctr)
    xform = Rhino.Geometry.Transform.Shear(pln, rs.CreateVector(vx),
                                           rs.CreateVector(vy),
                                           rs.CreateVector(vz))
    return xform
コード例 #29
0
ファイル: shlCutPlan.py プロジェクト: SHLFab/shl-toolbox
def rc_cut_plan(boundary_brep, cut_heights, floor_guids, use_epsilon):

    bb = rs.BoundingBox(boundary_brep)
    max_z = bb[4].Z
    min_z = bb[0].Z
    crv_list, layer_list, refpt_list, bdims_list = [[], [], [], []]

    for i, guids in enumerate(floor_guids):
        if not (min_z < cut_heights[i] < max_z): continue
        outline_crv, internals, refpt, bdims = process_floor(
            guids, boundary_brep, cut_heights[i])

        mp = Rhino.Geometry.AreaMassProperties.Compute(outline_crv)
        outline_crv_centroid = mp.Centroid
        corner_style = Rhino.Geometry.CurveOffsetCornerStyle.Sharp
        offset_crv = outline_crv.Offset(outline_crv_centroid,
                                        rs.coerce3dvector([0, 0, 1]),
                                        THICKNESS, D_TOL, corner_style)
        offset_crv_geometry = offset_crv[0]

        crv_list.append([[offset_crv_geometry], internals])
        layer_list.append([LCUT_INDICES[1], LCUT_INDICES[2]])
        refpt_list.append(refpt)
        bdims_list.append(bdims)
    #...brep conversion may be necessary

    if len(crv_list) == 0:
        print "Error: Cut planes do not intersect the envelope brep"
        return None

    #set base for output.
    xbase = 0
    ybase = 0
    #set the amount to move up from the bottom of the brep for cutting the lower outline.
    #this should be replaced by a projection of the bottom face of the brep.
    epsilon = D_TOL * 2

    select_items = []

    increment = max(d.X for d in bdims_list) + GAP_SIZE * 1
    dplane_list = get_drawing_planes(bdims_list, rs.WorldXYPlane(), GAP_SIZE)
    refplane_list = [rs.MovePlane(rs.WorldXYPlane(), pt) for pt in refpt_list]

    for i, floor in enumerate(crv_list):
        t = Rhino.Geometry.Transform.ChangeBasis(dplane_list[i],
                                                 refplane_list[i])

        for j, layer_crvs in enumerate(floor):
            for c in layer_crvs:
                c.Transform(t)
            select_items.extend(
                wru.add_curves_to_layer(layer_crvs, layer_list[i][j]))

        labelpt = (bdims_list[i].X / 2 + dplane_list[i].Origin.X,
                   bdims_list[i].Y / 2 + dplane_list[i].OriginY, 0)
        td = rs.AddTextDot(str(i + 1), labelpt)
        rs.ObjectLayer(td, "XXX_LCUT_00-GUIDES")
        select_items.append(td)

    rs.UnselectAllObjects()
    rs.SelectObjects(select_items)
    rs.Redraw()
    rs.EnableRedraw(True)