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)
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)
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)
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)
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)