コード例 #1
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.c = linuxcnc.command()
     self.s = linuxcnc.stat()
     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.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.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 = {}
     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)
コード例 #2
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)
コード例 #3
0
    def __init__(self, halcomp,builder,useropts):
        self.halcomp = halcomp
        self.builder = builder
        self.ini_filename = 'savestate.sav'
        self.defaults = {  IniFile.vars: dict(),
                           IniFile.widgets : widget_defaults(select_widgets(self.builder.get_objects(), hal_only=False,output_only = True))
                        }
        self.ini = IniFile(self.ini_filename,self.defaults,self.builder)
        self.ini.restore_state(self)

        # A pin to use a physical switch to start the cycle
        self.cycle_start = hal_glib.GPin(halcomp.newpin('cycle-start', hal.HAL_BIT, hal.HAL_IN))
        self.cycle_start.connect('value-changed', self.cycle_pin)

        # A pin to mask cycle-start so that Touchy doesn't run auto.
        self.visible = hal_glib.GPin(halcomp.newpin('visible', hal.HAL_BIT, hal.HAL_OUT))
 
        # This catches the signal from Touchy to say that the tab is exposed 
        t = self.builder.get_object('eventbox1')
        t.connect('map-event',self.on_map_event)
        t.add_events(gtk.gdk.STRUCTURE_MASK)
        self.cmd = linuxcnc.command()

        # This conects the expose event to re-draw and scale the SVG frames
        t = self.builder.get_object('tabs1')
        t.connect_after("expose_event", self.on_expose)
        t.connect("destroy", gtk.main_quit)
        t.add_events(gtk.gdk.STRUCTURE_MASK)
        self.svg = rsvg.Handle(file='LatheMacro.svg', )
コード例 #4
0
ファイル: spartan_handler.py プロジェクト: TurBoss/linuxcnc
 def initialize_pins(self):
     self.gscreen.init_spindle_pins()
     self.gscreen.init_coolant_pins()
     self.gscreen.init_jog_pins()
     self.gscreen.init_override_pins()
     self.gscreen.init_control_pins()
     self.gscreen.halcomp.newpin("spindle-spd-disp", hal.HAL_FLOAT,
                                 hal.HAL_IN)
     self.gscreen.halcomp.newpin("jog-spd-out", hal.HAL_FLOAT, hal.HAL_OUT)
     self.gscreen.halcomp.newpin("jog-inc-out", hal.HAL_FLOAT, hal.HAL_OUT)
     self.data['ext-estop'] = hal_glib.GPin(
         self.gscreen.halcomp.newpin('ext-estop', hal.HAL_BIT, hal.HAL_IN))
     self.data['ext-estop'].connect('value-changed', self.on_estop_in)
     self.data['enc-fault-x'] = hal_glib.GPin(
         self.gscreen.halcomp.newpin('enc-fault-x', hal.HAL_BIT,
                                     hal.HAL_IN))
     self.data['enc-fault-x'].connect('value-changed', self.on_x_enc_fault)
     self.data['enc-fault-y'] = hal_glib.GPin(
         self.gscreen.halcomp.newpin('enc-fault-y', hal.HAL_BIT,
                                     hal.HAL_IN))
     self.data['enc-fault-y'].connect('value-changed', self.on_y_enc_fault)
     self.data['enc-fault-x'] = hal_glib.GPin(
         self.gscreen.halcomp.newpin('enc-fault-z', hal.HAL_BIT,
                                     hal.HAL_IN))
     self.data['enc-fault-x'].connect('value-changed', self.on_z_enc_fault)
コード例 #5
0
ファイル: gladevcp-jwp.py プロジェクト: EqAfrica/machinekit-1
    def __init__(self, halcomp, builder, useropts):
        self.halcomp = halcomp
        self.builder = builder

        (directory, filename) = os.path.split(__file__)
        (basename, extension) = os.path.splitext(filename)
        self.ini_filename = os.path.join(directory, basename + '.ini')
        self.defaults = {
            IniFile.vars: {},
            IniFile.widgets:
            widget_defaults(
                select_widgets(self.builder.get_objects(),
                               hal_only=True,
                               output_only=True)),
        }
        self.ini = IniFile(self.ini_filename, self.defaults, self.builder)
        self.ini.restore_state(self)

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

        self.state = hal_glib.GPin(
            halcomp.newpin('state', hal.HAL_S32, hal.HAL_IN))
        self.state.connect('value-changed', self._on_state_changed)

        self.motion_type = hal_glib.GPin(
            halcomp.newpin('motion_type', hal.HAL_S32, hal.HAL_IN))
        self.motion_type.connect('value-changed', self._on_motion_type_changed)
コード例 #6
0
 def __init__(self, halcomp,builder,useropts):
     self.inifile = linuxcnc.ini(os.environ["INI_FILE_NAME"])
     self.configpath = os.environ['CONFIG_DIR']
     self.toolfile = os.path.join( self.configpath, self.inifile.find("EMCIO", "TOOL_TABLE") )
     self.builder = builder
     self.halcomp = halcomp
     self.change_text = builder.get_object("lbl_tool_change_info")
     self.ref_tool = builder.get_object("reftool")
     
     self.command_value_to_name = {}
     value = 1
     for command in self.commands:
         self.halcomp.newpin(command, hal.HAL_FLOAT, hal.HAL_IN)
         hal.set_p(halcomp.getprefix() + "." + command, str(value))
         self.command_value_to_name[value] = command
         value = value + 1
     
     self.gcode_command = hal_glib.GPin(halcomp.newpin("gcode-command", hal.HAL_FLOAT, hal.HAL_IN))
     self.gcode_param = hal_glib.GPin(halcomp.newpin("gcode-parameter", hal.HAL_FLOAT, hal.HAL_IN))
     self.num_of_tools = hal_glib.GPin(halcomp.newpin("num_of_tools", hal.HAL_FLOAT, hal.HAL_IN))
     
     self.gcode_command.connect("value-changed", self.command_from_gcode)
     self.gcode_param.connect("value-changed", self.parameter_from_gcode)
     
     self.parameter = None
     self.tools_in_file = []
     
     self.tooledit1 = self.builder.get_object("tooledit1")
     self.tooledit1.set_filename(self.toolfile)
     
     self.liststore1 = self.builder.get_object("liststore1")
     self.treeview1 = self.builder.get_object("treeview1")
     
     # Set tool table columns
     tool_table_width = self.treeview1.get_property("width_request")
     self.cell_desc = self.builder.get_object("cell_desc")
     self.cell_desc.props.wrap_mode = pango.WRAP_WORD
     self.cell_desc.props.wrap_width = int(self.COL_TOOL_NAME_WIDTH * tool_table_width)
     self.cell_operation = self.builder.get_object("cell_operation")
     self.cell_operation.props.wrap_mode = pango.WRAP_WORD
     self.cell_operation.props.wrap_width = int(self.COL_TOOL_OPERATION_WIDTH * tool_table_width)
     
     self.current_tool_index = -1
     self.spindle_rpm_bar = self.builder.get_object("spindle_speed")
     
     self.gcode_command = hal_glib.GPin(halcomp.newpin("spindle-target-speed", hal.HAL_FLOAT, hal.HAL_IN))
     self.gcode_command.connect("value-changed", self.spindle_target_changed)
     
     self.file_progress_bar = self.builder.get_object("file_progress")
     self.rows_in_file = 200
     self.current_row = 0
     self.spindle_on_timer = 0
     glib.timeout_add_seconds(1, self._on_timer_tick)
     
     self.runtime = self.builder.get_object("runtime")
コード例 #7
0
ファイル: qtdragon_handler.py プロジェクト: taloot/linuxcnc
 def init_pins(self):
     pin = self.h.newpin("spindle_speed_fb", hal.HAL_FLOAT, hal.HAL_IN)
     hal_glib.GPin(pin).connect("value_changed", self.spindle_fb_changed)
     pin = self.h.newpin("spindle_amps", hal.HAL_FLOAT, hal.HAL_IN)
     hal_glib.GPin(pin).connect("value_changed", self.spindle_amps_changed)
     pin = self.h.newpin("spindle_power", hal.HAL_FLOAT, hal.HAL_IN)
     hal_glib.GPin(pin).connect("value_changed", self.spindle_power_changed)
     pin = self.h.newpin("spindle_fault", hal.HAL_U32, hal.HAL_IN)
     hal_glib.GPin(pin).connect("value_changed", self.spindle_fault_changed)
     pin = self.h.newpin("modbus-errors", hal.HAL_U32, hal.HAL_IN)
     hal_glib.GPin(pin).connect("value_changed", self.mb_errors_changed)
コード例 #8
0
    def __init__(self, halcomp, builder, useropts):
        self.builder = builder
        self.halcomp = halcomp

        # lets make our hal pins, to find out what pins you can build, please take a look at
        # http://www.linuxcnc.org/docs/devel/html/hal/halmodule.html#_create_pins_and_parameters
        # This way we are able to handle events here
        pin = hal_glib.GPin(
            self.halcomp.newpin("hide-panel", hal.HAL_BIT, hal.HAL_IN))
        pin.connect("value_changed", self._hide_panel_changed)

        # and this way we just can read or write the pin values, but not react to the changes
        self.halcomp.newpin("panel-is-hidden", hal.HAL_BIT, hal.HAL_OUT)

        # if we want to have handlers to our widgets, or we want to modify them, we
        # need to get there instance with the builder
        # we get the needed widgets and connect them like so
        self.vbox_main = self.builder.get_object("vbox_main")
        self.lbl_text = self.builder.get_object("lbl_text")
        self.lbl_pin_value = self.builder.get_object("lbl_pin_value")

        # Oh there is a button we will connect the pressed event to our own handler
        self.btn_set_text_to_label = self.builder.get_object(
            "btn_set_text_to_label")
        self.btn_set_text_to_label.connect("pressed",
                                           self._btn_set_text_to_label_pressed)

        # and this one to the clicked event
        self.btn_hide = self.builder.get_object("btn_hide")
        self.btn_hide.connect("clicked", self._btn_hide_clicked)

        self.btn_show_pin_value = self.builder.get_object("btn_show_pin_value")
        self.btn_show_pin_value.connect("clicked",
                                        self._on_btn_show_pin_value_clicked)
コード例 #9
0
    def __init__(self, halcomp, builder, useropts):
        super(ProbeScreenToolMeasurement, self).__init__(halcomp, builder, useropts)

        self.hal_led_set_m6 = self.builder.get_object("hal_led_set_m6")
        self.frm_probe_pos = self.builder.get_object("frm_probe_pos")
        self.spbtn_setter_height = self.builder.get_object("spbtn_setter_height")
        self.spbtn_block_height = self.builder.get_object("spbtn_block_height")
        self.btn_probe_tool_setter = self.builder.get_object("btn_probe_tool_setter")
        self.btn_probe_workpiece = self.builder.get_object("btn_probe_workpiece")
        self.btn_tool_dia = self.builder.get_object("btn_tool_dia")
        self.tooledit1 = self.builder.get_object("tooledit1")
        self.chk_use_tool_measurement = self.builder.get_object(
            "chk_use_tool_measurement"
        )

        self.chk_use_tool_measurement.set_active(
            self.prefs.getpref("use_tool_measurement", False, bool)
        )

        # make the pins for tool measurement
        self.halcomp.newpin("use_tool_measurement", hal.HAL_BIT, hal.HAL_OUT)
        self.halcomp.newpin("setterheight", hal.HAL_FLOAT, hal.HAL_OUT)
        self.halcomp.newpin("blockheight", hal.HAL_FLOAT, hal.HAL_OUT)
        # for manual tool change dialog
        self.halcomp.newpin("toolchange-number", hal.HAL_S32, hal.HAL_IN)
        self.halcomp.newpin("toolchange-prep-number", hal.HAL_S32, hal.HAL_IN)
        self.halcomp.newpin("toolchange-changed", hal.HAL_BIT, hal.HAL_OUT)
        pin = self.halcomp.newpin("toolchange-change", hal.HAL_BIT, hal.HAL_IN)
        hal_glib.GPin(pin).connect("value_changed", self.on_tool_change)

        if self.chk_use_tool_measurement.get_active():
            self.halcomp["use_tool_measurement"] = True
            self.hal_led_set_m6.hal_pin.set(1)

        self._init_tool_sensor_data()
