Exemplo n.º 1
0
	def OnInfoSelect(self):
		if self.infoToolButton.getSelected():
			self.infoToolButton.setSelected(False)
			self.tool = previewTools.toolNone(self.glCanvas)
		else:
			self.infoToolButton.setSelected(True)
			self.tool = previewTools.toolInfo(self.glCanvas)
		self.rotateToolButton.setSelected(False)
		self.scaleToolButton.setSelected(False)
		self.returnToModelViewAndUpdateModel()
Exemplo n.º 2
0
 def OnInfoSelect(self):
     self.infoToolButton.setSelected(True)
     self.rotateToolButton.setSelected(False)
     self.scaleToolButton.setSelected(False)
     self.tool = previewTools.toolInfo(self.glCanvas)
     self.glCanvas.Refresh()
Exemplo n.º 3
0
	def OnInfoSelect(self):
		self.infoToolButton.setSelected(True)
		self.rotateToolButton.setSelected(False)
		self.scaleToolButton.setSelected(False)
		self.tool = previewTools.toolInfo(self.glCanvas)
		self.glCanvas.Refresh()
Exemplo n.º 4
0
    def __init__(self):
        super(projectPlanner, self).__init__(None,
                                             title='Cura - Project Planner')

        wx.EVT_CLOSE(self, self.OnClose)
        self.panel = wx.Panel(self, -1)
        self.SetSizer(wx.BoxSizer(wx.VERTICAL))
        self.GetSizer().Add(self.panel, 1, flag=wx.EXPAND)

        self.SetDropTarget(
            dropTarget.FileDropTarget(self.OnDropFiles,
                                      meshLoader.supportedExtensions()))

        self.list = []
        self.selection = None
        self.printMode = 0
        self.alwaysAutoPlace = profile.getPreference(
            'planner_always_autoplace') == 'True'

        self.machineSize = numpy.array([
            profile.getPreferenceFloat('machine_width'),
            profile.getPreferenceFloat('machine_depth'),
            profile.getPreferenceFloat('machine_height')
        ])
        self.headSizeMin = numpy.array([
            profile.getPreferenceFloat('extruder_head_size_min_x'),
            profile.getPreferenceFloat('extruder_head_size_min_y'), 0
        ])
        self.headSizeMax = numpy.array([
            profile.getPreferenceFloat('extruder_head_size_max_x'),
            profile.getPreferenceFloat('extruder_head_size_max_y'), 0
        ])

        self.extruderOffset = [
            numpy.array([0, 0, 0]),
            numpy.array([
                profile.getPreferenceFloat('extruder_offset_x1'),
                profile.getPreferenceFloat('extruder_offset_y1'), 0
            ]),
            numpy.array([
                profile.getPreferenceFloat('extruder_offset_x2'),
                profile.getPreferenceFloat('extruder_offset_y2'), 0
            ]),
            numpy.array([
                profile.getPreferenceFloat('extruder_offset_x3'),
                profile.getPreferenceFloat('extruder_offset_y3'), 0
            ])
        ]

        self.toolbar = toolbarUtil.Toolbar(self.panel)

        toolbarUtil.NormalButton(self.toolbar, self.OnLoadProject, 'open.png',
                                 'Open project')
        toolbarUtil.NormalButton(self.toolbar, self.OnSaveProject, 'save.png',
                                 'Save project')
        self.toolbar.AddSeparator()
        group = []
        toolbarUtil.RadioButton(self.toolbar,
                                group,
                                'object-3d-on.png',
                                'object-3d-off.png',
                                '3D view',
                                callback=self.On3DClick).SetValue(
                                    self.alwaysAutoPlace)
        toolbarUtil.RadioButton(
            self.toolbar,
            group,
            'object-top-on.png',
            'object-top-off.png',
            'Topdown view',
            callback=self.OnTopClick).SetValue(not self.alwaysAutoPlace)
        self.toolbar.AddSeparator()
        toolbarUtil.NormalButton(self.toolbar, self.OnPreferences,
                                 'preferences.png',
                                 'Project planner preferences')
        self.toolbar.AddSeparator()
        toolbarUtil.NormalButton(
            self.toolbar, self.OnCutMesh, 'cut-mesh.png',
            'Cut a plate STL into multiple STL files, and add those files to the project.\nNote: Splitting up plates sometimes takes a few minutes.'
        )
        toolbarUtil.NormalButton(
            self.toolbar, self.OnSaveCombinedSTL, 'save-combination.png',
            'Save all the combined STL files into a single STL file as a plate.'
        )
        self.toolbar.AddSeparator()
        group = []
        self.printOneAtATime = toolbarUtil.RadioButton(
            self.toolbar,
            group,
            'view-normal-on.png',
            'view-normal-off.png',
            'Print one object at a time',
            callback=self.OnPrintTypeChange)
        self.printAllAtOnce = toolbarUtil.RadioButton(
            self.toolbar,
            group,
            'all-at-once-on.png',
            'all-at-once-off.png',
            'Print all the objects at once',
            callback=self.OnPrintTypeChange)
        self.toolbar.AddSeparator()
        toolbarUtil.NormalButton(self.toolbar, self.OnQuit, 'exit.png',
                                 'Close project planner')

        self.toolbar.Realize()

        self.toolbar2 = toolbarUtil.Toolbar(self.panel)

        toolbarUtil.NormalButton(self.toolbar2, self.OnAddModel,
                                 'object-add.png', 'Add model')
        toolbarUtil.NormalButton(self.toolbar2, self.OnRemModel,
                                 'object-remove.png', 'Remove model')
        self.toolbar2.AddSeparator()
        toolbarUtil.NormalButton(self.toolbar2, self.OnMoveUp, 'move-up.png',
                                 'Move model up in print list')
        toolbarUtil.NormalButton(self.toolbar2, self.OnMoveDown,
                                 'move-down.png',
                                 'Move model down in print list')
        toolbarUtil.NormalButton(self.toolbar2, self.OnCopy, 'copy.png',
                                 'Make a copy of the current selected object')
        toolbarUtil.NormalButton(
            self.toolbar2, self.OnSetCustomProfile, 'set-profile.png',
            'Set a custom profile to be used to prepare a specific object.')
        self.toolbar2.AddSeparator()
        if not self.alwaysAutoPlace:
            toolbarUtil.NormalButton(
                self.toolbar2, self.OnAutoPlace, 'autoplace.png',
                'Automaticly organize the objects on the platform.')
        toolbarUtil.NormalButton(self.toolbar2, self.OnSlice, 'slice.png',
                                 'Prepare to project into a gcode file.')
        self.toolbar2.Realize()

        sizer = wx.GridBagSizer(2, 2)
        self.panel.SetSizer(sizer)
        self.glCanvas = PreviewGLCanvas(self.panel, self)
        self.listbox = wx.ListBox(self.panel, -1, choices=[])
        self.addButton = wx.Button(self.panel, -1, "Add")
        self.remButton = wx.Button(self.panel, -1, "Remove")
        self.sliceButton = wx.Button(self.panel, -1, "Prepare")
        if not self.alwaysAutoPlace:
            self.autoPlaceButton = wx.Button(self.panel, -1, "Auto Place")

        sizer.Add(self.toolbar, (0, 0),
                  span=(1, 1),
                  flag=wx.EXPAND | wx.LEFT | wx.RIGHT)
        sizer.Add(self.toolbar2, (0, 1),
                  span=(1, 2),
                  flag=wx.EXPAND | wx.LEFT | wx.RIGHT)
        sizer.Add(self.glCanvas, (1, 0), span=(5, 1), flag=wx.EXPAND)
        sizer.Add(self.listbox, (1, 1), span=(1, 2), flag=wx.EXPAND)
        sizer.Add(self.addButton, (2, 1), span=(1, 1))
        sizer.Add(self.remButton, (2, 2), span=(1, 1))
        sizer.Add(self.sliceButton, (3, 1), span=(1, 1))
        if not self.alwaysAutoPlace:
            sizer.Add(self.autoPlaceButton, (3, 2), span=(1, 1))
        sizer.AddGrowableCol(0)
        sizer.AddGrowableRow(1)

        self.addButton.Bind(wx.EVT_BUTTON, self.OnAddModel)
        self.remButton.Bind(wx.EVT_BUTTON, self.OnRemModel)
        self.sliceButton.Bind(wx.EVT_BUTTON, self.OnSlice)
        if not self.alwaysAutoPlace:
            self.autoPlaceButton.Bind(wx.EVT_BUTTON, self.OnAutoPlace)
        self.listbox.Bind(wx.EVT_LISTBOX, self.OnListSelect)

        panel = wx.Panel(self.panel, -1)
        sizer.Add(panel, (5, 1), span=(1, 2))

        sizer = wx.GridBagSizer(2, 2)
        panel.SetSizer(sizer)

        self.rotateToolButton = openglGui.glButton(self.glCanvas, 1, 'Rotate',
                                                   (0, 1), self.OnRotateSelect)
        self.scaleToolButton = openglGui.glButton(self.glCanvas, 2, 'Scale',
                                                  (0, 2), self.OnScaleSelect)

        self.SetSize((800, 600))

        self.tool = previewTools.toolInfo(self.glCanvas)
