|
1 | | -from compas.geometry import Point |
| 1 | +from compas.datastructures import Mesh |
2 | 2 | from compas.geometry import Box |
3 | | -from compas.geometry import Sphere |
| 3 | +from compas.geometry import Point |
4 | 4 | from compas.geometry import Polyline |
5 | | -from compas.datastructures import Mesh |
6 | | -from compas.utilities import hex_to_rgb |
7 | | - |
8 | | -from compas_rhino.artists import PointArtist, PolylineArtist, MeshArtist |
| 5 | +from compas.geometry import Sphere |
9 | 6 |
|
10 | 7 | # @me add restart option to init |
11 | 8 | from compas.rpc import Proxy |
| 9 | +from compas.utilities import hex_to_rgb |
| 10 | +from compas_rhino.artists import MeshArtist |
| 11 | +from compas_rhino.artists import PointArtist |
| 12 | +from compas_rhino.artists import PolylineArtist |
12 | 13 |
|
13 | 14 | proxy = Proxy() |
14 | 15 |
|
|
32 | 33 | # Remesh the sphere |
33 | 34 | # ============================================================================== |
34 | 35 |
|
35 | | -proxy.package = 'compas_cgal.meshing' |
| 36 | +proxy.package = "compas_cgal.meshing" |
36 | 37 |
|
37 | 38 | B = proxy.remesh(B, 0.3, 10) |
38 | 39 |
|
39 | 40 | # ============================================================================== |
40 | 41 | # Compute the intersections |
41 | 42 | # ============================================================================== |
42 | 43 |
|
43 | | -proxy.package = 'compas_cgal.intersections' |
| 44 | +proxy.package = "compas_cgal.intersections" |
44 | 45 |
|
45 | 46 | pointsets = proxy.intersection_mesh_mesh(A, B) |
46 | 47 |
|
|
63 | 64 | meshartist.mesh = Mesh.from_vertices_and_faces(*A) |
64 | 65 | meshartist.layer = "CGAL::Intersections::A" |
65 | 66 | meshartist.clear_layer() |
66 | | -meshartist.draw_faces(join_faces=True, color=hex_to_rgb('#222222')) |
| 67 | +meshartist.draw_faces(join_faces=True, color=hex_to_rgb("#222222")) |
67 | 68 |
|
68 | 69 | meshartist.mesh = Mesh.from_vertices_and_faces(*B) |
69 | 70 | meshartist.layer = "CGAL::Intersections::B" |
70 | 71 | meshartist.clear_layer() |
71 | | -meshartist.draw_faces(join_faces=True, color=hex_to_rgb('#888888')) |
| 72 | +meshartist.draw_faces(join_faces=True, color=hex_to_rgb("#888888")) |
72 | 73 |
|
73 | 74 | polylineartist = PolylineArtist(None, layer="CGAL::Intersections::Polylines") |
74 | 75 | polylineartist.clear_layer() |
75 | | -pointartist = PointArtist(None, layer='CGAL::Intersections::Points') |
| 76 | +pointartist = PointArtist(None, layer="CGAL::Intersections::Points") |
76 | 77 | pointartist.clear_layer() |
77 | 78 |
|
78 | 79 | for polyline in polylines: |
79 | 80 | polylineartist.primitive = polyline |
80 | | - polylineartist.color = hex_to_rgb('#ffffff') |
| 81 | + polylineartist.color = hex_to_rgb("#ffffff") |
81 | 82 | polylineartist.draw() |
82 | | - PointArtist.draw_collection( |
83 | | - polyline.points, color=(255, 0, 0), layer='CGAL::Intersections::Points') |
| 83 | + PointArtist.draw_collection(polyline.points, color=(255, 0, 0), layer="CGAL::Intersections::Points") |
84 | 84 |
|
85 | 85 | polylineartist.redraw() |
0 commit comments