from compas_rhino.helpers import MeshArtist __author__ = ['Tom Van Mele', 'Matthias Rippmann'] __copyright__ = 'Copyright 2017, BRG - ETH Zurich', __license__ = 'MIT' __email__ = '*****@*****.**' # select the points # select the boundary # select the hole(s) guids = compas_rhino.select_points("Select points.") points = compas_rhino.get_point_coordinates(guids) guid = compas_rhino.select_polyline("Select boundary.") boundary = compas_rhino.get_polyline_coordinates(guid) guids = compas_rhino.select_polylines("Select holes.") holes = [compas_rhino.get_polyline_coordinates(guid) for guid in guids] # make a delaunay triangulation # within the boundary # and around the holes faces = delaunay_from_points(points, boundary=boundary, holes=holes) mesh = Mesh.from_vertices_and_faces(points, faces) # draw the result artist = MeshArtist(mesh)
from compas_rhino.geometry import RhinoMesh from compas_rhino.geometry import RhinoCurve from compas_rhino.conduits import MeshConduit from compas_rhino.artists import MeshArtist # set the remeshing parameters length = 0.25 kmax = 300 # select the original mesh # select the border # select the fixed points guid_target = compas_rhino.select_mesh() guid_border = compas_rhino.select_polyline() guid_points = compas_rhino.select_points() # wrap the Rhino mesh object for convenience # wrap the Rhino curve object for convenience # get the point coordinates target = RhinoMesh(guid_target) border = RhinoCurve(guid_border) points = compas_rhino.get_point_coordinates(guid_points) # make a mesh datastructure from the Rhino mesh # triangulate the mesh mesh = mesh_from_guid(Mesh, guid_target) mesh_quads_to_triangles(mesh)
"""Delaunay triangulation with boundary""" from compas.datastructures.mesh import Mesh from compas.datastructures.mesh.algorithms import delaunay_from_points import compas_rhino as rhino __author__ = ['Tom Van Mele', 'Matthias Rippmann'] __copyright__ = 'Copyright 2017, BRG - ETH Zurich', __license__ = 'MIT' __email__ = '*****@*****.**' guids = rhino.select_points() vertices = rhino.get_point_coordinates(guids) guid = rhino.select_polyline("Select boundary.") boundary = rhino.get_polyline_coordinates(guid) guids = rhino.select_polylines("Select holes.") holes = [rhino.get_polyline_coordinates(guid) for guid in guids] faces = delaunay_from_points(vertices, boundary, holes) mesh = Mesh() mesh = mesh.from_vertices_and_faces(vertices, faces) rhino.draw_mesh(mesh)