def move_vertex(cablenet, settings): key = CablenetHelper.select_vertex(cablenet) if key is None: return constraint = None name = cablenet.vertex[key]['constraint'] rail = find_constraint(name) if rail: constraint = rail.Geometry if CablenetHelper.move_vertex(cablenet, key, constraint=constraint, allow_off=False): x, y, z = cablenet.vertex_coordinates(key) _, t = rail.Geometry.ClosestPoint(Point3d(x, y, z), 0.0) cablenet.set_vertex_attribute(key, 'param', t) cablenet.draw(layer=settings['layer'], clear_layer=True, settings=settings) else: if CablenetHelper.move_vertex(cablenet, key): cablenet.draw(layer=settings['layer'], clear_layer=True, settings=settings)
def move_vertices(cablenet, settings): keys = CablenetHelper.select_vertices(cablenet) if not keys: return if CablenetHelper.move_vertices(cablenet, keys): cablenet.draw(layer=settings['layer'], clear_layer=True, settings=settings)
def RunCommand(is_interactive): if "FOFIN" not in sc.sticky: print("Initialise the plugin first!") return FOFIN = sc.sticky['FOFIN'] if not FOFIN['cablenet']: return fkey = CablenetHelper.select_face(FOFIN['cablenet']) if fkey is None: return u, v = CablenetHelper.select_vertices(FOFIN['cablenet']) mesh_split_face(FOFIN['cablenet'], fkey, u, v) FOFIN['cablenet'].cull_vertices() FOFIN['cablenet'].draw(layer=FOFIN['settings']['layer'], clear_layer=True, settings=FOFIN['settings'])
def RunCommand(is_interactive): if "FOFIN" not in sc.sticky: print("Initialise the plugin first!") return FOFIN = sc.sticky['FOFIN'] if not FOFIN['cablenet']: return key = CablenetHelper.select_edge(FOFIN['cablenet']) if key is None: return split_row(FOFIN['cablenet'], key) FOFIN['cablenet'].draw(layer=FOFIN['settings']['layer'], clear_layer=True, settings=FOFIN['settings'])
def RunCommand(is_interactive): if 'FOFIN' not in sc.sticky: print("Initialise the plugin first!") return FOFIN = sc.sticky['FOFIN'] if not FOFIN['cablenet']: return keys = CablenetHelper.select_edges(FOFIN['cablenet']) scale = rs.GetReal("Scaling factor", 1.0, 0.1, 10.0) if not scale: return for edge in keys: q = FOFIN['cablenet'].get_edge_attribute(edge, 'q') FOFIN['cablenet'].set_edge_attribute(edge, 'q', scale * q) FOFIN['cablenet'].draw(layer=FOFIN['settings']['layer'], clear_layer=True, settings=FOFIN['settings'])
def select_parallel_edges(cablenet): keys = CablenetHelper.select_edges(cablenet) keys = CablenetHelper.select_parallel_edges(cablenet, keys) highlight_edges(cablenet, keys) return keys
def select_continuous_edges(cablenet): keys = CablenetHelper.select_edges(cablenet) keys = CablenetHelper.select_continuous_edges(cablenet, keys) highlight_edges(cablenet, keys) return keys
def update_face_attributes(cablenet, settings): keys = CablenetHelper.select_faces(cablenet) if keys: return CablenetHelper.update_face_attributes(cablenet, keys)
}) artist.draw_edges() artist.redraw() cablenet = Cablenet.from_obj(compas.get('faces.obj')) for key, attr in cablenet.vertices(True): attr['is_anchor'] = cablenet.vertex_degree(key) == 2 artist = CablenetArtist(cablenet, layer="Mesh::FD") draw() while True: selected = CablenetHelper.select_vertices(cablenet) if not selected: break if CablenetHelper.update_vertex_attributes(cablenet, selected): cablenet_fd(cablenet) draw() while True: selected = CablenetHelper.select_edges(cablenet) if not selected: break if CablenetHelper.update_edge_attributes(cablenet, selected): cablenet_fd(cablenet) draw()
cablenet_fd_alglib(cablenet) artist = CablenetArtist(cablenet, layer="FoFin::Cablenet") def draw(): artist.clear_layer() artist.draw_vertices() artist.draw_edges() artist.redraw() draw() while True: keys = CablenetHelper.select_vertices(cablenet) if not keys: break if CablenetHelper.update_vertex_attributes(cablenet, keys): cablenet_fd_alglib(cablenet) draw() while True: keys = CablenetHelper.select_edges(cablenet) if not keys: break if CablenetHelper.update_edge_attributes(cablenet, keys): cablenet_fd_alglib(cablenet) draw() artist.clear_layer()