RobotStudio event

How to measure the Motion Time inVB/ API?

Hi, I got a question. How we can measure Motion Time or Cycle Time in RobotStudio API? I tried to use "events" of "simulation" to measure the time at start of stop of simualtion. but I couldn't use these events (how should these events be written in VB/API?) and I wonder if you know...

Best regards

/Behnam

Comments

  • Something like this should solve it...

    The way to get events in VBA is to declare an object "WithEvents", then you will find these events (procedures) in the drop-down list above the code window. In the code below we have declared sim WithEvets, thereafter we select the "Stop" procedure and added the code needed. Before you start the simulation, run the Init method from "ToolMacroMacros..." and browse to your Init method. After the simulation stops the motion time will be logged in a new log called "MotionTime"

    Dim WithEvents sim As Simulation
    Dim ctrl As ABBS4Controller

    Sub Init()
        Set sim = ActiveStation.Simulations(1)
        Set ctrl = ActiveStation.ActiveMechanism.Controller
    End Sub

    Private Sub sim_Stop()
           Call ActiveStation.PrintLog("MotionTime", ctrl.MotionTime)
    End Sub

     

    magu