Ejemplo n.º 1
0
def framemulti(srfs):
    rs.EnableRedraw(False)
    rs.SelectObjects(srfs)
    rs.Command("reparameterize a")
    rs.UnselectAllObjects()
    frames = []
    allgroup = rs.AddGroup()
    for srf in srfs:
        group = rs.AddGroup()
        frame = []
        if option == 2:
            frame.append(isoframe(srf, 0, intervalx, vec2))
        elif option == 1:
            frame.append(isoframe(srf, 0, intervalx, vec2))
            frame.append(extframe(srf))
        else:
            frame.append(isoframe(srf, 0, intervalx, vec2))
            frame.append(isoframe(srf, 1, intervaly, vec2))
            frame.append(extframe(srf, vec1))
        frame = [x for x in frame if x]
        frame = list(reduce(lambda x, y: x + y, frame))
        rs.AddObjectsToGroup(frame, group)
        frames.append(frame)
        # print frame
    # for frame in frames: rs.SelectObjects(frame)
    frames = [x for x in frames if x]
    frames = list(reduce(lambda x, y: x + y, frames))
    rs.AddObjectsToGroup(frames, allgroup)
    rs.SelectObjects(frames)
    rs.EnableRedraw(True)
    return frames
Ejemplo n.º 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)

    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
Ejemplo n.º 3
0
def RunCommand(is_interactive):
    global params

    pitch_line = rs.GetObject(message="Select pitch line",
                              filter=rs.filter.curve,
                              preselect=True)
    if pitch_line is None:
        return 1  # Cancel

    if not rs.IsLine(pitch_line):
        print "Selected curve is not a line!"
        return 1  # Cancel

    rs.SelectObjects(pitch_line)

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

    if m is None or pa is None:
        return 1  # Cancel

    params["m"] = m
    params["pa"] = pa

    pitch_line_center = rs.CurveMidPoint(pitch_line)
    pitch_line_start = rs.CurveStartPoint(pitch_line)
    pitch_line_end = rs.CurveEndPoint(pitch_line)
    angle, reflex_angle = rs.Angle2(line1=((0, 0, 0), (1, 0, 0)),
                                    line2=(pitch_line_start, pitch_line_end))

    x_vector = rs.VectorCreate(pitch_line_end, pitch_line_start)
    y_vector = rs.VectorRotate(x_vector, 90.0, [0, 0, 1])
    cplane = rs.PlaneFromFrame(origin=pitch_line_center,
                               x_axis=x_vector,
                               y_axis=y_vector)

    xform = rs.XformChangeBasis(cplane, rs.WorldXYPlane())

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

    rack = draw_rack(length=rs.CurveLength(pitch_line),
                     module=params["m"],
                     pressure_angle=params["pa"])

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

    rs.EnableRedraw(True)
    rs.UnselectAllObjects()
    rs.SelectObjects(rack)

    return 0  # Success
Ejemplo n.º 4
0
def CopyObjectsToLayer():
    "Copy selected objects to a different layer"
    # Get the objects to copy
    objectIds = rs.GetObjects("Select objects")
    # Get all layer names
    layerNames = rs.LayerNames()
    if (objectIds == None or layerNames == None): return

    # Make sure select objects are unselected
    rs.UnselectObjects(objectIds)

    layerNames.sort()
    # Get the destination layer
    layer = rs.ComboListBox(layerNames,
                            "Destination Layer <" + rs.CurrentLayer() + ">")
    if layer:
        # Add the new layer if necessary
        if (not rs.IsLayer(layer)): rs.AddLayer(layer)
        # Copy the objects
        newObjectIds = rs.CopyObjects(objectIds)

        # Set the layer of the copied objects
        [rs.ObjectLayer(id, layer) for id in newObjectIds]
        # Select the newly copied objects
        rs.SelectObjects(newObjectIds)
