예제 #1
0
    def __init__(self, halcomp,builder,useropts):

        self.plasmacVersion = 'PlasmaC v0.174'

        self.W = gtk.Window()
        self.halcomp = halcomp
        self.builder = builder
        self.i = linuxcnc.ini(os.environ['INI_FILE_NAME'])
        hal_glib.GPin(halcomp.newpin('config-disable', hal.HAL_BIT, hal.HAL_IN))
        configDisable = self.i.find('PLASMAC', 'CONFIG_DISABLE') or '0'
        hal.set_p('plasmac_config.config-disable',configDisable)
        self.idlePin = hal_glib.GPin(halcomp.newpin('program-is-idle', hal.HAL_BIT, hal.HAL_IN))
        hal.connect('plasmac_config.program-is-idle', 'plasmac:program-is-idle') 
        self.idlePin.connect('value-changed', self.idle_changed)
        self.thcFeedRate = (float(self.i.find('AXIS_Z', 'MAX_VELOCITY')) * \
                              float(self.i.find('AXIS_Z', 'OFFSET_AV_RATIO'))) * 60
        self.configFile = self.i.find('EMC', 'MACHINE').lower() + '_config.cfg'
        self.prefFile = self.i.find('EMC', 'MACHINE') + '.pref'
        self.configDict = {}
        self.oldMode = 9
        self.materialsUpdate = False
        self.maxHeight = hal.get_value('ini.z.max_limit') - hal.get_value('ini.z.min_limit')
        self.configure_widgets()
        self.builder.get_object('probe-feed-rate-adj').set_upper(self.builder.get_object('setup-feed-rate').get_value())
        self.load_settings()
        self.set_theme()
        gobject.timeout_add(100, self.periodic)
예제 #2
0
 def __init__(self, halcomp, builder, useropts):
     self.W = gtk.Window()
     self.halcomp = halcomp
     self.builder = builder
     self.i = linuxcnc.ini(os.environ['INI_FILE_NAME'])
     self.upgrade_check()
     self.c = linuxcnc.command()
     self.s = linuxcnc.stat()
     self.cutTypePin = hal_glib.GPin(
         halcomp.newpin('cut-type', hal.HAL_S32, hal.HAL_IN))
     self.materialNumberPin = hal_glib.GPin(
         halcomp.newpin('material-change-number', hal.HAL_S32, hal.HAL_IN))
     self.materialChangePin = hal_glib.GPin(
         halcomp.newpin('material-change', hal.HAL_S32, hal.HAL_IN))
     self.firstMaterialPin = hal_glib.GPin(
         halcomp.newpin('first-material', hal.HAL_S32, hal.HAL_IN))
     self.thcEnablePin = hal_glib.GPin(
         halcomp.newpin('thc-enable-out', hal.HAL_BIT, hal.HAL_OUT))
     self.materialNumberPin.connect('value-changed',
                                    self.material_change_number_changed)
     self.materialChangePin.connect('value-changed',
                                    self.material_change_changed)
     self.firstMaterialPin.connect('value-changed',
                                   self.first_material_changed)
     self.idlePin = hal_glib.GPin(
         halcomp.newpin('program-is-idle', hal.HAL_BIT, hal.HAL_IN))
     hal.connect('plasmac_run.program-is-idle', 'plasmac:program-is-idle')
     self.idlePin.connect('value-changed', self.idle_changed)
     self.previewPin = hal_glib.GPin(
         halcomp.newpin('preview-tab', hal.HAL_BIT, hal.HAL_IN))
     self.thcFeedRate = (float(self.i.find('AXIS_Z', 'MAX_VELOCITY')) * \
                         float(self.i.find('AXIS_Z', 'OFFSET_AV_RATIO'))) * 60
     hal.set_p('plasmac.thc-feed-rate', '{}'.format(self.thcFeedRate))
     self.configFile = self.i.find('EMC', 'MACHINE').lower() + '_run.cfg'
     self.prefFile = self.i.find('EMC', 'MACHINE') + '.pref'
     self.materialFile = self.i.find('EMC',
                                     'MACHINE').lower() + '_material.cfg'
     self.materialFileDict = {}
     self.materialDict = {}
     self.configDict = {}
     self.materialNumList = []
     hal.set_p('plasmac.mode',
               '{}'.format(int(self.i.find('PLASMAC', 'MODE') or '0')))
     self.oldMode = 9
     self.oldMaterial = -1
     self.materialUpdate = False
     self.autoChange = False
     self.manualChange = False
     self.configure_widgets()
     self.load_settings()
     self.check_material_file()
     self.get_material()
     self.set_theme()
     gobject.timeout_add(100, self.periodic)
예제 #3
0
 def check_hal_connections(self):
     level = int(self.i.find('TRAJ', 'SPINDLES')) or 1
     if hal.get_value('plasmac.multi-tool'):
         if level >= 2:
             hal.new_sig('plasmac:scribe-is-on',hal.HAL_BIT)
             hal.connect('spindle.1.on','plasmac:scribe-is-on')
             hal.connect('plasmac.scribe-on','plasmac:scribe-is-on')
         if level == 3:
             hal.new_sig('plasmac:centre-spot-is-on',hal.HAL_BIT)
             hal.connect('spindle.2.on','plasmac:centre-spot-is-on')
             hal.connect('plasmac.centre-spot-on','plasmac:centre-spot-is-on')
예제 #4
0
e = linuxcnc.error_channel()


h = hal.component("test-ui")
h.newpin("tool-number", hal.HAL_S32, hal.HAL_IN)
h.newpin("tool-prep-number", hal.HAL_S32, hal.HAL_IN)
h.newpin("tool-prep-pocket", hal.HAL_S32, hal.HAL_IN)
h.newpin("tool-prepare", hal.HAL_BIT, hal.HAL_IN)
h.newpin("tool-prepared", hal.HAL_BIT, hal.HAL_OUT)
h.newpin("tool-change", hal.HAL_BIT, hal.HAL_IN)
h.newpin("tool-changed", hal.HAL_BIT, hal.HAL_OUT)
h['tool-prepared'] = False
h['tool-changed'] = False
h.ready()

hal.connect('test-ui.tool-number', 'tool-number')
hal.connect('test-ui.tool-prep-number', 'tool-prep-number')
hal.connect('test-ui.tool-prep-pocket', 'tool-prep-pocket')

hal.connect('test-ui.tool-prepare', 'tool-prepare')
hal.connect('test-ui.tool-prepared', 'tool-prepared')
hal.connect('test-ui.tool-change', 'tool-change')
hal.connect('test-ui.tool-changed', 'tool-changed')


# Wait for LinuxCNC to initialize itself so the Status buffer stabilizes.
wait_for_linuxcnc_startup(s)

c.state(linuxcnc.STATE_ESTOP_RESET)
c.state(linuxcnc.STATE_ON)
c.home(-1)
예제 #5
0
    print("queued_mdi_commands at %d after %.3f seconds" %
          (s.queued_mdi_commands, timeout))
    sys.exit(1)


c = linuxcnc.command()
s = linuxcnc.stat()
e = linuxcnc.error_channel()

h = hal.component("test-ui")
h.newpin("digital-poker", hal.HAL_BIT, hal.HAL_OUT)
h['digital-poker'] = False
h.ready()

hal.new_sig('poke', hal.HAL_BIT)
hal.connect('motion.digital-in-00', 'poke')
hal.connect('test-ui.digital-poker', 'poke')

# Wait for LinuxCNC to initialize itself so the Status buffer stabilizes.
wait_for_linuxcnc_startup(s)

c.state(linuxcnc.STATE_ESTOP_RESET)
c.state(linuxcnc.STATE_ON)
c.home(-1)
c.wait_complete()

c.mode(linuxcnc.MODE_MDI)

