def create_cablenet_from_lines(settings): guids = compas_rhino.select_lines() if not guids: return lines = compas_rhino.get_line_coordinates(guids) cablenet = Cablenet.from_lines(lines) return cablenet
# ============================================================================== # Make a cablenet # ============================================================================== # FILE = compas.get('quadmesh.obj') # cablenet = Cablenet.from_obj(FILE) HERE = os.path.dirname(__file__) FILE_I = os.path.join(HERE, 'lines.obj') FILE_O = os.path.join(HERE, 'lines.json') obj = OBJ(FILE_I) lines = [[obj.vertices[u], obj.vertices[v]] for u, v in obj.lines] cablenet = Cablenet.from_lines(lines, delete_boundary_face=True) cablenet.edges_attribute('is_edge', False, keys=list(cablenet.edges_on_boundary())) # ============================================================================== # Select a starting edge # ============================================================================== start = random.choice( list(set(cablenet.edges()) - set(cablenet.edges_on_boundary()))) # ============================================================================== # Continuous edges and parallel edges # ==============================================================================