def fillDescription(): descriptionExtension = '_' pluginModule = archive.getModuleWithPath(os.path.join( skeinforge_craft.getPluginsDirectoryPath(), 'fill' )) prefs = settings.getReadRepository(pluginModule.getNewRepository()).preferences for pref in prefs: if (pref.name == 'Activate Fill:' and pref.value == False): return '' if (pref.name == 'Infill Solidity (ratio):'): infill = pref.value descriptionExtension += str(pref.value).replace('.','')+'fill' return descriptionExtension
def carveDescription(): descriptionExtension = '' pluginModule = archive.getModuleWithPath(os.path.join( skeinforge_craft.getPluginsDirectoryPath(), 'carve' )) prefs = settings.getReadRepository(pluginModule.getNewRepository()).preferences for pref in prefs: if (pref.name == 'Layer Thickness (mm):'): lt = pref.value descriptionExtension += str(pref.value).replace('.','')+'h' if (pref.name == 'Perimeter Width over Thickness (ratio):'): pwot = pref.value descriptionExtension += 'x' + str(lt * pwot).replace('.','') + 'w' return descriptionExtension
def fillDescription(): descriptionExtension = '_' pluginModule = archive.getModuleWithPath( os.path.join(skeinforge_craft.getPluginsDirectoryPath(), 'fill')) prefs = settings.getReadRepository( pluginModule.getNewRepository()).preferences for pref in prefs: if (pref.name == 'Activate Fill:' and pref.value == False): return '' if (pref.name == 'Infill Solidity (ratio):'): infill = pref.value descriptionExtension += str(pref.value).replace('.', '') + 'fill' return descriptionExtension
def multiplyDescription(): descriptionExtension = '' pluginModule = archive.getModuleWithPath(os.path.join( skeinforge_craft.getPluginsDirectoryPath(), 'multiply' )) prefs = settings.getReadRepository(pluginModule.getNewRepository()).preferences for pref in prefs: if (pref.name == 'Activate Multiply:' and pref.value == False): return '' if (pref.name == 'Number of Columns (integer):'): cols = pref.value if (pref.name == 'Number of Rows (integer):'): rows = pref.value if (cols > 1 or rows > 1) : descriptionExtension ='_'+str(cols * rows).replace('.','')+'off' return descriptionExtension
def convertElementNode(self, elementNode, geometryOutput): "Convert the xml element." geometryOutputKeys = geometryOutput.keys() if len( geometryOutputKeys ) < 1: return None firstKey = geometryOutputKeys[0] lowerLocalName = firstKey.lower() if lowerLocalName not in self.namePathDictionary: return None pluginModule = archive.getModuleWithPath( self.namePathDictionary[ lowerLocalName ] ) if pluginModule == None: return None elementNode.localName = lowerLocalName return pluginModule.convertElementNode(elementNode, geometryOutput[ firstKey ])
def carveDescription(): descriptionExtension = '' pluginModule = archive.getModuleWithPath( os.path.join(skeinforge_craft.getPluginsDirectoryPath(), 'carve')) prefs = settings.getReadRepository( pluginModule.getNewRepository()).preferences for pref in prefs: if (pref.name == 'Layer Thickness (mm):'): lt = pref.value descriptionExtension += str(pref.value).replace('.', '') + 'h' if (pref.name == 'Perimeter Width over Thickness (ratio):'): pwot = pref.value descriptionExtension += 'x' + str(lt * pwot).replace('.', '') + 'w' return descriptionExtension
def convertXMLElement( self, geometryOutput, xmlElement ): "Convert the xml element." geometryOutputKeys = geometryOutput.keys() if len( geometryOutputKeys ) < 1: return None firstKey = geometryOutputKeys[0] lowerClassName = firstKey.lower() if lowerClassName not in self.namePathDictionary: return None pluginModule = archive.getModuleWithPath( self.namePathDictionary[ lowerClassName ] ) if pluginModule == None: return None xmlElement.className = lowerClassName return pluginModule.convertXMLElement(geometryOutput[ firstKey ], xmlElement)
def _getAccessibleAttribute(attributeName, xmlElement): 'Get the accessible attribute.' functionName = attributeName[len('get') :].lower() if functionName not in evaluate.globalCreationDictionary: print('Warning, functionName not in globalCreationDictionary in _getAccessibleAttribute in creation for:') print(functionName) print(xmlElement) return None pluginModule = archive.getModuleWithPath(evaluate.globalCreationDictionary[functionName]) if pluginModule == None: print('Warning, _getAccessibleAttribute in creation can not get a pluginModule for:') print(functionName) print(xmlElement) return None return Creation(pluginModule, xmlElement).getCreation
def processXMLElement(self, xmlElement): 'Process the xml element.' lowerClassName = xmlElement.className.lower() if lowerClassName not in self.namePathDictionary: return None pluginModule = archive.getModuleWithPath(self.namePathDictionary[lowerClassName]) if pluginModule == None: return None try: return pluginModule.processXMLElement(xmlElement) except: print('Warning, could not processXMLElement in fabmetheus for:') print( pluginModule ) print(xmlElement) traceback.print_exc(file=sys.stdout) return None
def processElementNode(self, elementNode): 'Process the xml element.' lowerLocalName = elementNode.getNodeName().lower() if lowerLocalName not in self.namePathDictionary: return None pluginModule = archive.getModuleWithPath(self.namePathDictionary[lowerLocalName]) if pluginModule == None: return None try: return pluginModule.processElementNode(elementNode) except: print('Warning, could not processElementNode in fabmetheus for:') print(pluginModule) print(elementNode) traceback.print_exc(file=sys.stdout) return None
def multiplyDescription(): descriptionExtension = '' pluginModule = archive.getModuleWithPath( os.path.join(skeinforge_craft.getPluginsDirectoryPath(), 'multiply')) prefs = settings.getReadRepository( pluginModule.getNewRepository()).preferences for pref in prefs: if (pref.name == 'Activate Multiply:' and pref.value == False): return '' if (pref.name == 'Number of Columns (integer):'): cols = pref.value if (pref.name == 'Number of Rows (integer):'): rows = pref.value if (cols > 1 or rows > 1): descriptionExtension = '_' + str(cols * rows).replace('.', '') + 'off' return descriptionExtension
def speedDescription(): descriptionExtension = '_' pluginModule = archive.getModuleWithPath(os.path.join( skeinforge_craft.getPluginsDirectoryPath(), 'speed' )) prefs = settings.getReadRepository(pluginModule.getNewRepository()).preferences for pref in prefs: if (pref.name == 'Activate Speed:' and pref.value == False): return '' if (pref.name == 'Feed Rate (mm/s):'): feedrate = pref.value if (pref.name == 'Flow Rate Setting (float):'): flowrate = pref.value if (feedrate == flowrate): descriptionExtension += str(feedrate).replace('.0','')+'Ff' else : descriptionExtension += str(feedrate).replace('.0','')+'F'+str(flowrate).replace('.0','')+'f' return descriptionExtension
def readSettings(self): self.output = cStringIO.StringIO() profileDirectory = skeinforge_profile.getProfileDirectory() craftRepo = skeinforge_craft.CraftRepository() profileBaseName = settings.getProfileBaseName( craftRepo ) allCraftNames = archive.getPluginFileNamesFromDirectoryPath( skeinforge_craft.getPluginsDirectoryPath() ) fullProfilePath = os.path.join( archive.getSettingsPath() , 'profiles' ) fullProfileDirectory = os.path.join( fullProfilePath , profileDirectory ) for craftName in allCraftNames: pluginModule = archive.getModuleWithPath(os.path.join( skeinforge_craft.getPluginsDirectoryPath(), craftName )) repo = pluginModule.getNewRepository() self.outputSettings(craftName, settings.getReadRepository(repo).preferences) return self.output.getvalue()
def speedDescription(): descriptionExtension = '_' pluginModule = archive.getModuleWithPath( os.path.join(skeinforge_craft.getPluginsDirectoryPath(), 'speed')) prefs = settings.getReadRepository( pluginModule.getNewRepository()).preferences for pref in prefs: if (pref.name == 'Activate Speed:' and pref.value == False): return '' if (pref.name == 'Feed Rate (mm/s):'): feedrate = pref.value if (pref.name == 'Flow Rate Setting (float):'): flowrate = pref.value if (feedrate == flowrate): descriptionExtension += str(feedrate).replace('.0', '') + 'Ff' else: descriptionExtension += str(feedrate).replace( '.0', '') + 'F' + str(flowrate).replace('.0', '') + 'f' return descriptionExtension
def readSettings(self): self.output = cStringIO.StringIO() profileDirectory = skeinforge_profile.getProfileDirectory() craftRepo = skeinforge_craft.CraftRepository() profileBaseName = settings.getProfileBaseName(craftRepo) allCraftNames = archive.getPluginFileNamesFromDirectoryPath( skeinforge_craft.getPluginsDirectoryPath()) fullProfilePath = os.path.join(archive.getSettingsPath(), 'profiles') fullProfileDirectory = os.path.join(fullProfilePath, profileDirectory) for craftName in allCraftNames: pluginModule = archive.getModuleWithPath( os.path.join(skeinforge_craft.getPluginsDirectoryPath(), craftName)) repo = pluginModule.getNewRepository() self.outputSettings(craftName, settings.getReadRepository(repo).preferences) return self.output.getvalue()