Commit fbdeac9558f3848fe57b0d3e0bc13f584e14de7c
1 parent
8c1efe92
Exists in
master
and in
68 other branches
ADD: Export ASCII STL (fix #137)
Showing
3 changed files
with
15 additions
and
7 deletions
Show diff stats
invesalius/constants.py
invesalius/data/surface.py
... | ... | @@ -515,7 +515,8 @@ class SurfaceManager(): |
515 | 515 | filename, filetype = pubsub_evt.data |
516 | 516 | if (filetype == const.FILETYPE_STL) or\ |
517 | 517 | (filetype == const.FILETYPE_VTP) or\ |
518 | - (filetype == const.FILETYPE_PLY) : | |
518 | + (filetype == const.FILETYPE_PLY) or\ | |
519 | + (filetype == const.FILETYPE_STL_ASCII): | |
519 | 520 | |
520 | 521 | # First we identify all surfaces that are selected |
521 | 522 | # (if any) |
... | ... | @@ -541,6 +542,9 @@ class SurfaceManager(): |
541 | 542 | if filetype == const.FILETYPE_STL: |
542 | 543 | writer = vtk.vtkSTLWriter() |
543 | 544 | writer.SetFileTypeToBinary() |
545 | + elif filetype == const.FILETYPE_STL_ASCII: | |
546 | + writer = vtk.vtkSTLWriter() | |
547 | + writer.SetFileTypeToASCII() | |
544 | 548 | elif filetype == const.FILETYPE_VTP: |
545 | 549 | writer = vtk.vtkXMLPolyDataWriter() |
546 | 550 | #elif filetype == const.FILETYPE_IV: | ... | ... |
invesalius/gui/task_exporter.py
... | ... | @@ -39,6 +39,7 @@ WILDCARD_SAVE_3D = "Inventor (*.iv)|*.iv|"\ |
39 | 39 | "PLY (*.ply)|*.ply|"\ |
40 | 40 | "Renderman (*.rib)|*.rib|"\ |
41 | 41 | "STL (*.stl)|*.stl|"\ |
42 | + "STL ASCII (*.stl)|*.stl|"\ | |
42 | 43 | "VRML (*.vrml)|*.vrml|"\ |
43 | 44 | "VTK PolyData (*.vtp)|*.vtp|"\ |
44 | 45 | "Wavefront (*.obj)|*.obj" |
... | ... | @@ -47,16 +48,18 @@ INDEX_TO_TYPE_3D = {0: const.FILETYPE_IV, |
47 | 48 | 1: const.FILETYPE_PLY, |
48 | 49 | 2: const.FILETYPE_RIB, |
49 | 50 | 3: const.FILETYPE_STL, |
50 | - 4: const.FILETYPE_VRML, | |
51 | - 5: const.FILETYPE_VTP, | |
52 | - 6: const.FILETYPE_OBJ} | |
51 | + 4: const.FILETYPE_STL_ASCII, | |
52 | + 5: const.FILETYPE_VRML, | |
53 | + 6: const.FILETYPE_VTP, | |
54 | + 7: const.FILETYPE_OBJ} | |
53 | 55 | INDEX_TO_EXTENSION = {0: "iv", |
54 | 56 | 1: "ply", |
55 | 57 | 2: "rib", |
56 | 58 | 3: "stl", |
57 | - 4: "vrml", | |
58 | - 5: "vtp", | |
59 | - 6: "obj"} | |
59 | + 4: "stl", | |
60 | + 5: "vrml", | |
61 | + 6: "vtp", | |
62 | + 7: "obj"} | |
60 | 63 | |
61 | 64 | WILDCARD_SAVE_2D = "BMP (*.bmp)|*.bmp|"\ |
62 | 65 | "JPEG (*.jpg)|*.jpg|"\ | ... | ... |