コード例 #10
0
 def init_pins(self):
     # spindle control pins
     pin = self.h.newpin("spindle_amps", hal.HAL_FLOAT, hal.HAL_IN)
     hal_glib.GPin(pin).connect("value_changed", self.spindle_pwr_changed)
     pin = self.h.newpin("spindle_volts", hal.HAL_FLOAT, hal.HAL_IN)
     hal_glib.GPin(pin).connect("value_changed", self.spindle_pwr_changed)
     pin = self.h.newpin("spindle_fault", hal.HAL_U32, hal.HAL_IN)
     hal_glib.GPin(pin).connect("value_changed", self.spindle_fault_changed)
     pin = self.h.newpin("modbus-errors", hal.HAL_U32, hal.HAL_IN)
     hal_glib.GPin(pin).connect("value_changed", self.mb_errors_changed)
     # external offset control pins
     self.h.newpin("eoffset_enable", hal.HAL_BIT, hal.HAL_OUT)
     self.h.newpin("eoffset_clear", hal.HAL_BIT, hal.HAL_OUT)
     self.h.newpin("eoffset_count", hal.HAL_S32, hal.HAL_OUT)
     pin = self.h.newpin("eoffset_value", hal.HAL_FLOAT, hal.HAL_IN)
     hal_glib.GPin(pin).connect("value_changed", self.eoffset_changed)
コード例 #11
0
ファイル: run.py プロジェクト: rprimasta/beamsaw-cassade-sby
 def __init__(self, halcomp, builder, useropts):
     hal_glib.GPin(halcomp.newpin('hal_currF', hal.HAL_FLOAT, hal.HAL_OUT))
     self.halcomp = halcomp
     self.builder = builder
     thread.start_new_thread(self.timer1, (
         "Timer1",
         0.1,
     ))
コード例 #12
0
ファイル: meter_scale.py プロジェクト: reynor/linuxcnc
    def __init__(self, halcomp,builder,useropts):
        self.builder = builder

        # hal pin with change callback.
        # When the pin's value changes the callback is executed.
        self.max_value = hal_glib.GPin(halcomp.newpin('max-value',  hal.HAL_FLOAT, hal.HAL_IN))
        self.max_value.connect('value-changed', self._on_max_value_change)

        inifile = linuxcnc.ini(os.getenv("EXAMPLE_CFG"))
        mmin = float(inifile.find("METER", "MIN") or 0.0)
        self.meter = self.builder.get_object('meter')
        self.meter.min = mmin
コード例 #13
0
    def __init__(self, halcomp, builder, useropts):
        self.builder = builder

        # hal pin with change callback.
        # When the pin's value changes the callback is executed.
        self.max_value = hal_glib.GPin(
            halcomp.newpin('max-value', hal.HAL_FLOAT, hal.HAL_IN))
        self.max_value.connect('value-changed', self._on_max_value_change)

        inifile = labvcnc.ini(os.getenv("INI_FILE_NAME"))
        mmax = float(inifile.find("METER", "MAX") or 100.0)
        self.meter = self.builder.get_object('meter')
        self.max_value.set(mmax)
コード例 #14
0
    def initialize_pins(self):
        self.gscreen.init_spindle_pins()
        self.gscreen.init_coolant_pins()
        self.gscreen.init_jog_pins()
        self.gscreen.init_override_pins()
        self.gscreen.init_control_pins()
        self.gscreen.halcomp.newpin("spindle-spd-disp", hal.HAL_FLOAT,
                                    hal.HAL_IN)
        self.gscreen.halcomp.newpin("jog-spd-out", hal.HAL_FLOAT, hal.HAL_OUT)
        self.data['ext-estop'] = hal_glib.GPin(
            self.gscreen.halcomp.newpin('ext-estop', hal.HAL_BIT, hal.HAL_IN))
        self.data['ext-estop'].connect('value-changed', self.on_estop_in)
        self.data['enc-fault-x'] = hal_glib.GPin(
            self.gscreen.halcomp.newpin('enc-fault-x', hal.HAL_BIT,
                                        hal.HAL_IN))
        self.data['enc-fault-x'].connect('value-changed', self.on_x_enc_fault)
        self.data['enc-fault-y'] = hal_glib.GPin(
            self.gscreen.halcomp.newpin('enc-fault-y', hal.HAL_BIT,
                                        hal.HAL_IN))
        self.data['enc-fault-y'].connect('value-changed', self.on_y_enc_fault)
        self.data['enc-fault-x'] = hal_glib.GPin(
            self.gscreen.halcomp.newpin('enc-fault-z', hal.HAL_BIT,
                                        hal.HAL_IN))
        self.data['enc-fault-x'].connect('value-changed', self.on_z_enc_fault)
        self.gscreen.halcomp.newpin("spindle-gear-sel", hal.HAL_BIT,
                                    hal.HAL_OUT)

        data = self.gscreen.prefs.getpref('spindle_gear', 2500.0, float)
        self.data.spindle_gear = data
        self.widgets.spindle_gear.set_value(data)
        if data == 2500:
            self.gscreen.halcomp["spindle-gear-sel"] = True
        elif data == 1250:
            self.gscreen.halcomp["spindle-gear-sel"] = False
        self.data.max_accel = self.gscreen.prefs.getpref(
            'accel_sel', 5.6, float)
        self.widgets.accel_sel.set_value(self.data.max_accel)
コード例 #15
0
ファイル: my_handler.py プロジェクト: fupe/syntec-panel-6x8
    def init_my_pins(self):
        """create HAL pins """

        self.data['key_panel'] = hal_glib.GPin(
            self.halcomp.newpin('key_panel', hal.HAL_U32, hal.HAL_IN))
        self.data['key_led'] = hal_glib.GPin(
            self.halcomp.newpin('key_led', hal.HAL_U32, hal.HAL_OUT))
        self.data['wheel'] = hal_glib.GPin(
            self.halcomp.newpin('wheel', hal.HAL_S32, hal.HAL_IN))
        self.data['light'] = hal_glib.GPin(
            self.halcomp.newpin('light', hal.HAL_BIT, hal.HAL_OUT))
        self.data['nokey'] = hal_glib.GPin(
            self.halcomp.newpin('nokey', hal.HAL_BIT, hal.HAL_IN))
        self.data['jog_scale'] = hal_glib.GPin(
            self.halcomp.newpin('jog_scale', hal.HAL_FLOAT, hal.HAL_OUT))
        self.data['jog_angular_scale'] = hal_glib.GPin(
            self.halcomp.newpin('jog_angular_scale', hal.HAL_FLOAT,
                                hal.HAL_OUT))
        self.data['shutdown'] = hal_glib.GPin(
            self.halcomp.newpin('shutdown', hal.HAL_BIT, hal.HAL_IN))
        self.data['homed'] = hal_glib.GPin(
            self.halcomp.newpin('homed', hal.HAL_BIT, hal.HAL_IN))
        self.halcomp['jog_scale'] = self.x1_mpg_scale
        self.halcomp['jog_angular_scale'] = self.x1_mpg_angular_scale
