Beispiel #1
0
 def getCraftedGcode(self, fileName, repository, svgText):
     "Parse svgText and store the bottom svgText."
     svgReader = SVGReader()
     svgReader.parseSVG('', svgText)
     if svgReader.sliceDictionary == None:
         print(
             'Warning, nothing will be done because the sliceDictionary could not be found getCraftedGcode in preface.'
         )
         return ''
     decimalPlacesCarried = int(
         svgReader.sliceDictionary['decimalPlacesCarried'])
     layerThickness = float(svgReader.sliceDictionary['layerThickness'])
     perimeterWidth = float(svgReader.sliceDictionary['perimeterWidth'])
     loopLayers = svgReader.loopLayers
     zMinimum = 987654321.0
     for loopLayer in loopLayers:
         zMinimum = min(loopLayer.z, zMinimum)
     deltaZ = repository.altitude.value + repository.additionalHeightOverLayerThickness.value * layerThickness - zMinimum
     for loopLayer in loopLayers:
         loopLayer.z += deltaZ
     cornerMaximum = Vector3(-912345678.0, -912345678.0, -912345678.0)
     cornerMinimum = Vector3(912345678.0, 912345678.0, 912345678.0)
     svg_writer.setSVGCarvingCorners(cornerMaximum, cornerMinimum,
                                     layerThickness, loopLayers)
     svgWriter = svg_writer.SVGWriter(True, cornerMaximum, cornerMinimum,
                                      decimalPlacesCarried, layerThickness,
                                      perimeterWidth)
     commentElement = svg_writer.getCommentElement(
         svgReader.documentElement)
     procedureNameString = svgReader.sliceDictionary[
         'procedureName'] + ',bottom'
     return svgWriter.getReplacedSVGTemplate(fileName, loopLayers,
                                             procedureNameString,
                                             commentElement)
Beispiel #2
0
	def getCraftedGcode(self, fileName, repository, svgText):
		"Parse svgText and store the scale svgText."
		svgReader = SVGReader()
		svgReader.parseSVG('', svgText)
		if svgReader.sliceDictionary == None:
			print('Warning, nothing will be done because the sliceDictionary could not be found getCraftedGcode in preface.')
			return ''
		xyPlaneScale = repository.xyPlaneScale.value
		zAxisScale = repository.zAxisScale.value
		decimalPlacesCarried = int(svgReader.sliceDictionary['decimalPlacesCarried'])
		layerHeight = zAxisScale * float(svgReader.sliceDictionary['layerHeight'])
		edgeWidth = float(svgReader.sliceDictionary['edgeWidth'])
		loopLayers = svgReader.loopLayers
		for loopLayer in loopLayers:
			setLoopLayerScale(loopLayer, xyPlaneScale, zAxisScale)
		cornerMaximum = Vector3(-912345678.0, -912345678.0, -912345678.0)
		cornerMinimum = Vector3(912345678.0, 912345678.0, 912345678.0)
		svg_writer.setSVGCarvingCorners(cornerMaximum, cornerMinimum, layerHeight, loopLayers)
		svgWriter = svg_writer.SVGWriter(
			True,
			cornerMaximum,
			cornerMinimum,
			decimalPlacesCarried,
			layerHeight,
			edgeWidth)
		commentElement = svg_writer.getCommentElement(svgReader.documentElement)
		procedureNameString = svgReader.sliceDictionary['procedureName'] + ',scale'
		return svgWriter.getReplacedSVGTemplate(fileName, loopLayers, procedureNameString, commentElement)