Ejemplo n.º 5
0
def makePlan():
    """
    make2d from above.
    input: list of layers to make2d
    returns: None
    """
    objs = rs.ObjectsByGroup("Below")
    
    #Make2d
    rs.SelectObjects(objs)
    rs.Command("-_make2d _D _U _Enter")
    projLines = rs.GetObjects("", preselect = True)
    
    #Get make2d root layer
    make2dRootRaw = rs.ObjectLayer(projLines[0])
    make2dRoot = make2dRootRaw.split("::")[0]
    
    #Rename make2d layers
    root  = rs.AddLayer("60_PLANS")
    roofLay = rs.AddLayer("Roof", parent = root)
    for projLine in projLines:
        linesLayer = rs.ObjectLayer(projLine)
        linesColor = rs.ObjectColor(projLine)
        linesLayerName = rs.LayerName(linesLayer, fullpath = False)
        newLayers = rs.AddLayer(linesLayerName, parent = roofLay, color = linesColor)
        rs.ObjectLayer(projLine,newLayers)
        rs.ObjectColor(projLine, (200,200,200))
    
    #Delete make2d Layers
    rs.DeleteLayer(make2dRoot)
    return
Ejemplo n.º 6
0
def RunCommand(is_interactive):
    config = get_sisufile()
    if not config:
        print('Sisufile not configured')
        return Rhino.Commands.Result.Failure

    items = config['data']
    out = []
    failed_objects = []
    result = {}
    for item in items:
        if not 'code' in item:
            print('failed to process item: code not found')
            continue

        # calc existing layer only
        layer_name = item['layer'][0]
        if not rs.IsLayer(layer_name):
            continue

        c = item.get('code')
        units = c.get('units')
        if not units:
            print('failed to process dc item: units not specified')

        if units == UNIT_PIECE:
            upd, failed = calc_piece(c)
            failed_objects = failed_objects + failed
            result.update(upd)

        if units == UNIT_M2:
            upd, failed = calc_m2(c)
            failed_objects = failed_objects + failed
            result.update(upd)

        if units == UNIT_M:
            upd, failed = calc_m(c)
            failed_objects = failed_objects + failed
            result.update(upd)

    if len(failed_objects) > 0:
        print('failed to calc')
        rs.SelectObjects([x.Id for x in failed_objects])
    else:
        now = datetime.date.today()
        prefix = now.strftime('%Y%m%d')
        doc = rs.DocumentPath()
        filename = '%s-SISU_CALC.csv' % prefix
        filepath = os.path.join(doc, filename)
        print('saving to file... %s' % filepath)
        save_sisu_calc_report(result, filepath)
    #    try:
    #        conf = get_layer_config(code)
    #        conf.update(item)
    #        out.append(conf)
    #    except Exception as e:
    #        print('DC failed. Fill defaults', code, e)
    ##        conf.update(default_config)

    return Rhino.Commands.Result.Success
Ejemplo n.º 7
0
def export(structure):
    # create output dir if not exists
    if not os.path.exists(outdir):
        print "creating output dir: " + outdir
        os.makedirs(outdir)

    rs.CurrentLayer("Default")
    utils.show_blocks()
    utils.show_subsystems()
    rs.ZoomExtents()
    utils.hide_subsystems()
    utils.hide_non_subsystems()
    for subsystem, v in structure.items():
        utils.show_only(subsystem)
        for step, vv in v.items():
            for partkind, vvv in vv.items():
                rs.UnselectAllObjects()
                rs.SelectObjects(vvv)
                filename = utils.get_part_filename(subsystem,
                                                   utils.get_layer_tail(step),
                                                   partkind)
                outpath = os.path.join(outdir, filename)
                print "exporting step file: " + outpath
                rs.Command(
                    "_-Export " + outpath +
                    " Schema=AP214AutomotiveDesign ExportParameterSpaceCurves=Yes LetImportingApplicationSetColorForBlackObjects=Yes _Enter"
                )
def addComponent():
    libPath = 'C:\\Users\\Tim\\Desktop\\temp\\library'
    rhinoFiles = []

    items = os.listdir(libPath)

    if items is None:
        print "Library is empty or path is wrong"
        return

    for item in items:
        parts = item.split(".")
        if len(parts) == 2:
            if parts[1] == "3dm":
                rhinoFiles.append(parts[0])

    choice = rs.ComboListBox(rhinoFiles, "Select Components to add",
                             "add Component")
    if choice is None:
        return
    choiceFile = choice + ".3dm"
    rs.EnableRedraw(False)
    rs.Command('-_NoEcho _-Import ' + libPath + "\\" + choiceFile +
               ' Objects Enter -_SelLast Enter')
    importedGeo = rs.GetObjects(preselect=True)
    rs.ObjectLayer(importedGeo, rs.CurrentLayer())
    rs.SelectObjects(importedGeo)
    rs.EnableRedraw(True)
Ejemplo n.º 9
0
def main():
    rs.EnableRedraw(enable=False)
    
    walls = []
    parentFolder = rs.CurrentLayer()
    if re.search("::", parentFolder):
        parentFolder = parentFolder.rsplit("::", 1)[0]
    try:
        walls = rs.ObjectsByLayer(parentFolder + "::A-WALL")
    except ValueError:
        print("No Wall Sublayers in this Layer")
    try:
        walls.extend(rs.ObjectsByLayer(parentFolder + "::A-AREA-BOUNDARY"))
    except ValueError:
        pass
    
    if not walls:
        print("No walls on this floor.")
        return None
    
    curves = []
    
    for wall in walls:
        if rs.IsCurve(wall):
            curves.append(wall)
    rs.SelectObjects(curves)
    
    rs.EnableRedraw(enable=True)
Ejemplo n.º 10
0
def AutoExport(objs):
    appData = os.getenv('APPDATA')
    targetFolder = appData + r"\PCPA\temp.dwg"
    rs.SelectObjects(objs)
    rs.Command(
        '-_Export ' + '"' + targetFolder + '"' + ' s "2007 Natural" Enter ',
        True)
Ejemplo n.º 11
0
def main():
    print("script_start")
    objs = rs.GetObjects("select objects to export", 0, True, True)

    if not objs:
        print "abort"
        return

# check curves for deviation from c-plane
    result = checkCurvePosition(objs)

    # if ok, start export
    if result:
        #make curve direction all the same
        setCurveDir(objs)

        rs.UnselectAllObjects()

        # move to origin
        objs = copyToOrigin(objs)

        # export
        rs.SelectObjects(objs)
        rs.Command("Export")

        rs.DeleteObjects(objs)
    else:
        print "abort"
        return
def outputFunc(objs):
    """Extracts the bottom faces of each solid in selection

    Args:
        objs (list of ids): list of ids

    Returns:
        list: list of bottom faces
    """

    rs.EnableRedraw(False)
    bottomFaces = []
    for obj in objs:
        resultFaces = trp.getBottomFace(obj)
        # print resultFaces
        for resultFace in resultFaces:
            trp.copySourceLayer(resultFace, obj)
            try:
                trp.copySourceData(resultFace, obj)
            except:
                pass
            bottomFaces.append(resultFace)
    rs.SelectObjects(bottomFaces)
    group = rs.AddGroup()
    rs.AddObjectsToGroup(bottomFaces, group)
    rs.EnableRedraw(True)
    return bottomFaces
Ejemplo n.º 13
0
def main():
    msg = "Select polysurface objects to export data"
    objs = rs.GetObjects(msg, 16, preselect=True)
    if not objs: return
    extrusions = []
    rs.UnselectAllObjects()
    for obj in objs:
        if rs.ObjectType(obj) == 1073741824:
            extrusions.append(obj)
    if len(extrusions) > 0:
        rs.SelectObjects(extrusions)
        resp = rs.MessageBox(
            "Selected objects will be converted to polysurfaces.\n Press OK to continue, Cancel to abort",
            1)
        if resp == 1:
            rs.Command("ConvertExtrusion _Enter")
            rs.UnselectAllObjects()
        else:
            return
    keys = [i.name for i in ATTRS if i.isEditable]
    makeDetail(keys, objs)
    details = []
    spec = dict([])
    ids = dict([])
    for obj in objs:
        detail = Detail(obj)
        details.append(detail)
    spec = Specification([], details)
    dialog = SpecDialog()
    dialog.setData(spec)
    rs.UnselectAllObjects()
    Rhino.UI.EtoExtensions.ShowSemiModal(dialog, Rhino.RhinoDoc.ActiveDoc,
                                         Rhino.UI.RhinoEtoApp.MainWindow)
Ejemplo n.º 14
0
def checkCurvePosition(objs):
    layers = []
    selection = []
    for obj in objs:
        if rs.IsCurve(obj):
            if not isCurveOnCPlane(obj):
                # print "Curve {} not on Cplane".format(obj)
                selection.append(obj)
                appendLayer(layers, obj)

        elif rs.IsPoint(obj):
            if not isPointOnCplane(obj):
                # print "Curve {} not on Cplane".format(obj)
                rs.SelectObject(obj)
                appendLayer(layers, obj)
        else:
            print "object {} is not a curve or point. {}".format(
                obj, rs.ObjectType(obj))

    if len(selection) > 0:
        rs.SelectObjects(selection)

    # when an object is found on > 0 layers, prompt for proceed
    if len(layers) > 0:
        msg = "there were non-planar or elevated curves found on layers:\n"
        for layer in layers:
            msg = msg + "- " + layer + " \n"

        msg = msg + '\n Do you want to proceed?'

        if rs.MessageBox(msg, 1) != 1:
            return False

    # else
    return True
def main():
    rs.EnableRedraw(enable=False)

    walls = []
    parentFolder = rs.CurrentLayer()
    if re.search("::", parentFolder):
        parentFolder = parentFolder.rsplit("::", 1)[0]
    walls = []
    for wallLayer in wallLayers:
        try:
            walls.extend(rs.ObjectsByLayer(parentFolder + "::" + wallLayer))
        except ValueError:
            print("No curves on layer " + parentFolder + "::" + wallLayer)
            pass

    if not walls:
        print("No walls on this floor.")
        return None

    curves = []

    for wall in walls:
        if rs.IsCurve(wall):
            curves.append(wall)
    rs.SelectObjects(curves)

    rs.EnableRedraw(enable=True)
Ejemplo n.º 16
0
def intersections():
    """Intersects all surfaces in model. Uses python cmd line, not api."""
    sc.doc.Views.Redraw()
    layer('INTERSECTIONS')
    objs = rs.AllObjects()
    rs.SelectObjects(objs)
    rs.Command('_Intersect', echo=False)
    frac_isect_ids = rs.LastCreatedObjects()
    rs.UnselectAllObjects()
    if frac_isect_ids:
        for intid in frac_isect_ids:
            if rs.IsCurve(intid):
                rs.AddPoint(rs.CurveStartPoint(intid))
                rs.AddPoint(rs.CurveEndPoint(intid))
        if len(frac_isect_ids) > 1:
            rs.SelectObjects(frac_isect_ids)
            rs.Command('_Intersect', echo=False)
Ejemplo n.º 17
0
def exportToDxf(objs):

    rs.SelectObjects(objs)

    # rs.SaveFileName(extension".dxf")

    # rs.Command("-_export /documents/acdf.dxf")
    rs.Command("'_export")
 def try_good_args():
     try_name = 'good_args'
     u.Utilities.make_grammar_3_initial_shapes_4_rules()
     message = "%s %s" % ("Select a frame instance.",
                          "The elements in the frame will be selected")
     frame_instance_in = rs.GetObject(message,
                                      s.Settings.block_instance_filter)
     actual_value = gd.GuidsToDat._get_elements(frame_instance_in)
     rs.SelectObjects(actual_value)
Ejemplo n.º 19
0
def srfExtrude(srfs):
    rs.EnableRedraw(False)
    # for srf in srfs:
    rs.SelectObjects(srfs)
    rs.Command('_ExtrudeSrf _Pause')
    objs = rs.LastCreatedObjects()
    map(trp.copySourceLayer, objs, srfs)
    map(trp.copySourceData, objs, srfs)
    rs.EnableRedraw(True)
Ejemplo n.º 20
0
def ex3DS(objs):
    rs.MessageBox("Remember to check backfaces!")
    if objs is None:
        return
    rs.SelectObjects(objs)
    savePath = rs.SaveFileName("Save", "Autocad (*.dwg)|*.dwg||")
    rs.Command('! _-Export ' + str(savePath) +
               ' _Scheme _to3DSMax _Enter _Enter')
    print "Exported to {}".format(str(savePath))
Ejemplo n.º 21
0
def thicken(surf, h=1):
    s = rh.OffsetSurface(surf.realize()._ref, h, None, True, True)
    if not s:
        rh.UnselectAllObjects()
        rh.SelectObjects(surf.refs())
        rh.Command("OffsetSrf BothSides=Yes Solid=Yes {0} _Enter".format(h))
        s = single_ref_or_union(rh.LastCreatedObjects())
    surf.delete()
    return s
 def try_empty_frame():
     try_name = 'empty_frame'
     u.Utilities.make_grammar_1_initial_shape_1_delete_rule()
     message = "%s %s" % ("Select the empty frame instance.",
                          "Nothing will be selected")
     frame_instance = rs.GetObject(message,
                                   s.Settings.block_instance_filter)
     actual_value = gd.GuidsToDat._get_elements(frame_instance)
     rs.SelectObjects(actual_value)
Ejemplo n.º 23
0
def multiLineCurve():
    """
    --- --- --- --- --- --- --- --- --- --- ---
    -------------------------------------------
    --- --- --- --- --- --- --- --- --- --- --- 
    this script divides a curve by length and adds dashes to either side of the curve, grouped per curve / polyline
    limitation: does not accomodate at corners (to avoid ccx issues)
    www.studiogijs.nl
    """
    curves = rs.GetObjects("select curves to change into multiline-style",4, preselect=True)
    if not curves:
        return
    s=sc.sticky['scale'] if sc.sticky.has_key('scale') else 20
    scale = rs.GetReal("scale of the multiline curve", s, 5, 100)
     
    
    if not scale:
        return
    sc.sticky['scale']=scale
    
    rs.EnableRedraw(False)
    
    for curve in curves:
        lines=[]
        if rs.CurveLength(curve)>scale:
            pts = rs.DivideCurveLength(curve, scale)
            for pt in pts:
                t=rs.CurveClosestPoint(curve, pt)
                vec = rs.CurveTangent(curve, t)*scale/5
                line = rs.AddLine(pt-vec, pt+vec)
                trans = rs.VectorRotate(vec, 90, [0,0,1])
                trans/=2
                line_copy = rs.CopyObject(line, trans)
                trans = -trans
                lines.append(line_copy)
                rs.MoveObject(line, trans)
                lines.append(line)
            group = rs.AddGroup()
            rs.AddObjectsToGroup(lines, group)
            rs.AddObjectsToGroup(curve, group)
            rs.SelectObjects(lines)
            rs.SelectObjects(curves)
    rs.EnableRedraw(True)
 def try_objects():
     try_name = 'objects'
     g.Grammar.clear_all()
     layer_name = 'layer_x'
     l.Layer.new(layer_name)
     frame_name = layer_name
     frame_position = (0, 0, 0)
     frame_guid = f.Frame.new_instance(layer_name, frame_position)
     object_guids_on_layer = _make_objects_on_layer(layer_name)
     actual_value = gd.GuidsToDat._extract_elements_in_frame(
         frame_guid, object_guids_on_layer)
     rs.SelectObjects(actual_value)
def Orthographic_Cplane():
    cpln_current = rs.ViewCPlane()
    Bool_Osnap = rs.Osnap()
    point = cpln_current.Origin
    if Bool_Osnap:
        rs.Osnap(False)
    
    rs.Command("_Circle 0,0,0 ")
    
    #
    rs.EnableRedraw(False)
    #
    Circle = rs.LastCreatedObjects()
    if Bool_Osnap:
        rs.Osnap(True)
        
        
    if Circle is None:
            #
        rs.EnableRedraw(True)
    #
        return
            
    if not rs.IsObject(Circle):
        rs.EnableRedraw(True)
        return
    
        
    rs.Command("_Point 0,0,1 ")
    pt_pos = rs.LastCreatedObjects()
    rs.Command("_Point 0,0,-1 ") 
    pt_neg = rs.LastCreatedObjects()
    
    pt_cam = rs.ViewCamera()
    
    dist_pos = rs.Distance(pt_cam,pt_pos)
    dist_neg = rs.Distance(pt_cam,pt_neg)
    
    print pt_cam
    
    Disk = rs.AddPlanarSrf(Circle)
    rs.UnselectAllObjects()
    rs.SelectObjects(Disk)
    
    if dist_pos>dist_neg:
        rs.Command("OrientCameraToSrf _f 0,0,0 _pause")
    else:
        rs.Command("OrientCameraToSrf 0,0,0 _pause")
        
        
    rs.DeleteObjects((pt_pos,pt_neg,Circle,Disk))
    
    rs.ViewProjection(None,1)