コード例 #16
0
ファイル: complex.py プロジェクト: auto-mation-assist/LABVcnc
    def _hal_setup(self,halcomp, builder):
        '''
        hal related initialisation
        '''

        # the toplevel window is always named 'window1'. Do not change.
        # widgets may be accessed through builder.get_object() and
        # builder.get_objects()
        self.window1 = self.builder.get_object("window1")
        self.led1 = self.builder.get_object("hal_led1")

        # standard hal pins not associated with any widget
        self.halcomp.newpin("example-out", hal.HAL_BIT, hal.HAL_OUT)
        self.halcomp.newpin("example-in", hal.HAL_S32, hal.HAL_IN)

        # hal pins with change callback. Also unrelated to any HAL widget.
        # When the pin's value changes the callback is executed.
        self.example_trigger = hal_glib.GPin(halcomp.newpin('example-trigger',  hal.HAL_BIT, hal.HAL_IN))
        self.example_trigger.connect('value-changed', self._on_example_trigger_change)
コード例 #17
0
    def __init__(self):
        self.lcnc = linuxCNC()
#        gtk.settings_get_default().set_property('gtk-theme-name', self.lcnc.iniFile.find('PLASMAC', 'THEME'))
        self.gui = "./plasmac/test/plasmac_test.glade"
        self.B = gtk.Builder()
        self.B.add_from_file(self.gui)
        self.B.connect_signals(self)
        self.W=self.B.get_object("window1")
        self.halcomp = hal.component('plasmactest')
        self.panel = gladevcp.makepins.GladePanel(self.halcomp, self.gui, self.B, None)
        self.torch = hal_glib.GPin(self.halcomp.newpin('torch-on', hal.HAL_BIT, hal.HAL_IN))
        self.halcomp.ready()
        sp.Popen(['halcmd net plasmac:torch-on plasmactest.torch-on'], shell=True)
        self.torch.connect('value-changed', self.torch_changed)
        if not hal.pin_has_writer('plasmac.arc-ok-in'):
            sp.Popen(['halcmd net p_test:arc-ok-in plasmactest.arcOk plasmac.arc-ok-in'], shell=True)
        if not hal.pin_has_writer('plasmac.arc-voltage-in'):
            sp.Popen(['halcmd net p_test:arc-voltage-in plasmactest.arcVoltage plasmac.arc-voltage-in'], shell=True)
        if not hal.pin_has_writer('debounce.0.0.in'):
            sp.Popen(['halcmd net p_test:float-switch plasmactest.floatSwitch debounce.0.0.in'], shell=True)
        if not hal.pin_has_writer('debounce.0.1.in'):
            sp.Popen(['halcmd net p_test:breakaway-switch plasmactest.breakawaySwitch debounce.0.1.in'], shell=True)
        if not hal.pin_has_writer('debounce.0.2.in'):
            sp.Popen(['halcmd net p_test:ohmic-probe plasmactest.ohmicProbe debounce.0.2.in'], shell=True)
        if not hal.pin_has_writer('plasmac.move-down'):
            sp.Popen(['halcmd net p_test:move-down plasmactest.moveDown plasmac.move-down'], shell=True)
        if not hal.pin_has_writer('plasmac.move-up'):
            sp.Popen(['halcmd net p_test:move-up plasmactest.moveUp plasmac.move-up'], shell=True)
        self.W.connect('delete_event', self.ignore)
        self.W.set_type_hint(gdk.WINDOW_TYPE_HINT_MENU)
        self.W.set_keep_above(True)
        self.W.show_all()
        mode = self.lcnc.iniFile.find('PLASMAC', 'MODE') or '0'
        if mode not in '012':
            mode = 0
        self.B.get_object('mode' + mode).set_active(1)
        functions = {'0': self.on_mode0_toggled(0), '1': self.on_mode1_toggled(0), '2': self.on_mode2_toggled(0), }
        if mode in functions:
            functions[mode]
コード例 #18
0
    def __init__(self, halcomp,builder,useropts):
        self.halcomp = halcomp
        self.builder = builder
        self.i = labvcnc.ini(os.environ['INI_FILE_NAME'])
        self.prefFile = self.i.find('LBV', 'MACHINE') + '.pref'
        self.set_theme()
        self.pierceCount = hal_glib.GPin(halcomp.newpin('pierce-count', hal.HAL_S32, hal.HAL_IN))
        self.pierceCount.connect('value-changed', self.pierce_count_changed)
        self.cutLength = hal_glib.GPin(halcomp.newpin('cut-length', hal.HAL_FLOAT, hal.HAL_IN))
        self.cutLength.connect('value-changed', self.cut_length_changed)
        self.cutTime = hal_glib.GPin(halcomp.newpin('cut-time', hal.HAL_FLOAT, hal.HAL_IN))
        self.cutTime.connect('value-changed', self.cut_time_changed)
        self.torchOn = hal_glib.GPin(halcomp.newpin('torch-on', hal.HAL_BIT, hal.HAL_IN))
        self.torchOn.connect('value-changed', self.torch_on_changed)
        self.progRun = hal_glib.GPin(halcomp.newpin('program-is-running', hal.HAL_BIT, hal.HAL_IN))
        self.progRun.connect('value-changed', self.prog_run_changed)
        self.progIdle = hal_glib.GPin(halcomp.newpin('program-is-idle', hal.HAL_BIT, hal.HAL_IN))
        self.progIdle.connect('value-changed', self.prog_idle_changed)
        self.statePin = hal_glib.GPin(halcomp.newpin('state', hal.HAL_S32, hal.HAL_IN))
        self.statePin.connect('value-changed', self.state_changed)
        self.rapidTime = hal_glib.GPin(halcomp.newpin('motion-type', hal.HAL_S32, hal.HAL_IN))
        self.rapidTime.connect('value-changed', self.motion_type_changed)
        self.pierceReset = self.builder.get_object('pierce-count-reset')
        self.pierceReset.connect('pressed', self.pierce_reset)
        self.cutLengthReset = self.builder.get_object('cut-length-reset')
        self.cutLengthReset.connect('pressed', self.cut_length_reset)
        self.cutTimeReset = self.builder.get_object('cut-time-reset')
        self.cutTimeReset.connect('pressed', self.cut_time_reset)
        self.torchTimeReset = self.builder.get_object('torch-time-reset')
        self.torchTimeReset.connect('pressed', self.torch_time_reset)
        self.runTimeReset = self.builder.get_object('run-time-reset')
        self.runTimeReset.connect('pressed', self.run_time_reset)
        self.rapidTimeReset = self.builder.get_object('rapid-time-reset')
        self.rapidTimeReset.connect('pressed', self.rapid_time_reset)
        self.probeTimeReset = self.builder.get_object('probe-time-reset')
        self.probeTimeReset.connect('pressed', self.probe_time_reset)
        self.allReset = self.builder.get_object('all-reset')
        self.allReset.connect('pressed', self.all_reset)
        # plasmac states
        self.IDLE          =  0
        self.PROBE_HEIGHT  =  1
        self.PROBE_DOWN    =  2
        self.PROBE_UP      =  3
        self.ZERO_HEIGHT   =  4
        self.PIERCE_HEIGHT =  5
        self.TORCH_ON      =  6
        self.ARC_OK        =  7
        self.PIERCE_DELAY  =  8
        self.PUDDLE_JUMP   =  9
        self.CUT_HEGHT     = 10
        self.CUTTING       = 11
        self.SAFE_HEIGHT   = 12
        self.MAX_HEIGHT    = 13
        self.FINISH        = 14
        self.TORCH_PULSE   = 15
        self.PAUSED_MOTION = 16
        self.OHMIC_TEST    = 17
        self.PROBE_TEST    = 18

        self.oldState      = 0
        self.oldMotionType = 0
        self.pierce_count  = 0
        self.cut_length    = 0
        self.thisCutLength = 0
        self.cut_time      = 0.0
        self.thisCutTime   = 0.0
        self.torch_time    = 0.0
        self.torchOn       = False
        self.progRun       = False
        self.rapid_time    = 0.0
        self.rapidOn       = False
        self.probe_time    = 0.0
        self.probeOn       = False
        self.defaults      = {IniFile.vars:{"PIERCE_COUNT" : 0,
                                            "CUT_LENGTH"   : 0.0,
                                            "CUT_TIME"     : 0.0,
                                            "TORCH_TIME"   : 0.0,
                                            "RUN_TIME"     : 0.0,
                                            "RAPID_TIME"   : 0.0,
                                            "PROBE_TIME"   : 0.0,
                                           },
                             }
        get_ini_info = getiniinfo.GetIniInfo()
        self.ini_filename = __name__ + ".var"
        self.ini = IniFile(self.ini_filename, self.defaults, self.builder)
        self.ini.restore_state(self)
        self.builder.get_object('pierce-countT').set_label('{:d}'.format(self.PIERCE_COUNT))
        self.builder.get_object('pierce-count').set_label('{:d}'.format(0))
        if hal.get_value('halui.machine.units-per-mm') == 1:
            self.builder.get_object('cut-lengthT').set_label('{:0.2f} M'.format(self.CUT_LENGTH * 0.001))
            self.builder.get_object('cut-length').set_label('{:0.2f} M'.format(0))
        else:
            self.builder.get_object('cut-lengthT').set_label('{:0.2f}\"'.format(self.CUT_LENGTH))
            self.builder.get_object('cut-length').set_label('{:0.2f}\"'.format(0))
        self.display_time('cut-timeT', self.CUT_TIME)
        self.display_time('torch-timeT', self.TORCH_TIME)
        self.display_time('run-timeT', self.RUN_TIME)
        self.display_time('rapid-timeT', self.RAPID_TIME)
        self.display_time('probe-timeT', self.PROBE_TIME)
        gobject.timeout_add(100, self.periodic)
コード例 #19
0
        def __init__(self,halcomp,builder,useropts):
                hal_glib.GPin(halcomp.newpin('debug_currProg', hal.HAL_U32, hal.HAL_OUT))
                hal_glib.GPin(halcomp.newpin('debug_numQueue', hal.HAL_U32, hal.HAL_OUT))

                hal_glib.GPin(halcomp.newpin('machine-on', hal.HAL_BIT, hal.HAL_IN))
                hal_glib.GPin(halcomp.newpin('force_unlock_table_ab', hal.HAL_BIT, hal.HAL_IN))
                hal_glib.GPin(halcomp.newpin('force_unlock_table_cd', hal.HAL_BIT, hal.HAL_IN))
                hal_glib.GPin(halcomp.newpin('abort_signal', hal.HAL_BIT, hal.HAL_IN))
                hal_glib.GPin(halcomp.newpin('prog-is-idle', hal.HAL_BIT, hal.HAL_IN))
                hal_glib.GPin(halcomp.newpin('prog-is-run', hal.HAL_BIT, hal.HAL_IN))
                hal_glib.GPin(halcomp.newpin('hal_tbl_ab_active', hal.HAL_BIT, hal.HAL_OUT))
                hal_glib.GPin(halcomp.newpin('hal_tbl_cd_active', hal.HAL_BIT, hal.HAL_OUT))
                hal_glib.GPin(halcomp.newpin('hal_tbl_ab_lock', hal.HAL_BIT, hal.HAL_OUT))
                hal_glib.GPin(halcomp.newpin('hal_tbl_cd_lock', hal.HAL_BIT, hal.HAL_OUT))
                hal_glib.GPin(halcomp.newpin('hal_start_a', hal.HAL_BIT, hal.HAL_IN))
                hal_glib.GPin(halcomp.newpin('hal_start_b', hal.HAL_BIT, hal.HAL_IN))
                hal_glib.GPin(halcomp.newpin('hal_start_c', hal.HAL_BIT, hal.HAL_IN))
                hal_glib.GPin(halcomp.newpin('hal_start_d', hal.HAL_BIT, hal.HAL_IN))
                self.halcomp = halcomp
                self.builder = builder
		self.builder.get_object("togglebutton1").set_sensitive(False)
		self.builder.get_object("togglebutton2").set_sensitive(False)
	        self.builder.get_object("exOffsABx").set_range(-999999.999,999999.999)
	        self.builder.get_object("exOffsABy").set_range(-999999.999,999999.999)
	        self.builder.get_object("exOffsABz").set_range(-999999.999,999999.999)
	        self.builder.get_object("exOffsCDx").set_range(-999999.999,999999.999)
	        self.builder.get_object("exOffsCDy").set_range(-999999.999,999999.999)
	        self.builder.get_object("exOffsCDz").set_range(-999999.999,999999.999)
		gobject.timeout_add(500,self.periodic_check)
#		gobject.timeout_add(1000,self.debug_check)
		self.s = linuxcnc.stat()
		self.c = linuxcnc.command()
		self.holding_btn_ab = False
		self.holding_btn_cd = False
		self.queue = []
		self.currProg = []
		self.ab_state = 0
		self.cd_state = 0
		self.tick_ab = 0
		self.tick_cd = 0
コード例 #20
0
    def __init__(self, halcomp, builder, useropts):
        inipath = os.environ["INI_FILE_NAME"]
        self.inifile = ini(inipath)
        if not self.inifile:
            print(
                "**** auto_tool_measurement GETINIINFO **** \n Error, no INI File given !!"
            )
            sys.exit()
        self.command = linuxcnc.command()
        self.stat = linuxcnc.stat()
        self.builder = builder
        self.widgets = Widgets(self.builder)
        # set the title of the window
        self.frm_probe_pos = self.builder.get_object("frm_probe_pos")
        self.frm_probe_vel = self.builder.get_object("frm_probe_vel")
        self.frm_block = self.builder.get_object("frm_block")
        self.frm_offsets = self.builder.get_object("frm_offsets")
        self.frm_misc = self.builder.get_object("frm_misc")
        self.spbtn_search_vel = self.builder.get_object("spbtn_search_vel")
        self.spbtn_probe_vel = self.builder.get_object("spbtn_probe_vel")
        self.spbtn_probe_height = self.builder.get_object("spbtn_probe_height")
        self.chk_use_tool_measurement = self.builder.get_object(
            "chk_use_tool_measurement")
        self.lbl_x_probe = self.builder.get_object("lbl_x_probe")
        self.lbl_y_probe = self.builder.get_object("lbl_y_probe")
        self.lbl_z_probe = self.builder.get_object("lbl_z_probe")
        self.lbl_maxprobe = self.builder.get_object("lbl_maxprobe")
        self.spbtn_block_height = self.builder.get_object("spbtn_block_height")
        self.btn_probe_tool_setter = self.builder.get_object(
            "btn_probe_tool_setter")
        self.btn_probe_workpiece = self.builder.get_object(
            "btn_probe_workpiece")
        self.btn_set_x = self.builder.get_object("btn_set_x")
        self.btn_set_y = self.builder.get_object("btn_set_y")
        self.btn_set_z = self.builder.get_object("btn_set_z")
        self.spbtn_touch_off_x = self.builder.get_object("spbtn_touch_off_x")
        self.spbtn_touch_off_y = self.builder.get_object("spbtn_touch_off_y")
        self.spbtn_touch_off_z = self.builder.get_object("spbtn_touch_off_z")
        self.spbtn_tool_number = self.builder.get_object("spbtn_tool_number")
        self.btn_manual_change = self.builder.get_object("btn_manual_change")
        self.tooledit1 = self.builder.get_object("tooledit1")
        self.messg = " "

        self.prefs = preferences(self.get_preference_file_path())
        self.halcomp = hal.component("auto_tool_measurement")
        self.change_text = builder.get_object("change-text")
        self.halcomp.newpin("number", hal.HAL_FLOAT, hal.HAL_IN)
        # make the pins for tool measurement
        self.halcomp.newpin("probeheight", hal.HAL_FLOAT, hal.HAL_OUT)
        self.halcomp.newpin("blockheight", hal.HAL_FLOAT, hal.HAL_OUT)
        self.halcomp.newpin("toolmeasurement", hal.HAL_BIT, hal.HAL_OUT)
        self.halcomp.newpin("searchvel", hal.HAL_FLOAT, hal.HAL_OUT)
        self.halcomp.newpin("probevel", hal.HAL_FLOAT, hal.HAL_OUT)
        # for manual tool change dialog
        self.halcomp.newpin("toolchange-number", hal.HAL_S32, hal.HAL_IN)
        self.halcomp.newpin("toolchange-changed", hal.HAL_BIT, hal.HAL_OUT)
        pin = self.halcomp.newpin('toolchange-change', hal.HAL_BIT, hal.HAL_IN)
        hal_glib.GPin(pin).connect('value_changed', self.on_tool_change)
        self.halcomp['toolchange-number'] = self.stat.tool_in_spindle
        # tool measurement probe settings
        xpos, ypos, zpos, maxprobe = self.get_tool_sensor_data()
        if not xpos or not ypos or not zpos or not maxprobe:
            self.chk_use_tool_measurement.set_active(False)
            self.chk_use_tool_measurement.set_sensitive(False)
            print(_("**** auto_tool_measurement INFO ****"))
            print(_("**** no valid probe config in INI File ****"))
            print(_("**** disabled tool measurement ****"))
        else:
            self.spbtn_probe_height.set_value(
                self.prefs.getpref("probeheight", -1.0, float))
            self.spbtn_block_height.set_value(
                self.prefs.getpref("blockheight", -1.0, float))
            self.spbtn_search_vel.set_value(
                self.prefs.getpref("searchvel", 75.0, float))
            self.spbtn_probe_vel.set_value(
                self.prefs.getpref("probevel", 10.0, float))

            self.spbtn_touch_off_x.set_value(
                self.prefs.getpref("touch_off_x", 0, float))
            self.spbtn_touch_off_y.set_value(
                self.prefs.getpref("touch_off_y", 0, float))
            self.spbtn_touch_off_z.set_value(
                self.prefs.getpref("touch_off_z", 0, float))

            self.lbl_x_probe.set_label(str(xpos))
            self.lbl_y_probe.set_label(str(ypos))
            self.lbl_z_probe.set_label(str(zpos))
            self.lbl_maxprobe.set_label(str(maxprobe))
            self.chk_use_tool_measurement.set_active(
                self.prefs.getpref("use_toolmeasurement", False, bool))
            # to set the hal pin with correct values we emit a toogled
            #            self.chk_use_tool_measurement.emit( "toggled" )
            if self.chk_use_tool_measurement.get_active():
                self.frm_probe_pos.set_sensitive(True)
                self.frm_probe_vel.set_sensitive(True)
                self.frm_block.set_sensitive(True)
                self.frm_offsets.set_sensitive(True)
                self.frm_misc.set_sensitive(True)
                self.halcomp["toolmeasurement"] = True
                self.halcomp["searchvel"] = self.spbtn_search_vel.get_value()
                self.halcomp["probevel"] = self.spbtn_probe_vel.get_value()
                self.halcomp[
                    "probeheight"] = self.spbtn_probe_height.get_value()
                self.halcomp[
                    "blockheight"] = self.spbtn_block_height.get_value()
            else:
                self.frm_probe_pos.set_sensitive(False)
                self.frm_probe_vel.set_sensitive(False)
                self.frm_block.set_sensitive(False)
                self.frm_offsets.set_sensitive(False)
                self.frm_misc.set_sensitive(False)
