Forum Discussion

boddydan's avatar
boddydan
Frequent Visitor
4 years ago
Solved

Python Visual - View 3D model (e.g. stl) using vtkplotlib (or other)

I'm trying to create a python visual of a 3D model (such as a .stl file). I've successfully used some python code to show the visual, however it appears as a new window rather than within my visual.

import vtkplotlib as vpl
from stl.mesh import Mesh
mesh = Mesh.from_file("x.stl")
fig = vpl.figure()
mesh = vpl.mesh_plot(mesh)
vpl.show()

I don't need the visual to be interactive, just a static image, but it's not acting like matplotlib as the show() is creating a new window on top of Power BI. I've tried disabling the interactive element by using 'vpl.show(block=False)', however this still creates a new window for a split second and then terminates the script.

Does anybody know how to avoid the creation of a new window and instead show my graphic within the Power BI visual? Or does anybody know of any open-source alternatives I can use to display a 3D model within Power BI? Thanks.

1 Reply