[ create a new paste ] login | about

Link: http://codepad.org/2Gfxoi7y    [ raw code | fork ]

Plain Text, pasted on Aug 20:
    def ok_for_mdi():
        print >>sys.stderr, "in ok_for_mdi"
        while True:
            time.sleep(10) # sleep for 10 seconds
            s.poll()
            print >>sys.stderr, "in the while loop"
            print >>sys.stderr, "axis mask %d" % (s.axis_mask)
            isHomed=True
            for i,h in enumerate(s.homed):
                print >>sys.stderr, "home status: i = %s : h = %s" % (i,h)
                if s.axis_mask & (1<<i):
                    isHomed=isHomed and h
                print >>sys.stderr, "isHomed = %s " % isHomed
            if isHomed:
                break
        print >>sys.stderr, "after s.poll"
        return not s.estop and s.enabled and s.homed and (s.interp_state == linuxcnc.INTERP_IDLE)

    def home_all_axes(event=None):
        if not manual_ok(): return
        ensure_mode(linuxcnc.MODE_MANUAL)
        isHomed=True
        for i,h in enumerate(s.homed):
            if s.axis_mask & (1<<i):
                isHomed=isHomed and h
        doHoming=True
        if isHomed:
            doHoming=prompt_areyousure(_("Warning"),_("Axis is already homed, are you sure you want to re-home?"))
        if doHoming:
            c.home(-1)
            time.sleep(10) # sleep for 10 seconds
            print >>sys.stderr, "After sleep"
            if commands.ok_for_mdi():
                print >>sys.stderr, "Ok for MDI"
                c.wait_complete()
                # clear G55 offset
                commands.clear_offset(num="2")

    def unhome_all_axes(event=None):


Create a new paste based on this one


Comments: