Exemplo n.º 1
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)
def room_from_rhino(frequencies, srf_dict, src_layer, src_power, mic_layer):

    room = Room()
    room.add_frequencies(frequencies)

    # add mics -------------------------------------------------------------
    mics = [
        list(rs.PointCoordinates(pt)) for pt in rs.ObjectsByLayer(mic_layer)
    ]
    room.add_spherical_recs(mics, radius=.3)

    # add source -----------------------------------------------------------
    sxyz = list(rs.PointCoordinates(rs.ObjectsByLayer(src_layer)[0]))
    room.add_fib_source(sxyz, power=src_power)

    # add surfaces ---------------------------------------------------------

    for key in srf_dict:
        layer = srf_dict[key]['layer']
        mat = srf_dict[key]['material']
        is_boundary = srf_dict[key]['is_boundary']
        guids = rs.ObjectsByLayer(layer)
        srf_pts = []
        for guid in guids:
            pts = [[pt.X, pt.Y, pt.Z] for pt in rs.SurfacePoints(guid)]
            pts = [pts[0], pts[1], pts[3], pts[2]]
            srf_pts.append(pts)
        room.add_material(layer, mat['abs'], mat['sct'], mat['trn'])
        room.add_room_surfaces(srf_pts, layer, is_boundary)

    return room
Exemplo n.º 3
0
    def export_rule_in_frames(self):
        """Exports a rule with shapes in frames
        """

        left_elements = rs.ObjectsByLayer('left', True)
        right_elements = rs.ObjectsByLayer('right', True)
        n_left_elements = len(left_elements)
        print('number of left elements: %i' % n_left_elements)
        n_right_elements = len(right_elements)
        print('number of right elements: %i' % n_right_elements)
Exemplo n.º 4
0
def CollectChairs():
    # collect chairs + CLs
    chair0 = rs.coercebrep(rs.ObjectsByLayer("chair0"))
    chair0_CL = rs.coercecurve(rs.ObjectsByLayer("chair0_CL"))
    chair1 = rs.coercebrep(rs.ObjectsByLayer("chair1"))
    chair1_CL = rs.coercecurve(rs.ObjectsByLayer("chair1_CL"))
    
    # create chair objects
    chair0_Obj = Chair(chair0, chair0_CL)
    chair1_Obj = Chair(chair1, chair1_CL)
    
    return([chair0_Obj, chair1_Obj])
Exemplo n.º 5
0
def find_objects_on_layer(name, include_hidden=True, include_children=True):
    if include_hidden:
        show_hidden_objects_on_layer(name)
    to_delete = rs.ObjectsByLayer(name)
    if include_children:
        to_visit = deque(rs.LayerChildren(name))
        while to_visit:
            name = to_visit.popleft()
            if include_hidden:
                show_hidden_objects_on_layer(name)
            to_delete += rs.ObjectsByLayer(name)
            if rs.LayerChildCount(name):
                to_visit.extend(rs.LayerChildren(name))
    return to_delete
Exemplo n.º 6
0
def generate_step_images(structure):
    global view_aspect
    w_l = conf['step_img_width']
    h_l = int(w_l / view_aspect)
    rs.CurrentLayer("Default")
    utils.show_blocks()
    utils.show_subsystems()
    rs.ZoomExtents()
    utils.hide_subsystems()
    utils.hide_non_subsystems()

    for iSub in xrange(len(structure)):
        subsystem = structure.keys()[iSub]
        v = structure[subsystem]
        if subsystem in conf['build_apart']:
            utils.hide_subsystems()
        rs.LayerVisible(subsystem, True)
        # utils.hide_non_subsystems()
        utils.hide_children(subsystem)
        for iStep in xrange(len(v)):
            step = v.keys()[iStep]
            vv = v[step]
            stepnumeral = str(iSub + 1) + '.' + str(iStep + 1)
            rs.LayerVisible(step, True)
            rs.UnselectAllObjects()
            rs.ObjectsByLayer(step, True)
            # create images
            create_image_set(stepnumeral, w_l, h_l)
        if subsystem in conf['build_apart']:
            # show all previous subsystems again
            rs.UnselectAllObjects()
            rs.InvertSelectedObjects()
            for sub in structure.keys():
                rs.LayerVisible(sub, True)
                if sub == subsystem:
                    break
            # images for subsystem installed
            finnumeral = str(iSub + 1) + '.' + str(len(v) + 1)
            create_image_set(finnumeral, w_l, h_l)
    # subsystem overview images
    for iSub in xrange(len(structure)):
        subsystem = structure.keys()[iSub]
        rs.UnselectAllObjects()
        # select subsystem and its step layers
        for child in rs.LayerChildren(subsystem):
            rs.ObjectsByLayer(child, True)
        finnumeral = str(iSub + 1) + '.0'
        create_image_set(finnumeral, w_l, h_l)
 def clear(self):
 
     objects = rs.ObjectsByLayer(self.name)
     for obj in objects:
         rs.DeleteObject(obj) 
         
     return self   
Exemplo n.º 8
0
    def collect_data_density(self):
        """Collect the existing density mesh in the density layer.

		Parameters
		----------

		Returns
		-------

		"""

        objects = rs.ObjectsByLayer('density')

        if objects is not None:

            if len(objects) == 1:
                if rs.ObjectType(objects[0]) == 32:

                    vertices, faces = RhinoGeometry.from_guid(
                        objects[0]).get_vertices_and_faces()
                    self.density_mesh = Mesh.from_vertices_and_faces(
                        vertices, faces)

                else:
                    print 'the object in the density layer is not a mesh'

            elif len(objects) > 1:
                print 'too many objects in the density layer'
Exemplo n.º 9
0
def get_breps_on_layer(layername):
    buildings = rs.ObjectsByLayer(layername)
    breps = []
    for b in buildings:
        if rs.ObjectType(b) == 16 or rs.ObjectType(b) == 1073741824:
            breps.append(b)
    return breps
Exemplo n.º 10
0
def ordered_network(structure, network, layer):
    """ Extract vertex and edge orders from a Network for a given start-point.

    Parameters
    ----------
    structure : obj
        Structure object.
    network : obj
        Network Datastructure object.
    layer : str
        Layer to extract start-point (Rhino point).
    Returns
    -------
    list
        Ordered nodes for the Structure.
    list
        Ordered elements for the Structure.
    list
        Cumulative length at element mid-points.
    float
        Total length.
    Notes
    -----
    - This function is for a Network representing a single structural element, i.e. with two end-points (leaves).
    """

    start = rs.PointCoordinates(rs.ObjectsByLayer(layer)[0])

    return network_order(start=start, structure=structure, network=network)
def GetLayerObjects(layer_name):
    #create a list to hold the layers objects
    layer_objects = rs.ObjectsByLayer(layer_name, select=False)
    #if the layer returned layer objects
    if (layer_objects):
        #return those objects
        return layer_objects
Exemplo n.º 12
0
def pre_process():
    # delete all previous user text
    all_objs = rs.AllObjects()
    for obj in all_objs:
        rh_obj = rs.coercerhinoobject(obj)
        rh_obj.Attributes.DeleteAllUserStrings()

    # remove all blocks
    for block in rs.BlockNames():
        rs.DeleteBlock(block)

    # set current layer
    rs.CurrentLayer(relevant_layers_dict["buildings"])

    # remove redundant layers
    for layer_name in rs.LayerNames():
        if layer_name not in relevant_layers_dict.values():
            rs.PurgeLayer(layer_name)

    # get all objects in building layer
    building_objs = rs.ObjectsByLayer(relevant_layers_dict["buildings"])

    for building_obj in building_objs:
        if rs.IsCurve(building_obj) and rs.IsCurveClosed(building_obj):

            # flatten curve to XY plane
            matrix = rs.XformPlanarProjection(rg.Plane.WorldXY)
            rs.TransformObject(building_obj, matrix, copy=False)

            # delete all object with a surface grater or smaller from MIN_BUILDING_AREA_SQ by TOLERANCE or just smaller than MIN_BUILDING_AREA_SQ
            TOLERANCE = 2
            if rs.CurveArea(building_obj)[0] < MIN_BUILDING_AREA_SQM or abs(
                    rs.CurveArea(building_obj)[0] -
                    MIN_BUILDING_AREA_SQM) < TOLERANCE:
                rs.DeleteObject(building_obj)
def cutAtPlan(level):
    planPlane = rs.AddPlaneSurface([-1000,-1000,level], 3000, 3000)
    baseLayer = rs.AddLayer("60_PLANS")
    newParent = rs.AddLayer("PLAN_"+str(level), parent = baseLayer)
    origLayer = rs.CurrentLayer()
    shortName = rs.LayerName(origLayer, fullpath = False)
    
    #newChildsParent = rs.AddLayer( , parent = newParent)
    newChild = rs.AddLayer(shortName, parent = newParent, color = rs.LayerColor(origLayer))
    rs.CurrentLayer(newChild)
    
    objs = rs.ObjectsByLayer(origLayer)
    #if len(objs)<1:
    #    skip = True
    intersectCrvs = []
    tempCrv = None
    for obj in objs:
        if rs.IsBrep(obj):
            
            tempCrv = rs.IntersectBreps(obj, planPlane)
        if tempCrv != None:
            intersectCrvs.append(tempCrv)
    
    for crv in intersectCrvs:
        if not None:
            rs.ObjectLayer(crv, newChild)
    
    rs.DeleteObject(planPlane)
    rs.CurrentLayer(origLayer)
Exemplo n.º 14
0
    def importSrfTypesFromScene(self):

        data = []
        # srfs=rs.ObjectsByLayer(get_layer_name('TYPESRF'))
        # for f in srfs:
        #     #rs.SelectObject(f)
        #     #rs.ObjectColor(f,(0,0,1))
        #     po=PhaseObject()
        #     po.guid=f
        #     po.phase='TYPESRF'
        #     po.typeIndex=int(rs.ObjectName(f))
        #     po.strTypeDescription=rs.ObjectName(f)
        #     self.updatePhaseObjectColor(po)
        #     data.append(po)
        # self.data=data
        # return
        objs = rs.ObjectsByLayer(get_layer_name('BLOCK'))
        for o in objs:
            po = PhaseObject()
            po.guid = o
            po.phase = 'BLOCK'
            name = rs.ObjectName(o)
            typeIndex = 0
            try:
                typeIndex = int(name)
            except:
                pass
            print(name, typeIndex)
            self.setObjectType(po, typeIndex, 0)
            data.append(po)

        self.data = data
Exemplo n.º 15
0
def get_polygons(layer=None):
    """Get all polygons.

    Parameters
    ----------
    layer : str, optional
        Name of a layer containing the polygons.

    Returns
    -------
    list[System.Guid]
        The identifiers of the polygons.

    """
    if layer:
        rs.EnableRedraw(False)
        # Argument names for LayerVisible command are not the same for Rhino5 and Rhino6
        # that is why we use positional instead of named arguments
        visible = rs.LayerVisible(layer, True, True)
        guids = rs.ObjectsByType(rs.filter.curve)
        guids = [guid for guid in guids if is_curve_polygon(guid)]
        guids = list(set(guids) & set(rs.ObjectsByLayer(layer)))
        rs.LayerVisible(layer, visible, True)
        rs.EnableRedraw(True)
    else:
        guids = rs.ObjectsByType(rs.filter.curve)
        guids = [guid for guid in guids if is_curve_polygon(guid)]
    return guids
Exemplo n.º 16
0
def get_edge_keys_and_param(message='Select edge.', layer=None):
    if layer:
        objs = rs.ObjectsByLayer(layer)
        selectable = []
        for obj in objs:
            if "edge" in rs.ObjectName(obj):
                selectable.append(obj)
    else:
        selectable = None
    guid = rs.GetObjectEx(message, 4, False, False, selectable)
    uv = None
    t = None
    if guid:
        guid = guid[0]
        name = rs.ObjectName(guid).split('.')
        if 'edge' in name:
            pt = rs.GetPointOnCurve(guid, "Select point on edge")
            if not pt: return None, None
            param = rs.CurveClosestPoint(guid, pt)
            lb, ub = rs.CurveDomain(guid)
            t = (param - lb) / (ub - lb)
            print(lb, ub)
            key = name[-1]
            uv = tuple(key.split('-'))
    return uv, t
