Exemplo n.º 1
0
	def OnLoadModel(self, e):
		dlg=wx.FileDialog(self, "Open file to print", os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST)
		dlg.SetWildcard(meshLoader.wildcardFilter())
		if dlg.ShowModal() == wx.ID_OK:
			self.filelist = [dlg.GetPath()]
			profile.putPreference('lastFile', ';'.join(self.filelist))
			self.preview3d.loadModelFiles(self.filelist, True)
			self.preview3d.setViewMode("Normal")
		dlg.Destroy()
Exemplo n.º 2
0
	def _showOpenDialog(self, title, wildcard = meshLoader.wildcardFilter()):
		dlg=wx.FileDialog(self, title, os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST)
		dlg.SetWildcard(wildcard)
		if dlg.ShowModal() == wx.ID_OK:
			filename = dlg.GetPath()
			dlg.Destroy()
			if not(os.path.exists(filename)):
				return False
			profile.putPreference('lastFile', filename)
			return filename
		dlg.Destroy()
		return False
Exemplo n.º 3
0
 def OnLoadModel(self, e):
     dlg = wx.FileDialog(self,
                         "Open file to print",
                         os.path.split(
                             profile.getPreference('lastFile'))[0],
                         style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
     dlg.SetWildcard(meshLoader.wildcardFilter())
     if dlg.ShowModal() == wx.ID_OK:
         self.filelist = [dlg.GetPath()]
         profile.putPreference('lastFile', ';'.join(self.filelist))
         self.preview3d.loadModelFiles(self.filelist, True)
         self.preview3d.setViewMode("Normal")
     dlg.Destroy()
Exemplo n.º 4
0
	def OnAddModel(self, e):
		dlg=wx.FileDialog(self, "Open file to print", os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST|wx.FD_MULTIPLE)
		dlg.SetWildcard(meshLoader.wildcardFilter())
		if dlg.ShowModal() == wx.ID_OK:
			for filename in dlg.GetPaths():
				item = ProjectObject(self, filename)
				profile.putPreference('lastFile', item.filename)
				self.list.append(item)
				self.selection = item
				self._updateListbox()
				self.OnListSelect(None)
		self.preview.Refresh()
		dlg.Destroy()
Exemplo n.º 5
0
	def OnAddModel(self, e):
		dlg=wx.FileDialog(self, "Open file to print", os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST|wx.FD_MULTIPLE)
		dlg.SetWildcard(meshLoader.wildcardFilter())
		if dlg.ShowModal() == wx.ID_OK:
			for filename in dlg.GetPaths():
				item = ProjectObject(self, filename)
				profile.putPreference('lastFile', item.filename)
				self.list.append(item)
				self.selection = item
				self._updateListbox()
				self.OnListSelect(None)
		self.preview.Refresh()
		dlg.Destroy()
Exemplo n.º 6
0
	def onLoad(self, event):

		dlg = wx.FileDialog(self, "Open file to print", style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
		dlg.SetWildcard(meshLoader.wildcardFilter())

		if dlg.ShowModal() == wx.ID_OK:
			frame = self.GetParent().GetParent().GetParent()
			frame.filename = dlg.GetPath() 
			frame.step5_panel.ClearPrintSummary()
			profile.putPreference('lastFile', frame.filename)
			transform = frame.step2_panel
			transform.load(frame.filename)
			frame.onNext(None)
		dlg.Destroy()
Exemplo n.º 7
0
 def _showOpenDialog(self, title, wildcard=meshLoader.wildcardFilter()):
     dlg = wx.FileDialog(self,
                         title,
                         os.path.split(
                             profile.getPreference('lastFile'))[0],
                         style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
     dlg.SetWildcard(wildcard)
     if dlg.ShowModal() == wx.ID_OK:
         filename = dlg.GetPath()
         dlg.Destroy()
         if not (os.path.exists(filename)):
             return False
         profile.putPreference('lastFile', filename)
         return filename
     dlg.Destroy()
     return False
Exemplo n.º 8
0
	def OnCutMesh(self, e):
		dlg=wx.FileDialog(self, "Open file to cut", os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST)
		dlg.SetWildcard(meshLoader.wildcardFilter())
		if dlg.ShowModal() == wx.ID_OK:
			filename = dlg.GetPath()
			model = meshLoader.loadMesh(filename)
			pd = wx.ProgressDialog('Splitting model.', 'Splitting model into multiple parts.', model.vertexCount, self, wx.PD_ELAPSED_TIME | wx.PD_REMAINING_TIME | wx.PD_SMOOTH)
			parts = model.splitToParts(pd.Update)
			for part in parts:
				partFilename = filename[:filename.rfind('.')] + "_part%d.stl" % (parts.index(part))
				stl.saveAsSTL(part, partFilename)
				item = ProjectObject(self, partFilename)
				self.list.append(item)
				self.selection = item
				self._updateListbox()
				self.OnListSelect(None)
			pd.Destroy()
		self.preview.Refresh()
		dlg.Destroy()
Exemplo n.º 9
0
	def OnCutMesh(self, e):
		dlg=wx.FileDialog(self, "Open file to cut", os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST)
		dlg.SetWildcard(meshLoader.wildcardFilter())
		if dlg.ShowModal() == wx.ID_OK:
			filename = dlg.GetPath()
			model = meshLoader.loadMesh(filename)
			pd = wx.ProgressDialog('Splitting model.', 'Splitting model into multiple parts.', model.vertexCount, self, wx.PD_ELAPSED_TIME | wx.PD_REMAINING_TIME | wx.PD_SMOOTH)
			parts = model.splitToParts(pd.Update)
			for part in parts:
				partFilename = filename[:filename.rfind('.')] + "_part%d.stl" % (parts.index(part))
				stl.saveAsSTL(part, partFilename)
				item = ProjectObject(self, partFilename)
				self.list.append(item)
				self.selection = item
				self._updateListbox()
				self.OnListSelect(None)
			pd.Destroy()
		self.preview.Refresh()
		dlg.Destroy()