Beispiel #3
0
	def getCraftedGcode(self, fileName, repository, svgText):
		"Parse svgText and store the scale svgText."
		svgReader = SVGReader()
		svgReader.parseSVG('', svgText)
		if svgReader.sliceDictionary == None:
			print('Warning, nothing will be done because the sliceDictionary could not be found getCraftedGcode in preface.')
			return ''
		xyPlaneScale = repository.xyPlaneScale.value
		zAxisScale = repository.zAxisScale.value
		decimalPlacesCarried = int(svgReader.sliceDictionary['decimalPlacesCarried'])
		layerHeight = zAxisScale * float(svgReader.sliceDictionary['layerHeight'])
		edgeWidth = float(svgReader.sliceDictionary['edgeWidth'])
		loopLayers = svgReader.loopLayers
		for loopLayer in loopLayers:
			setLoopLayerScale(loopLayer, xyPlaneScale, zAxisScale)
		cornerMaximum = Vector3(-912345678.0, -912345678.0, -912345678.0)
		cornerMinimum = Vector3(912345678.0, 912345678.0, 912345678.0)
		svg_writer.setSVGCarvingCorners(cornerMaximum, cornerMinimum, layerHeight, loopLayers)
		svgWriter = svg_writer.SVGWriter(
			True,
			cornerMaximum,
			cornerMinimum,
			decimalPlacesCarried,
			layerHeight,
			edgeWidth)
		commentElement = svg_writer.getCommentElement(svgReader.documentElement)
		procedureNameString = svgReader.sliceDictionary['procedureName'] + ',scale'
		return svgWriter.getReplacedSVGTemplate(fileName, loopLayers, procedureNameString, commentElement)
Beispiel #4
0
	def getCraftedGcode(self, fileName, repository, svgText):
		"Parse svgText and store the bottom svgText."
		svgReader = SVGReader()
		svgReader.parseSVG('', svgText)
		if svgReader.sliceDictionary == None:
			print('Warning, nothing will be done because the sliceDictionary could not be found getCraftedGcode in preface.')
			return ''
		decimalPlacesCarried = int(svgReader.sliceDictionary['decimalPlacesCarried'])
		layerThickness = float(svgReader.sliceDictionary['layerThickness'])
		perimeterWidth = float(svgReader.sliceDictionary['perimeterWidth'])
		rotatedLoopLayers = svgReader.rotatedLoopLayers
		zMinimum = 987654321.0
		for rotatedLoopLayer in rotatedLoopLayers:
			zMinimum = min(rotatedLoopLayer.z, zMinimum)
		deltaZ = repository.altitude.value + repository.additionalHeightOverLayerThickness.value * layerThickness - zMinimum
		for rotatedLoopLayer in rotatedLoopLayers:
			rotatedLoopLayer.z += deltaZ
		cornerMaximum = Vector3(-912345678.0, -912345678.0, -912345678.0)
		cornerMinimum = Vector3(912345678.0, 912345678.0, 912345678.0)
		svg_writer.setSVGCarvingCorners(cornerMaximum, cornerMinimum, layerThickness, rotatedLoopLayers)
		svgWriter = svg_writer.SVGWriter(
			True,
			cornerMaximum,
			cornerMinimum,
			decimalPlacesCarried,
			layerThickness,
			perimeterWidth)
		commentElement = svg_writer.getCommentElement(svgReader.root)
		procedureNameString = svgReader.sliceDictionary['procedureName'] + ',bottom'
		return svgWriter.getReplacedSVGTemplate(fileName, procedureNameString, rotatedLoopLayers, commentElement)
Beispiel #5
0
 def getCraftedGcode(self, fileName, repository, svgText):
     "Parse svgText and store the bottom svgText."
     svgReader = SVGReader()
     svgReader.parseSVG("", svgText)
     if svgReader.sliceDictionary == None:
         print(
             "Warning, nothing will be done because the sliceDictionary could not be found getCraftedGcode in preface."
         )
         return ""
     decimalPlacesCarried = int(svgReader.sliceDictionary["decimalPlacesCarried"])
     edgeWidth = float(svgReader.sliceDictionary["edgeWidth"])
     layerHeight = float(svgReader.sliceDictionary["layerHeight"])
     loopLayers = svgReader.loopLayers
     zMinimum = 987654321.0
     for loopLayer in loopLayers:
         zMinimum = min(loopLayer.z, zMinimum)
     deltaZ = (
         repository.altitude.value + repository.additionalHeightOverLayerThickness.value * layerHeight - zMinimum
     )
     for loopLayer in loopLayers:
         loopLayer.z += deltaZ
     cornerMaximum = Vector3(-912345678.0, -912345678.0, -912345678.0)
     cornerMinimum = Vector3(912345678.0, 912345678.0, 912345678.0)
     svg_writer.setSVGCarvingCorners(cornerMaximum, cornerMinimum, layerHeight, loopLayers)
     svgWriter = svg_writer.SVGWriter(
         True, cornerMaximum, cornerMinimum, decimalPlacesCarried, layerHeight, edgeWidth
     )
     commentElement = svg_writer.getCommentElement(svgReader.documentElement)
     procedureNameString = svgReader.sliceDictionary["procedureName"] + ",bottom"
     return svgWriter.getReplacedSVGTemplate(fileName, loopLayers, procedureNameString, commentElement)
