|
14 | 14 | _color_map = ModuleImportRaiser(_error_message_vedo_import, err) |
15 | 15 | _get_color = ModuleImportRaiser(_error_message_vedo_import, err) |
16 | 16 |
|
| 17 | +from gustaf import Faces as _Faces |
17 | 18 | from gustaf import Vertices as _Vertices |
| 19 | +from gustaf import Volumes as _Volumes |
18 | 20 |
|
19 | 21 | from splinepy.utils.log import debug as _debug |
20 | 22 | from splinepy.utils.log import warning as _warning |
@@ -260,8 +262,11 @@ def _export_gustaf_object( |
260 | 262 | r, g, b = _get_color(gus_object.show_options.get("c", "red")) |
261 | 263 | a = gus_object.show_options.get("alpha", 1.0) |
262 | 264 | radius = gus_object.show_options.get("r", 0.1) |
| 265 | + stroke_width = gus_object.show_options.get("lw", 0.1) |
263 | 266 |
|
264 | | - if isinstance(gus_object, _Vertices): |
| 267 | + if isinstance(gus_object, _Vertices) and not isinstance( |
| 268 | + gus_object, _Faces |
| 269 | + ): |
265 | 270 | data_name = gus_object.show_options.get("data", None) |
266 | 271 | if data_name is not None: |
267 | 272 | # Retrieve information on colors and values |
@@ -330,6 +335,31 @@ def _export_gustaf_object( |
330 | 335 | dy=str(dx), |
331 | 336 | ) |
332 | 337 | text_element.text = label |
| 338 | + if isinstance(gus_object, _Faces) and not isinstance(gus_object, _Volumes): |
| 339 | + svg_faces = _ET.SubElement( |
| 340 | + svg_spline_element, |
| 341 | + "g", |
| 342 | + id="faces", |
| 343 | + style=( |
| 344 | + f"fill:none;stroke:{_rgb_2_hex(r,g,b)};stroke-opacity:{a};" |
| 345 | + f"stroke-width:{stroke_width};stroke-linecap:round" |
| 346 | + ), |
| 347 | + ) |
| 348 | + |
| 349 | + # Create a new face-group |
| 350 | + for face in gus_object.faces: |
| 351 | + edge_points = gus_object.vertices[[*face, face[0]], :] |
| 352 | + |
| 353 | + _ET.SubElement( |
| 354 | + svg_faces, |
| 355 | + "polyline", |
| 356 | + points=" ".join( |
| 357 | + [ |
| 358 | + str(xx - box_min_x) + "," + str(box_max_y - xy) |
| 359 | + for (xx, xy) in edge_points |
| 360 | + ] |
| 361 | + ), |
| 362 | + ) |
333 | 363 |
|
334 | 364 | else: |
335 | 365 | raise NotImplementedError( |
|
0 commit comments