Ejemplo n.º 1
0
    def updateSizeOffsets(self, force=False):
        newOffsets = numpy.array(profile.calculateObjectSizeOffsets(),
                                 numpy.float32)
        minExtruderCount = profile.minimalExtruderCount()
        if not force and numpy.array_equal(
                self._sizeOffsets,
                newOffsets) and self._minExtruderCount == minExtruderCount:
            return
        self._sizeOffsets = newOffsets
        self._minExtruderCount = minExtruderCount

        extends = [
            numpy.array([[-newOffsets[0], -newOffsets[1]],
                         [newOffsets[0], -newOffsets[1]],
                         [newOffsets[0], newOffsets[1]],
                         [-newOffsets[0], newOffsets[1]]], numpy.float32)
        ]
        for n in xrange(1, 4):
            headOffset = numpy.array(
                [[0, 0],
                 [
                     -profile.getMachineSettingFloat('extruder_offset_x%d' %
                                                     (n)),
                     -profile.getMachineSettingFloat('extruder_offset_y%d' %
                                                     (n))
                 ]], numpy.float32)
            extends.append(polygon.minkowskiHull(extends[n - 1], headOffset))
        if minExtruderCount > 1:
            extends[0] = extends[1]

        for obj in self._objectList:
            obj.setPrintAreaExtends(extends[len(obj._meshList) - 1])
Ejemplo n.º 2
0
	def OnScaleMax(self, button):
		if self._selectedObj is None:
			return
		self._selectedObj.scaleUpTo(self._machineSize - numpy.array(profile.calculateObjectSizeOffsets() + [0.0], numpy.float32) * 2 - numpy.array([1,1,1], numpy.float32))
		self._scene.pushFree()
		self._selectObject(self._selectedObj)
		self.updateProfileToControls()
		self.sceneUpdated()
Ejemplo n.º 3
0
	def updateSizeOffsets(self, force=False):
		newOffsets = numpy.array(profile.calculateObjectSizeOffsets(), numpy.float32)
		if not force and numpy.array_equal(self._sizeOffsets, newOffsets):
			return
		self._sizeOffsets = newOffsets

		extends = numpy.array([[-newOffsets[0],-newOffsets[1]],[ newOffsets[0],-newOffsets[1]],[ newOffsets[0], newOffsets[1]],[-newOffsets[0], newOffsets[1]]], numpy.float32)
		for obj in self._objectList:
			obj.setPrintAreaExtends(extends)
Ejemplo n.º 4
0
    def updateSizeOffsets(self, force=False):
        newOffsets = numpy.array(profile.calculateObjectSizeOffsets(),
                                 numpy.float32)
        if not force and numpy.array_equal(self._sizeOffsets, newOffsets):
            return
        self._sizeOffsets = newOffsets

        extends = numpy.array(
            [[-newOffsets[0], -newOffsets[1]], [newOffsets[0], -newOffsets[1]],
             [newOffsets[0], newOffsets[1]], [-newOffsets[0], newOffsets[1]]],
            numpy.float32)
        for obj in self._objectList:
            obj.setPrintAreaExtends(extends)
Ejemplo n.º 5
0
	def updateSizeOffsets(self, force=False):
		newOffsets = numpy.array(profile.calculateObjectSizeOffsets(), numpy.float32)
		minExtruderCount = profile.minimalExtruderCount()
		if not force and numpy.array_equal(self._sizeOffsets, newOffsets) and self._minExtruderCount == minExtruderCount:
			return
		self._sizeOffsets = newOffsets
		self._minExtruderCount = minExtruderCount

		extends = [numpy.array([[-newOffsets[0],-newOffsets[1]],[ newOffsets[0],-newOffsets[1]],[ newOffsets[0], newOffsets[1]],[-newOffsets[0], newOffsets[1]]], numpy.float32)]
		for n in xrange(1, 4):
			headOffset = numpy.array([[0, 0], [-profile.getMachineSettingFloat('extruder_offset_x%d' % (n)), -profile.getMachineSettingFloat('extruder_offset_y%d' % (n))]], numpy.float32)
			extends.append(polygon.minkowskiHull(extends[n-1], headOffset))
		if minExtruderCount > 1:
			extends[0] = extends[1]

		for obj in self._objectList:
			obj.setPrintAreaExtends(extends[len(obj._meshList) - 1])
Ejemplo n.º 6
0
	def updateProfileToControls(self):
		oldSimpleMode = self._isSimpleMode
		self._isSimpleMode = profile.getPreference('startMode') == 'Simple'
		if self._isSimpleMode and not oldSimpleMode:
			self._scene.arrangeAll()
			self.sceneUpdated()
		self._machineSize = numpy.array([profile.getPreferenceFloat('machine_width'), profile.getPreferenceFloat('machine_depth'), profile.getPreferenceFloat('machine_height')])
		self._objColors[0] = profile.getPreferenceColour('model_colour')
		self._objColors[1] = profile.getPreferenceColour('model_colour2')
		self._objColors[2] = profile.getPreferenceColour('model_colour3')
		self._objColors[3] = profile.getPreferenceColour('model_colour4')
		self._scene.setMachineSize(self._machineSize)
		self._scene.setSizeOffsets(numpy.array(profile.calculateObjectSizeOffsets(), numpy.float32))
		self._scene.setHeadSize(profile.getPreferenceFloat('extruder_head_size_min_x'), profile.getPreferenceFloat('extruder_head_size_max_x'), profile.getPreferenceFloat('extruder_head_size_min_y'), profile.getPreferenceFloat('extruder_head_size_max_y'), profile.getPreferenceFloat('extruder_head_size_height'))

		if self._selectedObj is not None:
			scale = self._selectedObj.getScale()
			size = self._selectedObj.getSize()
			self.scaleXctrl.setValue(round(scale[0], 2))
			self.scaleYctrl.setValue(round(scale[1], 2))
			self.scaleZctrl.setValue(round(scale[2], 2))
			self.scaleXmmctrl.setValue(round(size[0], 2))
			self.scaleYmmctrl.setValue(round(size[1], 2))
			self.scaleZmmctrl.setValue(round(size[2], 2))
Ejemplo n.º 7
0
	def sceneUpdated(self):
		self._sceneUpdateTimer.Start(500, True)
		self._slicer.abortSlicer()
		self._scene.setSizeOffsets(numpy.array(profile.calculateObjectSizeOffsets(), numpy.float32))
		self.QueueRefresh()