Beispiel #6
0
	def parseSVG( self, fileName, svgText ):
		"Parse SVG text and store the layers."
		if svgText == '':
			return
		self.fileName = fileName
		self.svgReader.parseSVG(fileName, svgText)
		self.parseInitialization()
		self.cornerMaximum = Vector3(-999999999.0, -999999999.0, self.maximumZ)
		self.cornerMinimum = Vector3(999999999.0, 999999999.0, self.minimumZ)
		svg_writer.setSVGCarvingCorners(self.svgReader.rotatedLoopLayers, self)
Beispiel #7
0
 def parseSVG(self, fileName, svgText):
     "Parse SVG text and store the layers."
     if svgText == '':
         return
     self.fileName = fileName
     self.svgReader.parseSVG(fileName, svgText)
     self.parseInitialization()
     self.cornerMaximum = Vector3(-999999999.0, -999999999.0, self.maximumZ)
     self.cornerMinimum = Vector3(999999999.0, 999999999.0, self.minimumZ)
     svg_writer.setSVGCarvingCorners(self.svgReader.rotatedLoopLayers, self)
Beispiel #8
0
	def parseSVG(self, fileName, svgText):
		'Parse SVG text and store the layers.'
		if svgText == '':
			return
		self.fileName = fileName
		self.svgReader.parseSVG(fileName, svgText)
		self.layerHeight = euclidean.getFloatDefaultByDictionary(
			self.layerHeight, self.svgReader.sliceDictionary, 'layerHeight')
		self.cornerMaximum = Vector3(-987654321.0, -987654321.0, self.maximumZ)
		self.cornerMinimum = Vector3(987654321.0, 987654321.0, self.minimumZ)
		svg_writer.setSVGCarvingCorners(
			self.cornerMaximum, self.cornerMinimum, self.layerHeight, self.svgReader.loopLayers)
Beispiel #9
0
	def parseSVG(self, fileName, svgText):
		'Parse SVG text and store the layers.'
		if svgText == '':
			return
		self.fileName = fileName
		self.svgReader.parseSVG(fileName, svgText)
		self.layerThickness = euclidean.getFloatDefaultByDictionary(
			self.layerThickness, self.svgReader.sliceDictionary, 'layerThickness')
		self.cornerMaximum = Vector3(-999999999.0, -999999999.0, self.maximumZ)
		self.cornerMinimum = Vector3(999999999.0, 999999999.0, self.minimumZ)
		svg_writer.setSVGCarvingCorners(
			self.cornerMaximum, self.cornerMinimum, self.layerThickness, self.svgReader.rotatedLoopLayers)
Beispiel #10
0
 def parseSVG(self, fileName, svgText):
     'Parse SVG text and store the layers.'
     if svgText == '':
         return
     self.fileName = fileName
     self.svgReader.parseSVG(fileName, svgText)
     self.layerHeight = euclidean.getFloatDefaultByDictionary(
         self.layerHeight, self.svgReader.sliceDictionary, 'layerHeight')
     self.cornerMaximum = Vector3(-987654321.0, -987654321.0, self.maximumZ)
     self.cornerMinimum = Vector3(987654321.0, 987654321.0, self.minimumZ)
     svg_writer.setSVGCarvingCorners(self.cornerMaximum, self.cornerMinimum,
                                     self.layerHeight,
                                     self.svgReader.loopLayers)
Beispiel #11
0
	def processSVGElement(self, fileName):
		"Parse SVG element and store the layers."
		self.fileName = fileName
		paths = self.xmlElement.object.getPaths()
		if len(paths) < 1:
			return
		firstPath = paths[0]
		if len(firstPath) < 1:
			return
		rotatedLoopLayer = euclidean.RotatedLoopLayer(firstPath[0].z)
		self.rotatedLoopLayers.append(rotatedLoopLayer)
		for path in paths:
			rotatedLoopLayer.loops.append(euclidean.getComplexPath(path))
		self.cornerMaximum = Vector3(-999999999.0, -999999999.0, -999999999.0)
		self.cornerMinimum = Vector3(999999999.0, 999999999.0, 999999999.0)
		svg_writer.setSVGCarvingCorners(self.cornerMaximum, self.cornerMinimum, self.layerThickness, self.rotatedLoopLayers)