コード例 #21
0
ファイル: plasma.py プロジェクト: trigrass2/linuxcnc-rtnet
    def __init__(self,halcomp,builder,useropts):
        self.builder = builder
        self.halcomp = halcomp
        self.defaults = { IniFile.vars : { "thcspeedval"       : 15.0 ,
                                           "thcspeedmax"       : 20.0 ,
                                           "thcspeedmin"       : 1.0  ,
                                           "thcspeedincr"      : 1.0  ,

                                           "cutgapval"         : 4.0  ,
                                           "cutgapmax"         : 10.0 ,
                                           "cutgapmin"         : 0.1  ,
                                           "cutgapincr"        : 0.1  ,

                                           "g0gapval"          : 45.0 ,
                                           "g0gapmax"          : 55.0 ,
                                           "g0gapmin"          : 0.5  ,
                                           "g0gapincr"         : 0.5  ,

                                           "pierceutostart"    : True ,

                                           "piercegapval"      : 5.0  ,
                                           "piercegapmax"      : 12.0 ,
                                           "piercegapmin"      : 2.0  ,
                                           "piercegapincr"     : 0.5  ,

                                           "piercedelayval"    : 0.5  ,
                                           "piercedelaymax"    : 10.0 ,
                                           "piercedelaymin"    : 0.01 ,
                                           "piercedelayincr"   : 0.01 ,

                                           "enableheightlock"  : False,

                                           "chlthresholdval"   : 60.0 ,
                                           "chlthresholdmax"   : 100.0,
                                           "chlthresholdmin"   : 10.0 ,
                                           "chlthresholdincr"  : 10.0 ,

                                           "thctargetvoltval"  : 100.0,
                                           "thctargetvoltmax"  : 255.0,
                                           "thctargetvoltmin"  : 55.0 ,
                                           "thctargetvoltincr" : 5.0  ,
                                         },
                          IniFile.widgets: widget_defaults(select_widgets([self.builder.get_object("hal-btn-THC"),
                                                                          ], hal_only=True, output_only = True)),
                        }

        self.ini_filename = __name__ + ".var"
        self.ini = IniFile(self.ini_filename,self.defaults,self.builder)
        self.ini.restore_state(self)

        # lets make our pins
        self.THC_speed = hal_glib.GPin(halcomp.newpin("THC-Speed", hal.HAL_FLOAT, hal.HAL_OUT))
        self.cut_gap = hal_glib.GPin(halcomp.newpin("Cut-Gap", hal.HAL_FLOAT, hal.HAL_OUT))
        self.g0_gap = hal_glib.GPin(halcomp.newpin("G0-Gap", hal.HAL_FLOAT, hal.HAL_OUT))
        self.pierce_deley = hal_glib.GPin(halcomp.newpin("Pierce-Delay", hal.HAL_FLOAT, hal.HAL_OUT))
        self.pierce_gap = hal_glib.GPin(halcomp.newpin("Pierce-Gap", hal.HAL_FLOAT, hal.HAL_OUT))
        self.target_voltage = hal_glib.GPin(halcomp.newpin("Target-Voltage", hal.HAL_FLOAT, hal.HAL_OUT))

        # get all widgets and connect them
        self.lbl_prog_volt = self.builder.get_object("lbl_prog_volt")
        self.lbl_cut_speed = self.builder.get_object("lbl_cut_speed")
        self.lbl_cut_gap = self.builder.get_object("lbl_cut_gap")
        self.lbl_g0_gap = self.builder.get_object("lbl_g0_gap")
        self.lbl_pierce_gap = self.builder.get_object("lbl_pierce_gap")
        self.lbl_pierce_delay = self.builder.get_object("lbl_pierce_delay")

        self.btn_THC_speed_minus = self.builder.get_object("btn_THC_speed_minus")
        self.btn_THC_speed_minus.connect("pressed", self.on_btn_THC_speed_pressed, -1)

        self.btn_THC_speed_plus = self.builder.get_object("btn_THC_speed_plus")
        self.btn_THC_speed_plus.connect("pressed", self.on_btn_THC_speed_pressed, 1)

        self.adj_THC_speed = self.builder.get_object("adj_THC_speed")
        self.adj_THC_speed.connect("value_changed", self.on_adj_THC_speed_value_changed)

        self.adj_THC_speed.upper = self.thcspeedmax
        self.adj_THC_speed.lower = self.thcspeedmin
        self.adj_THC_speed.set_value(self.thcspeedval)

        self.tbl_cutting = self.builder.get_object("tbl_cutting")
        self.tbl_cutting.connect("destroy", self._on_destroy)

        self.btn_cut_gap_minus = self.builder.get_object("btn_cut_gap_minus")
        self.btn_cut_gap_minus.connect("pressed", self.on_btn_cut_gap_pressed, -1)

        self.btn_cut_gap_plus = self.builder.get_object("btn_cut_gap_plus")
        self.btn_cut_gap_plus.connect("pressed", self.on_btn_cut_gap_pressed, 1)

        self.adj_cut_gap = self.builder.get_object("adj_cut_gap")
        self.adj_cut_gap.connect("value_changed", self.on_adj_cut_gap_value_changed)
        self.adj_cut_gap.upper = self.cutgapmax
        self.adj_cut_gap.lower = self.cutgapmin
        self.adj_cut_gap.set_value(self.cutgapval)

        self.btn_g0_minus = self.builder.get_object("btn_g0_minus")
        self.btn_g0_minus.connect("pressed", self.on_btn_g0_pressed, -1)

        self.btn_g0_plus = self.builder.get_object("btn_g0_plus")
        self.btn_g0_plus.connect("pressed", self.on_btn_g0_pressed, 1)

        self.adj_G0_gap = self.builder.get_object("adj_G0_gap")
        self.adj_G0_gap.connect("value_changed", self.on_adj_G0_gap_value_changed)
        self.adj_G0_gap.upper = self.g0gapmax
        self.adj_G0_gap.lower = self.g0gapmin
        self.adj_G0_gap.set_value(self.g0gapval)

        self.Piercing_autostart = self.builder.get_object("Piercing-autostart")
        self.Piercing_autostart.connect("toggled", self.on_Piercing_autostart_toggled)
        self.Piercing_autostart.set_active(self.pierceutostart)

        self.btn_pierce_gap_minus = self.builder.get_object("btn_pierce_gap_minus")
        self.btn_pierce_gap_minus.connect("pressed", self.on_btn_pierce_gap_pressed, -1)

        self.btn_pierce_gap_plus = self.builder.get_object("btn_pierce_gap_plus")
        self.btn_pierce_gap_plus.connect("pressed", self.on_btn_pierce_gap_pressed, 1)

        self.adj_pierce_gap = self.builder.get_object("adj_pierce_gap")
        self.adj_pierce_gap.connect("value_changed", self.on_adj_pierce_gap_value_changed)
        self.adj_pierce_gap.upper = self.piercegapmax
        self.adj_pierce_gap.lower = self.piercegapmin
        self.adj_pierce_gap.set_value(self.piercegapval)

        self.btn_pierce_delay_minus = self.builder.get_object("btn_pierce_delay_minus")
        self.btn_pierce_delay_minus.connect("pressed", self.on_btn_pierce_delay_pressed, -1)

        self.btn_pierce_delay_plus = self.builder.get_object("btn_pierce_delay_plus")
        self.btn_pierce_delay_plus.connect("pressed", self.on_btn_pierce_delay_pressed, 1)

        self.adj_pierce_delay = self.builder.get_object("adj_pierce_delay")
        self.adj_pierce_delay.connect("value_changed", self.on_adj_pierce_delay_value_changed)
        self.adj_pierce_delay.upper = self.piercedelaymax
        self.adj_pierce_delay.lower = self.piercedelaymin
        self.adj_pierce_delay.set_value(self.piercedelayval)

        self.enable_HeightLock = self.builder.get_object("enable-HeightLock")
        self.enable_HeightLock.connect("toggled", self.on_enable_HeightLock_toggled)
        self.enable_HeightLock.set_active(self.enableheightlock)

        self.adj_CHL_threshold = self.builder.get_object("adj_CHL_threshold")
        self.adj_CHL_threshold.connect("value_changed", self.on_adj_CHL_threshold_value_changed)
        self.adj_CHL_threshold.upper = self.chlthresholdmax
        self.adj_CHL_threshold.lower = self.chlthresholdmin
        self.adj_CHL_threshold.set_value(self.chlthresholdval)

        self.btn_THC_target_minus = self.builder.get_object("btn_THC_target_minus")
        self.btn_THC_target_minus.connect("pressed", self.on_btn_THC_target_pressed, -1)

        self.btn_THC_target_plus = self.builder.get_object("btn_THC_target_plus")
        self.btn_THC_target_plus.connect("pressed", self.on_btn_THC_target_pressed, 1)

        self.adj_THC_Voltage = self.builder.get_object("adj_THC_Voltage")
        self.adj_THC_Voltage.connect("value_changed", self.on_adj_THC_Voltage_value_changed)
        self.adj_THC_Voltage.upper = self.thctargetvoltmax
        self.adj_THC_Voltage.lower = self.thctargetvoltmin
        self.adj_THC_Voltage.set_value(self.thctargetvoltval)
