Exemplo n.º 1
0
    def updateModelTransform(self, f=0):
        if self.triangleMesh == None:
            return
        for face in self.triangleMesh.faces:
            face.normal = None
        scale = 1.0
        rotate = 0.0
        try:
            scale = float(settings.getProfileSetting("model_scale", "1.0"))
            rotate = float(settings.getProfileSetting("model_rotate_base", "0.0")) / 180 * math.pi
        except:
            pass
        scaleX = scale
        scaleY = scale
        scaleZ = scale
        if settings.getProfileSetting("flip_x") == "True":
            scaleX = -scaleX
        if settings.getProfileSetting("flip_y") == "True":
            scaleY = -scaleY
        if settings.getProfileSetting("flip_z") == "True":
            scaleZ = -scaleZ
        mat00 = math.cos(rotate) * scaleX
        mat01 = -math.sin(rotate) * scaleY
        mat10 = math.sin(rotate) * scaleX
        mat11 = math.cos(rotate) * scaleY

        for i in xrange(0, len(self.triangleMesh.origonalVertexes)):
            self.triangleMesh.vertexes[i].x = (
                self.triangleMesh.origonalVertexes[i].x * mat00 + self.triangleMesh.origonalVertexes[i].y * mat01
            )
            self.triangleMesh.vertexes[i].y = (
                self.triangleMesh.origonalVertexes[i].x * mat10 + self.triangleMesh.origonalVertexes[i].y * mat11
            )
            self.triangleMesh.vertexes[i].z = self.triangleMesh.origonalVertexes[i].z * scaleZ
        self.moveModel()
Exemplo n.º 2
0
    def validate(self):
        try:
            wallThickness = float(self.setting.GetValue())
            nozzleSize = float(settings.getProfileSetting("nozzle_size"))
            if wallThickness <= nozzleSize * 0.5:
                return (
                    ERROR,
                    "Trying to print walls thinner then the half of your nozzle size, this will not produce anything usable",
                )
            if wallThickness <= nozzleSize * 0.85:
                return (
                    WARNING,
                    "Trying to print walls thinner then the 0.8 * nozzle size. Small chance that this will produce usable results",
                )
            if wallThickness < nozzleSize:
                return SUCCESS, ""

            lineCount = int(wallThickness / nozzleSize)
            lineWidth = wallThickness / lineCount
            lineWidthAlt = wallThickness / (lineCount + 1)
            if lineWidth >= nozzleSize * 1.5 and lineWidthAlt <= nozzleSize * 0.85:
                return (
                    WARNING,
                    "Current selected wall thickness results in a line thickness of "
                    + str(lineWidthAlt)
                    + "mm which is not recommended with your nozzle of "
                    + str(nozzleSize)
                    + "mm",
                )
            return SUCCESS, ""
        except ValueError:
            # We already have an error by the int/float validator in this case.
            return SUCCESS, ""
Exemplo n.º 3
0
	def updateProfileToControls(self):
		"Update the configuration wx controls to show the new configuration settings"
		for setting in self.settingControlList:
			if setting.type == 'profile':
				setting.SetValue(settings.getProfileSetting(setting.configName))
			else:
				setting.SetValue(settings.getPreference(setting.configName))
Exemplo n.º 4
0
	def updateModelTransform(self, f=0):
		if self.triangleMesh == None:
			return
		scale = 1.0
		rotate = 0.0
		try:
			scale = float(settings.getProfileSetting('model_scale', '1.0'))
			rotate = float(settings.getProfileSetting('model_rotate_base', '0.0')) / 180 * math.pi
		except:
			pass
		scaleX = scale
		scaleY = scale
		scaleZ = scale
		if settings.getProfileSetting('flip_x') == 'True':
			scaleX = -scaleX
		if settings.getProfileSetting('flip_y') == 'True':
			scaleY = -scaleY
		if settings.getProfileSetting('flip_z') == 'True':
			scaleZ = -scaleZ
		mat00 = math.cos(rotate) * scaleX
		mat01 =-math.sin(rotate) * scaleY
		mat10 = math.sin(rotate) * scaleX
		mat11 = math.cos(rotate) * scaleY
		
		for i in xrange(0, len(self.triangleMesh.origonalVertexes)):
			self.triangleMesh.vertexes[i].x = self.triangleMesh.origonalVertexes[i].x * mat00 + self.triangleMesh.origonalVertexes[i].y * mat01
			self.triangleMesh.vertexes[i].y = self.triangleMesh.origonalVertexes[i].x * mat10 + self.triangleMesh.origonalVertexes[i].y * mat11
			self.triangleMesh.vertexes[i].z = self.triangleMesh.origonalVertexes[i].z * scaleZ

		for face in self.triangleMesh.faces:
			v1 = self.triangleMesh.vertexes[face.vertexIndexes[0]]
			v2 = self.triangleMesh.vertexes[face.vertexIndexes[1]]
			v3 = self.triangleMesh.vertexes[face.vertexIndexes[2]]
			face.normal = (v2 - v1).cross(v3 - v1)
			face.normal.normalize()

		self.moveModel()
Exemplo n.º 5
0
	def __init__(self, parent):
		super(UltimakerCalibrationPage, self).__init__(parent, "Ultimaker Calibration")
		
		self.AddText("Your Ultimaker requires some calibration.");
		self.AddText("This calibration is needed for a proper extrusion amount.");
		self.AddSeperator()
		self.AddText("The following values are needed:");
		self.AddText("* Diameter of filament");
		self.AddText("* Number of steps per mm of filament extrusion");
		self.AddSeperator()
		self.AddText("The better you have calibrated these values, the better your prints\nwill become.");
		self.AddSeperator()
		self.AddText("First we need the diameter of your filament:");
		self.filamentDiameter = wx.TextCtrl(self, -1, settings.getProfileSetting('filament_diameter', '2.89'))
		self.GetSizer().Add(self.filamentDiameter, 0, wx.LEFT, 5)
		self.AddText("If you do not own digital Calipers that can measure\nat least 2 digits then use 2.89mm.\nWhich is the average diameter of most filament.");
		self.AddText("Note: This value can be changed later at any time.");
Exemplo n.º 6
0
	def updateInfillLineWidth(self, setting):
		self.glCanvas.infillLineWidth = settings.getProfileSetting('nozzle_size')