def obj_layer(layer_name):
    '''trying to be able to call obj_layer on clos_pt with a particular
    layer name to give the corresponding cloud points a different parameter
    to move by
    '''
    layer = rs.ObjectsByLayer(layer_name)
    return layer
Exemplo n.º 18
0
def get_faces(mesh, layer=None):
    out = None
    if layer:
        objs = rs.ObjectsByLayer(layer)
        selectable = []
        for obj in objs:
            if "face" in rs.ObjectName(obj):
                selectable.append(obj)
    else:
        selectable = None

    faces = rs.GetObjects("Select faces",
                          4,
                          group=True,
                          preselect=False,
                          select=False,
                          objects=selectable)
    fkeys = []
    if faces:
        for face in faces:
            if face:
                name = rs.ObjectName(face)
                fkey = name.split(".")[-1]
                if fkey:
                    fkeys.append(fkey)
    return fkeys
Exemplo n.º 19
0
def LockAllOtherLayers():
    try:
        obj = rs.GetObject(message="Select the object on the layer you want to stay unlocked", filter=0,
                           preselect=True, select=False, custom_filter=None, subobjects=False)

        rs.EnableRedraw(False)

        groupName = random.random()

        layer = rs.ObjectLayer(obj)
        objs = rs.ObjectsByLayer(layer, select=False)
        allobj = rs.AllObjects(select=True, include_lights=False,
                               include_grips=False, include_references=False)
        rs.UnselectObjects(objs)
        toBeLockedObj = rs.SelectedObjects()
        rs.UnselectAllObjects()

        group = rs.AddGroup(groupName)
        rs.AddObjectsToGroup(toBeLockedObj, group)

        rs.LockGroup(groupName)

        rs.DeleteGroup(groupName)

        rs.EnableRedraw(True)

    except:
        rs.EnableRedraw(True)
        print("Failed to execute")
        return
Exemplo n.º 20
0
def ordered_network(structure, network, layer):
    """ Extract node and element orders from a Network for a given start-point.

    Parameters
    ----------
    structure : obj
        Structure object.
    network : obj
        Network object.
    layer : str
        Layer to extract start-point (Rhino point).

    Returns
    -------
    list
        Ordered nodes.
    list
        Ordered elements.
    list
        Cumulative lengths at element mid-points.
    float
        Total length.

    Notes
    -----
    - Function is for a Network representing a single structural element.

    """

    start = rs.PointCoordinates(rs.ObjectsByLayer(layer)[0])
    return network_order(start=start, structure=structure, network=network)
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)
Exemplo n.º 22
0
def get_feature_collection(base_layer):
    feature_collection = {'type': 'FeatureCollection', 'features': []}
    layer_name = base_layer
    geometry = rs.ObjectsByLayer(layer_name)
    for item in geometry:
        feature = get_feature(item)
        feature_collection['features'].append(feature)
    return feature_collection
def assign_materials_by_layer(lay_dict):
    for lay in lay_dict:
        srfs = rs.ObjectsByLayer(lay)
        abt = lay_dict[lay]['abs']
        sct = lay_dict[lay]['sct']
        trn = lay_dict[lay]['trn']
        for srf in srfs:
            pach_assign_material(srf, abt, sct, trn)
Exemplo n.º 24
0
def layer_objects_types(layer):
    object_types = []
    layer_objects = rs.ObjectsByLayer(layer)
    for object in layer_objects:
        object_type = rs.ObjectType(object)
        object_types.append(object_type)
    object_types = list(set(object_types))
    return object_types
Exemplo n.º 25
0
def layerSet(text, color):
    #deletes existing information regarding this layer
    if rs.LayerId(text):
        rs.DeleteObjects(rs.ObjectsByLayer(text))
        rs.PurgeLayer(text)

    #recomputes layer as new layer
    rs.AddLayer(text, color)