Beispiel #12
0
	def processSVGElement(self, fileName):
		'Parse SVG element and store the layers.'
		self.fileName = fileName
		paths = self.xmlElement.object.getPaths()
		if len(paths) < 1:
			return
		firstPath = paths[0]
		if len(firstPath) < 1:
			return
		rotatedLoopLayer = euclidean.RotatedLoopLayer(firstPath[0].z)
		self.rotatedLoopLayers.append(rotatedLoopLayer)
		for path in paths:
			rotatedLoopLayer.loops.append(euclidean.getComplexPath(path))
		self.cornerMaximum = Vector3(-999999999.0, -999999999.0, -999999999.0)
		self.cornerMinimum = Vector3(999999999.0, 999999999.0, 999999999.0)
		svg_writer.setSVGCarvingCorners(self.cornerMaximum, self.cornerMinimum, self.layerThickness, self.rotatedLoopLayers)
Beispiel #13
0
	def processSVGElement(self, fileName):
		'Parse SVG element and store the layers.'
		self.fileName = fileName
		paths = self.elementNode.xmlObject.getPaths()
		oldZ = None
		self.loopLayers = []
		loopLayer = None
		for path in paths:
			if len(path) > 0:
				z = path[0].z
				if z != oldZ:
					loopLayer = euclidean.LoopLayer(z)
					self.loopLayers.append(loopLayer)
					oldZ = z
				loopLayer.loops.append(euclidean.getComplexPath(path))
		if len(self.loopLayers) < 1:
			return
		self.cornerMaximum = Vector3(-987654321.0, -987654321.0, -987654321.0)
		self.cornerMinimum = Vector3(987654321.0, 987654321.0, 987654321.0)
		svg_writer.setSVGCarvingCorners(self.cornerMaximum, self.cornerMinimum, self.layerThickness, self.loopLayers)
Beispiel #14
0
	def processSVGElement(self, fileName):
		'Parse SVG element and store the layers.'
		self.fileName = fileName
		paths = self.elementNode.xmlObject.getPaths()
		oldZ = None
		self.loopLayers = []
		loopLayer = None
		for path in paths:
			if len(path) > 0:
				z = path[0].z
				if z != oldZ:
					loopLayer = euclidean.LoopLayer(z)
					self.loopLayers.append(loopLayer)
					oldZ = z
				loopLayer.loops.append(euclidean.getComplexPath(path))
		if len(self.loopLayers) < 1:
			return
		self.cornerMaximum = Vector3(-987654321.0, -987654321.0, -987654321.0)
		self.cornerMinimum = Vector3(987654321.0, 987654321.0, 987654321.0)
		svg_writer.setSVGCarvingCorners(self.cornerMaximum, self.cornerMinimum, self.layerThickness, self.loopLayers)
Beispiel #15
0
	def processSVGElement(self, fileName):
		"""Parse SVG element and store the layers."""
		self.fileName = fileName
		paths = self.xmlElement.xmlObject.getPaths()
		oldZ = None
		self.rotatedLoopLayers = []
		rotatedLoopLayer = None
		for path in paths:
			if len(path) > 0:
				z = path[0].z
				if z != oldZ:
					rotatedLoopLayer = euclidean.RotatedLoopLayer(z)
					self.rotatedLoopLayers.append(rotatedLoopLayer)
					oldZ = z
				rotatedLoopLayer.loops.append(euclidean.getComplexPath(path))
		if len(self.rotatedLoopLayers) < 1:
			return
		self.cornerMaximum = Vector3(-987654321.0, -987654321.0, -987654321.0)
		self.cornerMinimum = Vector3(987654321.0, 987654321.0, 987654321.0)
		svg_writer.setSVGCarvingCorners(self.cornerMaximum, self.cornerMinimum, self.extrusionHeight, self.rotatedLoopLayers)