Prev  Next

Motion Path

  • Tour 1
    - Drag Drop


  • Tour 2
    - Control Logic


  • Tour 3
    - Custom UI


  • Tour 4
    - Reporting


  • Tour 5
    - Hardware


  • Tour 6
    - Scripting


  • Tour 7
    - Motion Paths


  • This is a another way to create program.
    (Programs, Scripts are others)

    A row in a spreadsheet creates a set of tags / parameters.

    These can are run by a sequence/script controlled by the MCPath tool/



    A spread sheet can reflect any parameters data

    Examples include name, location data, part program (sequences) to run geometries etc

    Preference define when to start running and where to end (or number or rows) Alternatively via the user interface run the selected row(s) or next previous

    Sample

    The following is a script located in a sequence that is call the the MCPath program with data per row of the spreadsheet
    
    Path = ::MCPath
    EventLog = ::IPWindowCollection#1.EventsView
    EventSrc = Print "Task"
    
    x =  Path.X
    Y = Path.Y
    Z = Path.Z
    Speed = Path.Speed
    Command = Path.Command
    Name = Path.Name
    
    
    IsMove = [GCStringFind] Command, "Move"::FindLocation
    
    if(IsMove > 0)
    {
    
        Param = ::MachineCmdLocation
    
        Locals = [ParametersCreatable]
        [PARAMSetWrite] OutputParameters = Locals, \
                X = X, \
                Y = Y, \
                Z = Z, \
                Speed = Speed
    
        Tasks = ::GCTaskStack
        Prg = ::Programs.mcMoveCmd
    
        Title = print "Move:" Name
    
        [GCTaskStackStep] TaskStack = Tasks, \
            Program = Prg, \
            SrcParameters = Locals, \
            DestParameters = Param, \
            Name = Title
    
    
        Title = print "Wait:" Name
        Prg = ::Programs.mcMoveWait
        [GCTaskStackStep] TaskStack = Tasks, \
            Program = Prg, \
            Name = Title
    
    
    
    
    
        DEL Param
        DEL  mcController
    }
    
    
    if(Command == "TaskClear")
    {
    
        Prg = ::Programs.TASKSClear
        [GCExeStep] Step = Prg
    
        IsMove = 1  // no stck task
    }
    
    
    
    if(IsMove  <= 0)
    {
    
        [EventLogStep] Eventlog = EventLog, \
            Severity = 4,  Source = EventSrc,  Description = Command
    
    
        Locals = [ParametersCreatable]
    
        [PARAMSetWrite] OutputParameters = Locals, \
                    Command = Command, \
                    SubCommand = x
    
        Tasks = ::GCTaskStack
        Prg = ::Programs.mcPathTask
        [GCTaskStackStep] TaskStack = Tasks, \
                Program = Prg, \
                Name = Command, \
                SrcParameters = Locals
    
    
    
    
    
    }
    
    
    The following defines a generic script in a sequence...
    
    EventSrc = Print "Task"
    EventLog = ::IPWindowCollection#1.EventsView
    
    //[EventLogStep] Eventlog = EventLog, \
     //   Severity = 0,  Source = EventSrc,  Description = Command
    
    
    
    if(Command == "IOon")
    {
    
        print "Turn On " SubCommand
        IOs  = ::DigitalIOCollection
        IO = [GCCollectionItem] Collection = IOs, IndexOrName = SubCommand::Item
        IOValid = [GCCollectionItem] Collection = IOs, IndexOrName = SubCommand::ItemIndex
    
    
        if(IOValid > 0)
        {
                 [DigitalSetStep] IO = IO, State = 1
        }
    
    }
    
    if(Command == "IOoff")
    {
    
        print "Turn Off " SubCommand
        IOs  = ::DigitalIOCollection
        IO = [GCCollectionItem] Collection = IOs, IndexOrName = SubCommand::Item
        IOValid = [GCCollectionItem] Collection = IOs, IndexOrName = SubCommand::ItemIndex
    
    
        if(IOValid > 0)
        {
                 [DigitalSetStep] IO = IO, State = 0
        }
    
    }
    
    
    if(Command == "IOWaitOff")
    {
    
        print Command + " " SubCommand
        IOs  = ::DigitalIOCollection
        IO = [GCCollectionItem] Collection = IOs, IndexOrName = SubCommand::Item
        IOValid = [GCCollectionItem] Collection = IOs, IndexOrName = SubCommand::ItemIndex
    
    
        if(IOValid > 0)
        {
                 [DigitalWaitStep] IO = IO, WaitFor = 0, TimeOut = 60000
        }
    
    }
    
    
    if(Command == "Run")
    {
    
        print "Run " SubCommand
        Prgs  = ::Programs
        Prg = [GCCollectionItem] Collection = Prgs, IndexOrName = SubCommand::Item
        PrgValid = [GCCollectionItem] Collection = Prgs, IndexOrName = SubCommand::ItemIndex
    
    
        if(PrgValid > 0)
        {
    
            [GCExeStep] Step = Prg
        }
    
    }