# At startup there's nothing in the queue.
s.poll()
assert (s.queued_mdi_commands == 0)
예제 #6
0
def assert_wait_complete(command):
    r = command.wait_complete()
    print "wait_complete() returns", r
    assert ((r == linuxcnc.RCS_DONE) or (r == linuxcnc.RCS_ERROR))


#
# connect to HAL
#

comp = hal.component("test-ui")
comp.newpin("x-neg-lim-sw", hal.HAL_BIT, hal.HAL_OUT)
comp.ready()

hal.connect('test-ui.x-neg-lim-sw', 'x-neg-lim-sw')

#
# connect to LinuxCNC
#

c = linuxcnc.command()
s = linuxcnc.stat()
e = linuxcnc.error_channel()

#
# Come out of E-stop, turn the machine on, switch to Manual mode, and home.
#

c.state(linuxcnc.STATE_ESTOP_RESET)
c.state(linuxcnc.STATE_ON)
import hal, time
import parallel'

p = parallel.Parallel()
h = hal.component("test")

# create pins and parameters with calls to h.newpin and h.newparam
h.newpin("in", hal.HAL_FLOAT, hal.HAL_IN)
h.newpin("out", hal.HAL_FLOAT, hal.HAL_OUT)
h.ready() # mark the component as 'ready'
#print h.getitem("13")
hal.connect()

try:
	while 1:
	    # act on changed input pins; update values on output pins
	    time.sleep(1)
	    h['out'] = h['in']
except KeyboardInterrupt: pass

예제 #8
0
    print "queued_mdi_commands at %d after %.3f seconds" % (s.queued_mdi_commands, timeout)
    sys.exit(1)


c = linuxcnc.command()
s = linuxcnc.stat()
e = linuxcnc.error_channel()


h = hal.component("test-ui")
h.newpin("digital-poker", hal.HAL_BIT, hal.HAL_OUT)
h['digital-poker'] = False
h.ready()

hal.new_sig('poke', hal.HAL_BIT)
hal.connect('motion.digital-in-00', 'poke')
hal.connect('test-ui.digital-poker', 'poke')


# Wait for LinuxCNC to initialize itself so the Status buffer stabilizes.
wait_for_linuxcnc_startup(s)

c.state(linuxcnc.STATE_ESTOP_RESET)
c.state(linuxcnc.STATE_ON)
c.home(-1)
c.wait_complete()

c.mode(linuxcnc.MODE_MDI)

# At startup there's nothing in the queue.
s.poll()
예제 #9
0
def assert_wait_complete(command):
    r = command.wait_complete()
    print "wait_complete() returns", r
    assert (r == linuxcnc.RCS_DONE) or (r == linuxcnc.RCS_ERROR)


#
# connect to HAL
#

comp = hal.component("test-ui")
comp.newpin("x-neg-lim-sw", hal.HAL_BIT, hal.HAL_OUT)
comp.ready()

hal.connect("test-ui.x-neg-lim-sw", "x-neg-lim-sw")


#
# connect to LinuxCNC
#

c = linuxcnc.command()
s = linuxcnc.stat()
e = linuxcnc.error_channel()


#
# Come out of E-stop, turn the machine on, switch to Manual mode, and home.
#
예제 #10
0
def assert_wait_complete(command):
    r = command.wait_complete()
    print "wait_complete() returns", r
    assert((r == linuxcnc.RCS_DONE) or (r == linuxcnc.RCS_ERROR))


#
# connect to HAL
#

comp = hal.component("test-ui")
comp.newpin("x-neg-lim-sw", hal.HAL_BIT, hal.HAL_OUT)
comp.ready()

hal.connect('test-ui.x-neg-lim-sw', 'x-neg-lim-sw')


#
# connect to LinuxCNC
#

c = linuxcnc.command()
s = linuxcnc.stat()
e = linuxcnc.error_channel()


#
# Come out of E-stop, turn the machine on, switch to Manual mode, and home.
#