Exemplo n.º 5
0
	def __init__(self):
		super(projectPlanner, self).__init__(None, title='Cura - Project Planner')
		
		wx.EVT_CLOSE(self, self.OnClose)
		self.panel = wx.Panel(self, -1)
		self.SetSizer(wx.BoxSizer(wx.VERTICAL))
		self.GetSizer().Add(self.panel, 1, flag=wx.EXPAND)

		self.SetDropTarget(dropTarget.FileDropTarget(self.OnDropFiles, meshLoader.supportedExtensions()))
		
		self.list = []
		self.selection = None
		self.printMode = 0
		self.alwaysAutoPlace = profile.getPreference('planner_always_autoplace') == 'True'

		self.machineSize = numpy.array([profile.getPreferenceFloat('machine_width'), profile.getPreferenceFloat('machine_depth'), profile.getPreferenceFloat('machine_height')])
		self.headSizeMin = numpy.array([profile.getPreferenceFloat('extruder_head_size_min_x'), profile.getPreferenceFloat('extruder_head_size_min_y'),0])
		self.headSizeMax = numpy.array([profile.getPreferenceFloat('extruder_head_size_max_x'), profile.getPreferenceFloat('extruder_head_size_max_y'),0])

		self.extruderOffset = [
			numpy.array([0,0,0]),
			numpy.array([profile.getPreferenceFloat('extruder_offset_x1'), profile.getPreferenceFloat('extruder_offset_y1'), 0]),
			numpy.array([profile.getPreferenceFloat('extruder_offset_x2'), profile.getPreferenceFloat('extruder_offset_y2'), 0]),
			numpy.array([profile.getPreferenceFloat('extruder_offset_x3'), profile.getPreferenceFloat('extruder_offset_y3'), 0])]

		self.toolbar = toolbarUtil.Toolbar(self.panel)

		toolbarUtil.NormalButton(self.toolbar, self.OnLoadProject, 'open.png', 'Open project')
		toolbarUtil.NormalButton(self.toolbar, self.OnSaveProject, 'save.png', 'Save project')
		self.toolbar.AddSeparator()
		group = []
		toolbarUtil.RadioButton(self.toolbar, group, 'object-3d-on.png', 'object-3d-off.png', '3D view', callback=self.On3DClick).SetValue(self.alwaysAutoPlace)
		toolbarUtil.RadioButton(self.toolbar, group, 'object-top-on.png', 'object-top-off.png', 'Topdown view', callback=self.OnTopClick).SetValue(not self.alwaysAutoPlace)
		self.toolbar.AddSeparator()
		toolbarUtil.NormalButton(self.toolbar, self.OnPreferences, 'preferences.png', 'Project planner preferences')
		self.toolbar.AddSeparator()
		toolbarUtil.NormalButton(self.toolbar, self.OnCutMesh, 'cut-mesh.png', 'Cut a plate STL into multiple STL files, and add those files to the project.\nNote: Splitting up plates sometimes takes a few minutes.')
		toolbarUtil.NormalButton(self.toolbar, self.OnSaveCombinedSTL, 'save-combination.png', 'Save all the combined STL files into a single STL file as a plate.')
		self.toolbar.AddSeparator()
		group = []
		self.printOneAtATime = toolbarUtil.RadioButton(self.toolbar, group, 'view-normal-on.png', 'view-normal-off.png', 'Print one object at a time', callback=self.OnPrintTypeChange)
		self.printAllAtOnce = toolbarUtil.RadioButton(self.toolbar, group, 'all-at-once-on.png', 'all-at-once-off.png', 'Print all the objects at once', callback=self.OnPrintTypeChange)
		self.toolbar.AddSeparator()
		toolbarUtil.NormalButton(self.toolbar, self.OnQuit, 'exit.png', 'Close project planner')
		
		self.toolbar.Realize()

		self.toolbar2 = toolbarUtil.Toolbar(self.panel)

		toolbarUtil.NormalButton(self.toolbar2, self.OnAddModel, 'object-add.png', 'Add model')
		toolbarUtil.NormalButton(self.toolbar2, self.OnRemModel, 'object-remove.png', 'Remove model')
		self.toolbar2.AddSeparator()
		toolbarUtil.NormalButton(self.toolbar2, self.OnMoveUp, 'move-up.png', 'Move model up in print list')
		toolbarUtil.NormalButton(self.toolbar2, self.OnMoveDown, 'move-down.png', 'Move model down in print list')
		toolbarUtil.NormalButton(self.toolbar2, self.OnCopy, 'copy.png', 'Make a copy of the current selected object')
		toolbarUtil.NormalButton(self.toolbar2, self.OnSetCustomProfile, 'set-profile.png', 'Set a custom profile to be used to prepare a specific object.')
		self.toolbar2.AddSeparator()
		if not self.alwaysAutoPlace:
			toolbarUtil.NormalButton(self.toolbar2, self.OnAutoPlace, 'autoplace.png', 'Automaticly organize the objects on the platform.')
		toolbarUtil.NormalButton(self.toolbar2, self.OnSlice, 'slice.png', 'Prepare to project into a gcode file.')
		self.toolbar2.Realize()

		sizer = wx.GridBagSizer(2,2)
		self.panel.SetSizer(sizer)
		self.glCanvas = PreviewGLCanvas(self.panel, self)
		self.listbox = wx.ListBox(self.panel, -1, choices=[])
		self.addButton = wx.Button(self.panel, -1, "Add")
		self.remButton = wx.Button(self.panel, -1, "Remove")
		self.sliceButton = wx.Button(self.panel, -1, "Prepare")
		if not self.alwaysAutoPlace:
			self.autoPlaceButton = wx.Button(self.panel, -1, "Auto Place")
		
		sizer.Add(self.toolbar, (0,0), span=(1,1), flag=wx.EXPAND|wx.LEFT|wx.RIGHT)
		sizer.Add(self.toolbar2, (0,1), span=(1,2), flag=wx.EXPAND|wx.LEFT|wx.RIGHT)
		sizer.Add(self.glCanvas, (1,0), span=(5,1), flag=wx.EXPAND)
		sizer.Add(self.listbox, (1,1), span=(1,2), flag=wx.EXPAND)
		sizer.Add(self.addButton, (2,1), span=(1,1))
		sizer.Add(self.remButton, (2,2), span=(1,1))
		sizer.Add(self.sliceButton, (3,1), span=(1,1))
		if not self.alwaysAutoPlace:
			sizer.Add(self.autoPlaceButton, (3,2), span=(1,1))
		sizer.AddGrowableCol(0)
		sizer.AddGrowableRow(1)
		
		self.addButton.Bind(wx.EVT_BUTTON, self.OnAddModel)
		self.remButton.Bind(wx.EVT_BUTTON, self.OnRemModel)
		self.sliceButton.Bind(wx.EVT_BUTTON, self.OnSlice)
		if not self.alwaysAutoPlace:
			self.autoPlaceButton.Bind(wx.EVT_BUTTON, self.OnAutoPlace)
		self.listbox.Bind(wx.EVT_LISTBOX, self.OnListSelect)

		panel = wx.Panel(self.panel, -1)
		sizer.Add(panel, (5,1), span=(1,2))
		
		sizer = wx.GridBagSizer(2,2)
		panel.SetSizer(sizer)
		
		self.infoToolButton   = openglGui.glButton(self.glCanvas, 0, 'Info', 0,0, self.OnInfoSelect)
		self.rotateToolButton = openglGui.glButton(self.glCanvas, 1, 'Rotate', 0,1, self.OnRotateSelect)
		self.scaleToolButton  = openglGui.glButton(self.glCanvas, 2, 'Scale', 0,2, self.OnScaleSelect)

		self.SetSize((800,600))

		self.tool = previewTools.toolInfo(self.glCanvas)