def classicladder(): # TODO: classicladder.bindOk should check for classicladder comp if hal.component_exists("classicladder_rt"): p = os.popen("classicladder &", "w") else: text = "Classicladder real-time component not detected" print text
def __init__(self): self.i = linuxcnc.ini(os.environ['INI_FILE_NAME']) self.s = linuxcnc.stat() self.c = linuxcnc.command() try: # we need this to connect to hal if not hal.component_exists('dummy'): self.h = hal.component('dummy') self.h.ready() except: print('Error connecting to HAL instance') self.exit() # no point in continuing if not paused if not hal.get_value('halui.program.is-paused'): print('Cannot load cut recovery because program is not paused') self.exit() self.clear_offsets() self.xOrig = hal.get_value('axis.x.eoffset-counts') self.yOrig = hal.get_value('axis.y.eoffset-counts') self.zOrig = hal.get_value('axis.z.eoffset-counts') self.oScale = hal.get_value('plasmac.offset-scale') self.xMin = float(self.i.find('AXIS_X', 'MIN_LIMIT')) self.xMax = float(self.i.find('AXIS_X', 'MAX_LIMIT')) self.yMin = float(self.i.find('AXIS_Y', 'MIN_LIMIT')) self.yMax = float(self.i.find('AXIS_Y', 'MAX_LIMIT')) self.zMin = float(self.i.find('AXIS_Z', 'MIN_LIMIT')) self.zMax = float(self.i.find('AXIS_Z', 'MAX_LIMIT')) self.cancelWait = False self.resumeWait = False gobject.timeout_add(200, self.periodic)
def classicladder(): """Launch the ClassicLadder editor. Todo: classicladder.bindOk should check for classicladder comp """ if hal.component_exists("classicladder_rt"): p = os.popen("classicladder &", "w") else: text = "Classicladder real-time component not detected" print(text)
if pMin: pmx485.pressure_min = round(int(pMin, 16) / 128.0, 1) # get maximum pressure setting pMax = read_register(rPressureMax) if pMax: pmx485.pressure_max = round(int(pMax, 16) / 128.0, 1) if cMin and cMax and pMin and pMax: return True else: return False # main loop try: while 1: if hal.component_exists('qtplasmac') or \ hal.component_exists('qtplasmac_9x16') or \ hal.component_exists('qtplasmac_4x3'): if enabled != pmx485.enable: enabled = pmx485.enable if not enabled: close_machine() comms.close() pmx485.status = False started = False if enabled: if not started: if not comms.isOpen(): comms.open() if open_machine(): started = True
def load_ladder(self, *args): if hal.component_exists('classicladder_rt'): p = os.popen("classicladder &", "w")
def periodic(self): # exit if linuxcnc not running if not hal.component_exists('plasmac_run'): self.parent.wizardButton.set_sensitive(True) self.W.destroy() return True
up_cycles = 0 # overshoot ramp up cycles # return a random noise voltage def random_noise(cycle, volume): if cycle % 5 == 0: random.seed() v = random.randrange(int(volume * -1000), int(volume * 1000)) return v / 1000 else: return 0 # main loop try: while hal.component_exists('motmod') and not h['close']: # validate the inputs cut_noise = abs(h['cut-noise-in']) cycles = abs(h['cycles-in']) if h['on-delay-in'] < 0: on_delay = 0 elif h['on-delay-in'] > 100: on_delay = 100 else: on_delay = h['on-delay-in'] if h['offset-in'] < -10: offset = -10 elif h['offset-in'] > 10: offset = 10
def periodic(self): self.s.poll() isIdleHomed = True isIdleOn = True if hal.component_exists('halui'): if hal.get_value('plasmac:program-is-idle'): hal.set_p('plasmac.cut-recovery', '0') if hal.get_value('halui.machine.is-on'): if hal.get_value('plasmac.arc-ok-out'): isIdleOn = False for joint in range(0, int(self.i.find('KINS', 'JOINTS'))): if not self.s.homed[joint]: isIdleHomed = False break else: isIdleHomed = False isIdleOn = False for n in range(10, 20): if 'load' in self.iniButtonCode[n]: pass elif 'change-consumables' in self.iniButtonCode[n]: if hal.get_value('halui.program.is-paused') and \ hal.get_value('plasmac.stop-type-out') > 1 and \ not hal.get_value('plasmac.cut-recovering'): self.builder.get_object('button' + str(n)).set_sensitive(True) else: self.builder.get_object('button' + str(n)).set_sensitive(False) elif 'cut-recovery' in self.iniButtonCode[n]: if hal.get_value('halui.program.is-paused') and hal.get_value('plasmac.motion-type') > 1 and \ not hal.get_value('plasmac.consumable-changing'): self.builder.get_object('button' + str(n)).set_sensitive(True) else: self.builder.get_object('button' + str(n)).set_sensitive(False) elif 'ohmic-test' in self.iniButtonCode[n]: if isIdleOn or hal.get_value('halui.program.is-paused'): self.builder.get_object('button' + str(n)).set_sensitive(True) else: self.builder.get_object('button' + str(n)).set_sensitive(False) elif not 'cut-type' in self.iniButtonCode[ n] and not self.iniButtonCode[n].startswith('%'): if isIdleHomed: self.builder.get_object('button' + str(n)).set_sensitive(True) else: self.builder.get_object('button' + str(n)).set_sensitive(False) # decrement probe timer if active if self.probeTimer: if hal.get_value( 'plasmac.probe-test-error') and not self.probePressed: self.probeTimer = 0 elif time.time() >= self.probeStart + 1: self.probeStart += 1 self.probeTimer -= 1 self.probeButton.set_label(str(int(self.probeTimer))) self.probeButton.set_style(self.buttonRed) if not self.probeTimer and not self.probePressed: hal.set_p('plasmac.probe-test', '0') self.probeButton.set_label(self.probeText) self.probeButton.set_style(self.buttonPlain) if self.gui == 'gmoccapy': if self.inFile and self.inFile != self.s.file: if not 'PlaSmaC' in self.s.file or 'PlaSmaC0' in self.s.file: self.builder.get_object(self.cutButton).set_style( self.buttonPlain) self.builder.get_object( self.cutButton).set_label('Pierce & Cut') self.cutType = 0 elif 'PlaSmaC1' in self.s.file: self.builder.get_object(self.cutButton).set_style( self.buttonOrange) self.builder.get_object( self.cutButton).set_label('Pierce Only') self.cutType = 1 if (hal.get_value('axis.x.eoffset') or hal.get_value('axis.y.eoffset') ) and not hal.get_value('halui.program.is-paused'): hal.set_p('plasmac.consumable-change', '0') hal.set_p('plasmac.x-offset', '0') hal.set_p('plasmac.y-offset', '0') hal.set_p('plasmac.xy-feed-rate', '0') return True
# get minimum pressure setting pMin = read_register(rPressureMin) if pMin: pmx485.pressure_min = round(int(pMin, 16) / 128.0, 1) # get maximum pressure setting pMax = read_register(rPressureMax) if pMax: pmx485.pressure_max = round(int(pMax, 16) / 128.0, 1) if cMin and cMax and pMin and pMax: return True else: return False # main loop while hal.component_exists('motmod'): try: # only run not enabled code once, saves memory usage if enabled != pmx485.enable: enabled = pmx485.enable if not enabled: close_machine() comms.close() pmx485.status = False started = False if enabled: if not started: if not comms.isOpen(): comms.open() if open_machine(): started = True
def periodic(self): # exit if linuxcnc not running if not hal.component_exists('plasmac_run'): self.W.destroy() return True
if pMin: pmx485.pressure_min = round(int(pMin, 16) / 128.0, 1) # get maximum pressure setting pMax = read_register(rPressureMax) if pMax: pmx485.pressure_max = round(int(pMax, 16) / 128.0, 1) if cMin and cMax and pMin and pMax: return True else: return False # main loop try: while 1: if hal.component_exists('qtplasmac'): if enabled != pmx485.enable: enabled = pmx485.enable if not enabled: close_machine() comms.close() pmx485.status = False started = False if enabled: if not started: if not comms.isOpen(): comms.open() if open_machine(): started = True if started and get_limits(): started = True
# print('\nPowermax Settings:') # print(' Mode Force = {}'.format(int(pmx485.mode_set))) # print(' Current Force = {}'.format(int(pmx485.current_set))) # print('Pressure Force = {}'.format(int(pmx485.pressure_set))) # print(' Current Min = {}'.format(pmx485.current_min)) # print(' Current Max = {}'.format(pmx485.current_max)) # print(' Pressure Min = {}'.format(pmx485.pressure_min)) # print(' Pressure Max = {}\n'.format(pmx485.pressure_max)) return True else: return False # main loop try: while 1: if hal.component_exists('plasmac_run'): if enabled != pmx485.enable: enabled = pmx485.enable if not enabled: close_machine() comms.close() pmx485.status = False started = False if enabled: if not started: if not comms.isOpen(): comms.open() if open_machine(): started = True if started and get_limits(): started = True
def load_ladder(self,*args): if hal.component_exists('classicladder_rt'): p = os.popen("classicladder &","w")
def on_launch_classicladder(self, action, data): if hal.component_exists("classicladder_rt"): p = os.popen("classicladder &", "w") else: text = "Classicladder real-time component not detected" self.error_dialog.run(text)