Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- #
- import xml.etree.ElementTree as oXML
- class xmlBiesse(object):
- def __init__(self):
- #self.oXMLtree = oXML.parse('/home/bob/linuxcnc/nc_files/gcode/BiesseRover346.xml')
- #self.oXMLtree = oXML.parse('/home/mike/....../BiesseRover346.xml')
- self.oXMLtree = oXML.parse('BiesseRover346.xml')
- #self.oXMLtree = oXML.parse('/home/bob/linuxcnc/configs/python/BiesseRover346.xml')
- self.oXMLroot = self.oXMLtree.getroot()
- machineType = self.oXMLroot.get('type')
- print("Machine type is : %s" % machineType)
- #--------------------------------------------------------------------------
- # for Signals/Signal name= returns index, dir, isPulse, mesanet in a tuple
- #--------------------------------------------------------------------------
- def getSignalInfos(self, sSignalName):
- oXML = self.oXMLroot.find('Signals/Signal[@name="%s"]' % sSignalName)
- index = oXML.get('index')
- #print("index = %s" % index)
- #direc = oXML.get('dir')
- #desc = oXML.get('desc')
- #mesaIN = oXML.get('mesaIN')
- #mesaOUT = oXML.get('mesaOUT')
- return int(index) #, direc, desc, mesaIN, mesaOUT
- #--------------------------------------------------------------------------
- # for Pulse Delay, time to wait to lower what we just put high
- #--------------------------------------------------------------------------
- def getPulseDelay(self):
- oXML = self.oXMLroot.find('Pulse')
- pulseDelay = oXML.get('delay')
- return float("%s" % pulseDelay)
- #--------------------------------------------------------------------------
- # Delay to wait after opening the Casket/Cover
- #--------------------------------------------------------------------------
- def getCoverDelay(self):
- oXML = self.oXMLroot.find('Pulse')
- pulseDelay = oXML.get('coverDelay')
- return float("%s" % pulseDelay)
- #--------------------------------------------------------------------------
- # for testing if spindle stopped and wait for it, multiple times
- #--------------------------------------------------------------------------
- def getSpindleStopDelay(self):
- oXML = self.oXMLroot.find('Pulse')
- spindleStopDelay = oXML.get("spindleStop")
- maxTrials = oXML.get("maxSpindleTrialsToStop")
- return float(spindleStopDelay), int(maxTrials)
- def getActuationDelay(self):
- oXML = self.oXMLroot.find('Pulse')
- actuationDelay = oXML.get("actuationDelay")
- return float(actuationDelay)
- #--------------------------------------------------------------------------
- # for First Index of Drills ... patch
- #--------------------------------------------------------------------------
- def getFirstIndex(self, sWhat):
- oXML = self.oXMLroot.find('FirstIndex')
- pulseDelay = oXML.get(sWhat)
- return int("%s" % pulseDelay)
- #--------------------------------------------------------------------------
- # For Feed speed
- #--------------------------------------------------------------------------
- def getFeedSpeed(self):
- oXML = self.oXMLroot.find('Feed')
- feedSpeed = oXML.get('speed')
- return int("%s" % feedSpeed)
- #--------------------------------------------------------------------------
- # get the position of the pocket ... 1,2,3 and Top or Front
- #--------------------------------------------------------------------------
- def getPocketPos(self, sWhichPocket, sWhichPosition):
- #print("%s-%s" % (sWhichPocket, sWhichPosition))
- oXML = self.oXMLroot.find('Pockets/Pocket[@id="%s"]' % sWhichPocket)
- oXML2 = oXML.find('%s' % sWhichPosition)
- posX = oXML2.get("x")
- posY = oXML2.get("y")
- posZ = oXML2.get("z")
- return float(posX), float(posY), float(posZ)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement