cq_toplevel: remove dead code from export_png_image
This commit is contained in:
@@ -21,7 +21,7 @@ import pinephone
|
|||||||
import ldtek_battery
|
import ldtek_battery
|
||||||
|
|
||||||
from cadquery.occ_impl.assembly import toVTK
|
from cadquery.occ_impl.assembly import toVTK
|
||||||
from cadquery.vis import _to_assy, _vtkRenderWindow
|
from cadquery.vis import _to_assy
|
||||||
from vtkmodules.vtkRenderingCore import vtkRenderWindow, vtkWindowToImageFilter
|
from vtkmodules.vtkRenderingCore import vtkRenderWindow, vtkWindowToImageFilter
|
||||||
from vtkmodules.vtkIOImage import vtkPNGWriter
|
from vtkmodules.vtkIOImage import vtkPNGWriter
|
||||||
|
|
||||||
@@ -29,14 +29,9 @@ from vtkmodules.vtkIOImage import vtkPNGWriter
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
def export_png_image(obj, file_: str):
|
def export_png_image(obj, file_: str):
|
||||||
# obj = obj.val().scale(2)
|
|
||||||
# obj = obj.transformed(offset=(0, 0, 0))
|
|
||||||
assy = _to_assy(obj)
|
assy = _to_assy(obj)
|
||||||
# win = _vtkRenderWindow(assy)
|
|
||||||
renderer = toVTK(assy)
|
renderer = toVTK(assy)
|
||||||
win = vtkRenderWindow()
|
win = vtkRenderWindow()
|
||||||
# win.SetMultiSamples(16)
|
|
||||||
# win.SetSize(1024, 1024)
|
|
||||||
win.AddRenderer(renderer)
|
win.AddRenderer(renderer)
|
||||||
win.Render()
|
win.Render()
|
||||||
camera = renderer.GetActiveCamera()
|
camera = renderer.GetActiveCamera()
|
||||||
@@ -49,15 +44,11 @@ def export_png_image(obj, file_: str):
|
|||||||
renderer.ResetCamera()
|
renderer.ResetCamera()
|
||||||
renderer.SetBackground(0.8, 0.8, 0.8)
|
renderer.SetBackground(0.8, 0.8, 0.8)
|
||||||
|
|
||||||
# win.SetPosition(-10, 0)
|
|
||||||
|
|
||||||
win.Render()
|
win.Render()
|
||||||
|
|
||||||
# documented here: <https://examples.vtk.org/site/Python/IO/ImageWriter/>
|
# documented here: <https://examples.vtk.org/site/Python/IO/ImageWriter/>
|
||||||
win_to_input = vtkWindowToImageFilter()
|
win_to_input = vtkWindowToImageFilter()
|
||||||
win_to_input.SetInput(win)
|
win_to_input.SetInput(win)
|
||||||
# win_to_input.SetScale(5)
|
|
||||||
# win_to_input.SetViewport(0, 0, 5, 5)
|
|
||||||
win_to_input.SetInputBufferTypeToRGB()
|
win_to_input.SetInputBufferTypeToRGB()
|
||||||
win_to_input.ReadFrontBufferOff()
|
win_to_input.ReadFrontBufferOff()
|
||||||
win_to_input.Update()
|
win_to_input.Update()
|
||||||
|
Reference in New Issue
Block a user