Hello, Solutions Developer Community of Practice,
In the context of Solutions/Web apps development, Ansys PyGeometry introduces the exciting feature of trame support. This feature allows for plotting geometry with trame in a web browser with just one argument to the design plot function. 📊
This is a highly useful feature for solution developers who wish to incorporate 3D interactive geometry visualization. For more information, refer to the following issue on the PyGeometry repository:
🔗 PyGeometry Issue #1110
⚠️ Note: There is a minor modification required with the local PyGeometry(v0.4.14) installation to get it working. Update as follows:
self.server = get_server(client_type='vue2') # within TrameVisualizer class `
📌 Location:
ansys/pyansys-geometry/blob/main/src/ansys/geometry/core/plotting/trame_gui.py, line no 44`.
This modification would be required until the fix is available.
🔍 Example Test Case
from ansys.geometry.core import launch_modeler
from ansys.geometry.core.misc import UNITS, Distance, DEFAULT_UNITS
from ansys.geometry.core.math import Point2D
from ansys.geometry.core.sketch import Sketch
from ansys.geometry.core.plotting import PlotterHelper
import pyvista as pv
DEFAULT_UNITS.LENGTH = UNITS.mm
modeler = launch_modeler(mode='spaceclaim')
# launch_modeler.USE_TRAME=True
base_sketch = Sketch()
base_sketch.segment(Point2D([0,0]), Point2D([0,10]))
base_sketch.segment(Point2D([0,10]), Point2D([10,10]))
base_sketch.segment(Point2D([10,10]), Point2D([10,0]))
base_sketch.segment(Point2D([10,0]), Point2D([0,0]))
# Start by creating the Design
design = modeler.create_design("ModelingDemo")
# Create a body directly on the design by extruding the sketch
body = design.extrude_sketch(
name="Design_Body", sketch=base_sketch, distance=Distance(10, unit=UNITS.mm)
)
# design plot
design.plot(use_trame=True)