Exemplo n.º 26
0
 def clean_layers(self):
     
     try:
         rs.LayerLocked(PREVIEW_LAYER_NAME,False)
         rs.LayerLocked(LAYER_CLUSTER,False)
         rs.LayerLocked(LAYER_SORTING,False)
         rs.DeleteObjects(rs.ObjectsByLayer(PREVIEW_LAYER_NAME))
         rs.DeleteObjects(rs.ObjectsByLayer(LAYER_CLUSTER))
         rs.DeleteObjects(rs.ObjectsByLayer(LAYER_SORTING))
     except:
         preview_layer = rs.AddLayer(PREVIEW_LAYER_NAME, color=0, visible=True, locked=True, parent=None)
         rs.AddLayer(LAYER_SORTING, color=0, visible=True, locked=True, parent=preview_layer)
         rs.AddLayer(LAYER_CLUSTER, color=0, visible=True, locked=True, parent=preview_layer)
             
     rs.LayerLocked(PREVIEW_LAYER_NAME,True)
     rs.LayerLocked(LAYER_SORTING,True)
     rs.LayerLocked(LAYER_CLUSTER,True)
Exemplo n.º 27
0
def write_strip_data(layer, point_ind):
    # get all surfaces on layer
    strips = rs.ObjectsByLayer(layer)
    strip_ind = 1
    strip_dict = {}
    for strip in strips:
        # get only surfaces
        if rs.IsSurface(strip):
            if rs.IsSurfacePlanar(strip):
                strip_dict['Strip=' + layer + str(strip_ind)] = []
                strip_brep = rs.coercebrep(strip)
                edges = Rhino.Geometry.Brep.DuplicateEdgeCurves(strip_brep)
                edge_ids = []
                ind = 0
                for edge in edges:
                    edge_id = sc.doc.Objects.AddCurve(edge)
                    if edge_id:
                        rs.ObjectName(edge_id, 'active' + str(ind))
                        edge_ids.append(edge_id)
                        ind += 1
                # Get strip geometry
                # change color to help find strip
                rs.ObjectColor(strip, color=(255, 0, 255))
                start_edge = rs.GetObject('Select start edge.', 4, False,
                                          False, active_strip_filter)
                start_length = rs.CurveLength(start_edge)
                sp = rs.CurveMidPoint(start_edge)
                rs.ObjectName(rs.AddPoint(sp), name='SP_' + str(point_ind))
                end_edge = rs.GetObject('Select end edge.', 4, False, False,
                                        active_strip_filter)
                end_length = rs.CurveLength(end_edge)
                ep = rs.CurveMidPoint(end_edge)
                rs.ObjectName(rs.AddPoint(ep), name='SP_' + str(point_ind))
                # Clean up
                rs.DeleteObjects(edge_ids)
                rs.ObjectColor(strip, color=(128, 0, 128))
                # write to json
                start = {
                    'Point': point_ind,
                    'GlobalX': round(sp.X, 4),
                    'GlobalY': round(sp.Y, 4),
                    'WALeft': round(start_length * 0.5, 4),
                    'WARight': round(start_length * 0.5, 4),
                    'Autowiden': 'No'
                }
                point_ind += 1
                end = {
                    'Point': point_ind,
                    'GlobalX': round(ep.X, 4),
                    'GlobalY': round(ep.Y, 4),
                    'WBLeft': round(end_length * 0.5, 4),
                    'WBRight': round(end_length * 0.5, 4),
                }
                strip_dict['Strip=' + layer + str(strip_ind)].append(start)
                strip_dict['Strip=' + layer + str(strip_ind)].append(end)
                point_ind += 1
                strip_ind += 1
    return strip_dict
Exemplo n.º 28
0
def plot_reaction_forces(structure, step, layer=None, scale=1.0):
    """ Plots reaction forces for the Structure analysis results.

    Parameters
    ----------
    structure : obj
        Structure object.
    step : str
        Name of the Step.
    layer : str
        Layer name for plotting.
    scale : float
        Scale of the arrows.

    Returns
    -------
    None

    """

    if not layer:
        layer = '{0}-{1}'.format(step, 'reactions')

    rs.CurrentLayer(rs.AddLayer(layer))
    rs.DeleteObjects(rs.ObjectsByLayer(layer))
    rs.EnableRedraw(False)

    rfx = structure.results[step]['nodal']['rfx']
    rfy = structure.results[step]['nodal']['rfy']
    rfz = structure.results[step]['nodal']['rfz']

    nkeys = rfx.keys()
    v = [scale_vector([rfx[i], rfy[i], rfz[i]], -scale * 0.001) for i in nkeys]
    rm = [length_vector(i) for i in v]
    rmax = max(rm)
    nodes = structure.nodes_xyz(nkeys)

    for i in nkeys:

        if rm[i] > 0.001:
            l = rs.AddLine(nodes[i], add_vectors(nodes[i], v[i]))
            rs.CurveArrows(l, 1)
            col = [
                int(j) for j in colorbar(rm[i] / rmax, input='float', type=255)
            ]
            rs.ObjectColor(l, col)
            vector = [rfx[i], rfy[i], rfz[i]]
            name = json.dumps({
                'rfx': rfx[i],
                'rfy': rfy[i],
                'rfz': rfz[i],
                'rfm': length_vector(vector)
            })
            rs.ObjectName(l, '_' + name)

    rs.CurrentLayer(rs.AddLayer('Default'))
    rs.LayerVisible(layer, False)
    rs.EnableRedraw(True)
