def onSaveModel(self, event): if self.scanningWorkbench.sceneView._object is None: return dlg = wx.FileDialog(self, _("Save 3D model"), os.path.split(profile.getPreference('last_file'))[0], style=wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT) fileExtensions = meshLoader.saveSupportedExtensions() wildcardList = ';'.join(map(lambda s: '*' + s, fileExtensions)) wildcardFilter = "Mesh files (%s)|%s;%s" % (wildcardList, wildcardList, wildcardList.upper()) dlg.SetWildcard(wildcardFilter) if dlg.ShowModal() == wx.ID_OK: filename = dlg.GetPath() if not filename.endswith('.ply'): if sys.isLinux(): #hack for linux, as for some reason the .ply is not appended. filename += '.ply' meshLoader.saveMesh(filename, self.scanningWorkbench.sceneView._object) self.appendLastFile(filename) dlg.Destroy()
def onSaveModel(self, event): if self.scanningWorkbench.sceneView._object is None: return dlg = wx.FileDialog(self, _("Save 3D model"), os.path.split(profile.getPreference('last_file'))[0], style=wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT) fileExtensions = meshLoader.saveSupportedExtensions() wildcardList = ';'.join(map(lambda s: '*' + s, fileExtensions)) wildcardFilter = "Mesh files (%s)|%s;%s" % (wildcardList, wildcardList, wildcardList.upper()) dlg.SetWildcard(wildcardFilter) if dlg.ShowModal() == wx.ID_OK: filename = dlg.GetPath() if not filename.endswith('.ply'): if platform.system() == 'Linux': #hack for linux, as for some reason the .ply is not appended. filename += '.ply' meshLoader.saveMesh(filename, self.scanningWorkbench.sceneView._object) self.appendLastFile(filename) dlg.Destroy()