Ejemplo n.º 26
0
def fenceCurve():
    """
    ---x---x---x---x---x---x---
    this script divides a curve by length and adds 'crosses' to it, grouped per curve / polyline
    www.studiogijs.nl
    """
    curves = rs.GetObjects("select curves to change into fence-style",
                           4,
                           preselect=True)
    if not curves:
        return

    s = sc.sticky['scale'] if sc.sticky.has_key('scale') else 20
    scale = rs.GetReal("scale of the arrow curve", s, 5, 100)

    if not scale:
        return
    sc.sticky['scale'] = scale

    rs.EnableRedraw(False)

    for curve in curves:
        lines = []
        if rs.CurveLength(curve) > scale:
            pts = rs.DivideCurveLength(curve, scale)
            for pt in pts:
                t = rs.CurveClosestPoint(curve, pt)
                vec = rs.CurveTangent(curve, t)
                line = rs.AddLine(pt - vec * scale / 10, pt + vec * scale / 10)
                rs.RotateObject(line, pt, 45)
                lines.append(line)
                line_copy = rs.RotateObject(line, pt, 90, copy=True)
                lines.append(line_copy)
            group = rs.AddGroup()
            rs.AddObjectsToGroup(lines, group)
            rs.AddObjectsToGroup(curve, group)
            rs.SelectObjects(lines)
            rs.SelectObjects(curves)
    rs.EnableRedraw(True)
Ejemplo n.º 27
0
def exportTEN_CAD():
    a = rs.GetObjects("Select Objects", preselect="True")
    b = rs.ScaleObjects(a, [0, 0, 0], [1000, 1000, 0], copy=True)
    rs.UnitSystem(2)

    savePath0 = rs.SaveFileName("Save", "Autocad (*.dwg)|*.dwg||")
    savePath1 = '"' + savePath0 + '"'
    rs.SelectObjects(b)
    rs.Command('_-Export ' + savePath1 + ' _Enter')
    rs.DeleteObjects(b)
    rs.UnitSystem(4)
    print "Exported"
    return None
Ejemplo n.º 28
0
def main():

    for name in rs.BlockNames():
        block = rs.InsertBlock(name, (0,0,0))
        
        rs.UnselectAllObjects()
        
        # explodblock
        uids = rs.ExplodeBlockInstance(block)
        
        rs.SelectObjects(uids)

        rs.Command('! _-Export _Pause "E:\\TNM\\template\\tools\\' + name + '.3dm" _Enter')
def make2dByLayer(layer):
    objs = rs.ObjectsByLayer(layer)
    if objs is None:
        return
    #Make2d

    rs.SelectObjects(objs)
    rs.Command("-_make2d _D _U _Enter")
    projLines = rs.GetObjects("Press escape", preselect=True)
    finalCrvs = rs.JoinCurves(projLines)
    rs.DeleteObjects(projLines)
    rs.MatchObjectAttributes(finalCrvs, objs[0])
    return finalCrvs
Ejemplo n.º 30
0
def main():
    rs.EnableRedraw(False)
    selected = rs.SelectedObjects()
    theObjs = rs.GetObject("Select objects on the layer you wish to select")

    layer = rs.ObjectLayer(theObjs)

    layerObjs = rs.ObjectsByLayer(layer)
    layerObjs.extend(selected)
    print(layerObjs)
    rs.SelectObjects(layerObjs)

    rs.EnableRedraw(True)