Exemplo n.º 29
0
    def make_code_button(self,sender,e):
        self.form.panel.Controls.Find("gcode_text", True)[0].Text = TXT["gencode"]
        self.code_thread = True
        #thread.start_new_thread(self.make_code_thread,(False,False))
        #self.make_code_thread(False,False)
        self.clean_layers()
 
        if self.user_data["selected_preset"] and self.rhino_objects:
            spkmodel_objects = {}
            for colorcode, objects in self.rhino_objects.iteritems():
                if objects:
                    spkmodel_objects[colorcode] =[]
                    for rh_object in objects:
                        try:
                            rs.UnselectAllObjects()
                            if colorcode == "points":
                                curve = g_curve(rh_object,self.machining_settings[self.user_data["selected_preset"]]["barrenado"],self.general_settings,0,False)
                            if colorcode == "curves_open":
                                curve = g_curve(rh_object,self.machining_settings[self.user_data["selected_preset"]]["grabado"],self.general_settings,0,False)
                            if colorcode == "curves_pocketing":
                                curve = g_curve(rh_object,self.machining_settings[self.user_data["selected_preset"]]["desbaste"],self.general_settings,-1,True)
                                #rs.ObjectLayer(curve.cut_curve,PREVIEW_LAYER_NAME)
                            if colorcode == "curves_outside":
                                curve = g_curve(rh_object,self.machining_settings[self.user_data["selected_preset"]]["corte"],self.general_settings,1,False)
                                #rs.ObjectLayer(curve.cut_curve,PREVIEW_LAYER_NAME)
                            if colorcode == "curves_inside":
                                curve = g_curve(rh_object,self.machining_settings[self.user_data["selected_preset"]]["corte"],self.general_settings,-1,False)
                                #rs.ObjectLayer(curve.cut_curve,PREVIEW_LAYER_NAME)
                            spkmodel_objects[colorcode].append(curve)
                        except ZeroDivisionError:
                            if rs.IsObject(rh_object):
                                dot = rs.AddTextDot("Error",rs.CurveStartPoint(rh_object) if not rs.IsPoint(rh_object) else rh_object)  
                                rs.ObjectLayer(dot,PREVIEW_LAYER_NAME)
                                objects_remaining = rs.ObjectsByLayer(OFFSET_LAYER)
                                if objects_remaining:
                                    rs.DeleteObjects(objects_remaining)
            self.spkmodel_objects = spkmodel_objects
            objects_remaining = rs.ObjectsByLayer(OFFSET_LAYER)
            if objects_remaining:
                rs.DeleteObjects(objects_remaining)
            thread.start_new_thread(self.make_code_thread,(False,False))
            
        else:
            rs.MessageBox(TXT["selobj_res_no"],0)
            self.form.panel.Controls.Find("gcode_text", True)[0].Text = "Error" 
Exemplo n.º 30
0
def del_noattr_plt():
    # get all objects in plots layer
    plot_objs = rs.ObjectsByLayer(relevant_layers_dict["plots"])

    for plot_obj in plot_objs:
        if rs.IsCurve(plot_obj) and rs.IsCurveClosed(plot_obj):
            some_attrib = rs.GetUserText(plot_obj, plot_attribs_list[0])
            if some_attrib == None:
                rs.DeleteObject(plot_obj)