From fbdeac9558f3848fe57b0d3e0bc13f584e14de7c Mon Sep 17 00:00:00 2001 From: tatiana Date: Fri, 29 Jan 2010 18:50:26 +0000 Subject: [PATCH] ADD: Export ASCII STL (fix #137) --- invesalius/constants.py | 1 + invesalius/data/surface.py | 6 +++++- invesalius/gui/task_exporter.py | 15 +++++++++------ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/invesalius/constants.py b/invesalius/constants.py index a0f9e08..cb5ece8 100644 --- a/invesalius/constants.py +++ b/invesalius/constants.py @@ -374,6 +374,7 @@ MODE_SLICE_CROSS = -3 FILETYPE_IV = wx.NewId() FILETYPE_RIB = wx.NewId() FILETYPE_STL = wx.NewId() +FILETYPE_STL_ASCII = wx.NewId() FILETYPE_VRML = wx.NewId() FILETYPE_OBJ = wx.NewId() FILETYPE_VTP = wx.NewId() diff --git a/invesalius/data/surface.py b/invesalius/data/surface.py index 0d06930..628eef0 100644 --- a/invesalius/data/surface.py +++ b/invesalius/data/surface.py @@ -515,7 +515,8 @@ class SurfaceManager(): filename, filetype = pubsub_evt.data if (filetype == const.FILETYPE_STL) or\ (filetype == const.FILETYPE_VTP) or\ - (filetype == const.FILETYPE_PLY) : + (filetype == const.FILETYPE_PLY) or\ + (filetype == const.FILETYPE_STL_ASCII): # First we identify all surfaces that are selected # (if any) @@ -541,6 +542,9 @@ class SurfaceManager(): if filetype == const.FILETYPE_STL: writer = vtk.vtkSTLWriter() writer.SetFileTypeToBinary() + elif filetype == const.FILETYPE_STL_ASCII: + writer = vtk.vtkSTLWriter() + writer.SetFileTypeToASCII() elif filetype == const.FILETYPE_VTP: writer = vtk.vtkXMLPolyDataWriter() #elif filetype == const.FILETYPE_IV: diff --git a/invesalius/gui/task_exporter.py b/invesalius/gui/task_exporter.py index 6d4b049..86fba85 100644 --- a/invesalius/gui/task_exporter.py +++ b/invesalius/gui/task_exporter.py @@ -39,6 +39,7 @@ WILDCARD_SAVE_3D = "Inventor (*.iv)|*.iv|"\ "PLY (*.ply)|*.ply|"\ "Renderman (*.rib)|*.rib|"\ "STL (*.stl)|*.stl|"\ + "STL ASCII (*.stl)|*.stl|"\ "VRML (*.vrml)|*.vrml|"\ "VTK PolyData (*.vtp)|*.vtp|"\ "Wavefront (*.obj)|*.obj" @@ -47,16 +48,18 @@ INDEX_TO_TYPE_3D = {0: const.FILETYPE_IV, 1: const.FILETYPE_PLY, 2: const.FILETYPE_RIB, 3: const.FILETYPE_STL, - 4: const.FILETYPE_VRML, - 5: const.FILETYPE_VTP, - 6: const.FILETYPE_OBJ} + 4: const.FILETYPE_STL_ASCII, + 5: const.FILETYPE_VRML, + 6: const.FILETYPE_VTP, + 7: const.FILETYPE_OBJ} INDEX_TO_EXTENSION = {0: "iv", 1: "ply", 2: "rib", 3: "stl", - 4: "vrml", - 5: "vtp", - 6: "obj"} + 4: "stl", + 5: "vrml", + 6: "vtp", + 7: "obj"} WILDCARD_SAVE_2D = "BMP (*.bmp)|*.bmp|"\ "JPEG (*.jpg)|*.jpg|"\ -- libgit2 0.21.2