RobotStudio event

Set ActiveWobj in VB.net

Thanks to per svenson for greate help with CRobt() in vb.net but how do i set activeWobj to Wobj0 or another in VB.net
Best Regards

Klaus Soenderhegn
www.cadalysator.dk

Comments

  • Hi Klaus
    Here is a simple example where the name of the workobject is "myWobj"


    Public Sub Macro_SetWobjAsActive()
    Dim stn As Station = Project.ActiveProject
    If stn Is Nothing Then Exit Sub
    Dim dds As RsWorkObject = stn.ActiveTask.DataDeclarations("myWobj")
    stn.ActiveTask.ActiveWorkObject = dds
    End Sub

    There is also a method FindDataDeclarationsByType so that you can find for example all RsWorkObject by this doesn't seam to work in VSTA (works if you write an addin in VisulaStudio) have to do some communication with ABB about this image

    Per Svensson
    Robotics and Vision Specialist
    Consat Engineering
  • And for C# programmers as myself

    public void Macro_SetWobjAsActive()
    {
    Station stn = Project.ActiveProject as Station;
    if (stn == null) return;
    RsWorkObject wobj = (RsWorkObject)stn.ActiveTask.DataDeclarations["myWobj"];
    stn.ActiveTask.ActiveWorkObject = wobj;
    }
    Per Svensson
    Robotics and Vision Specialist
    Consat Engineering