コード例 #22
0
 def __init__(self, halcomp,builder,useropts):
     self.halcomp = halcomp
     self.builder = builder
     self.i = linuxcnc.ini(os.environ['INI_FILE_NAME'])
     self.prefFile = self.i.find('EMC', 'MACHINE') + '.pref'
     self.set_theme()
     self.statePin = hal_glib.GPin(halcomp.newpin('state', hal.HAL_S32, hal.HAL_IN))
     self.statePin.connect('value-changed', self.state_changed)
     self.pierceCount = hal_glib.GPin(halcomp.newpin('pierce-count', hal.HAL_S32, hal.HAL_IN))
     self.pierceCount.connect('value-changed', self.pierce_count_changed)
     self.rapidTime = hal_glib.GPin(halcomp.newpin('motion-type', hal.HAL_S32, hal.HAL_IN))
     self.rapidTime.connect('value-changed', self.motion_type_changed)
     self.pierceReset = self.builder.get_object('pierce-count-reset')
     self.pierceReset.connect('pressed', self.pierce_reset)
     self.cutDistanceReset = self.builder.get_object('cut-distance-reset')
     self.cutDistanceReset.connect('pressed', self.cut_distance_reset)
     self.cutTimeReset = self.builder.get_object('cut-time-reset')
     self.cutTimeReset.connect('pressed', self.cut_time_reset)
     self.rapidTimeReset = self.builder.get_object('rapid-time-reset')
     self.rapidTimeReset.connect('pressed', self.rapid_time_reset)
     self.probeTimeReset = self.builder.get_object('probe-time-reset')
     self.probeTimeReset.connect('pressed', self.probe_time_reset)
     self.allReset = self.builder.get_object('all-reset')
     self.allReset.connect('pressed', self.all_reset)
     # plasmac states
     self.IDLE          =  0
     self.PROBE_HEIGHT  =  1
     self.PROBE_DOWN    =  2
     self.PROBE_UP      =  3
     self.ZERO_HEIGHT   =  4
     self.PIERCE_HEIGHT =  5
     self.TORCH_ON      =  6
     self.ARC_OK        =  7
     self.PIERCE_DELAY  =  8
     self.PUDDLE_JUMP   =  9
     self.CUT_HEGHT     = 10
     self.CUTTING       = 11
     self.SAFE_HEIGHT   = 12
     self.MAX_HEIGHT    = 13
     self.FINISH        = 14
     self.TORCH_PULSE   = 15
     self.PAUSED_MOTION = 16
     self.OHMIC_TEST    = 17
     self.PROBE_TEST    = 18
     self.oldState =  0
     self.oldMotionType =  0
     self.defaults = {IniFile.vars:{"PIERCE_COUNT" : 0,
                                    "CUT_TIME"     : 0.0,
                                    "CUT_DISTANCE" : 0.0,
                                    "RAPID_TIME"   : 0.0,
                                    "PROBE_TIME"   : 0.0,
                                   },
                     }
     get_ini_info = getiniinfo.GetIniInfo()
     self.ini_filename = __name__ + ".var"
     self.ini = IniFile(self.ini_filename, self.defaults, self.builder)
     self.ini.restore_state(self)
     self.builder.get_object('pierce-count').set_label('%d' %(self.PIERCE_COUNT))
     if hal.get_value('halui.machine.units-per-mm') == 1:
         self.builder.get_object('cut-distance').set_label('%0.2f M' %(self.CUT_DISTANCE * 0.001))
     else:
         self.builder.get_object('cut-distance').set_label('%0.2f\"' %(self.CUT_DISTANCE))
     self.display_time('cut-time', self.CUT_TIME)
     self.display_time('rapid-time', self.RAPID_TIME)
     self.display_time('probe-time', self.PROBE_TIME)