Problem using rapid domain.

Hi I’m trying to get a list of all the tasks on the controller, after getting the tasks I want to get all the modules in 1 of those tasks. After that I want all the routines in 1 of those modules. Finally I want to get a list of all the rapid data in 1 of those routines so I can alter them.

Problem is that I can get a list of tasks (though I can only get one task T_ROB1) but when I try to get the modules out of this task using the c# code:

Module modules;

modules = c.Rapid.GetTask(“T_ROB1”).GetModules();//this is the part of the code that gets the error. (I tested it by putting it in a try catch blok)

I get a error msg. I’m sure that there are modules available on the controller cause I can see them using the file browser.

Has annyone else have come accross this problem and maybe knows a sollution?

P.S. I’m using RAB 5.08 on a real controller. Sorry I did not post the error msg yet. For that I have to hook up to the controller again. I’ll try and post it later today.

The error that I get is:

System.ArgumentOutOfRangeException: An error msg can not be displayed because an optional resource assembly containing it cannot be found. An error msg can not be displayed because an optional resource assembly containing it cannot be found. An error msg can not be displayed because an optional resource assembly containing it cannot be found.

at ABB.Robotics.DCL.Rapid.ModuleInfo.CreateFormUrl()

at ABB.Robotics.Controller.RapidDomain.Module.ctor()

at ABB.Robotics.Controller.RapidDomain.Rapid.SearchSymbols()

at ABB.Robotics.Controller.RapidDomain.Task.SearchRapidSymbol()

at ABB.Robotics.Controller.RapidDomain.Task.GetModules()

at TpsViewProgName.TpsViewProgName.test()

at TpsViewProgName.TpsViewProgName..ctor() //(2 times a point)

at System.Reflection.RuntimeConstructorIno.InternalInvoke()

at System.Reflection.RuntimeConstructorInfo.Invoke()

at System.activator.CreateInstance()

at System.Reflection.Assembly.CreateInstance()

at ABB.Robotics.Tps.SDK.Base.SDKViewWrapper.Install()

at ABB.Robotics.SDK.Views.TpsViewProgName.Install()

at ABB.Robotics.WinCore.TPAppFwk.Runtime.TacController.SetupIte m()

at ABB.Robotics.WinCore.TPAppFwk.Runtime.TafMaster.CreateItem()

at ABB.Robotics.WinCore.TPAppFwk.Runtime.TafMaster.CreateItem() TPAppFwk.Runtime.ITafMaster.CreateItem()

at ABB.Robotics.WinCore.TpAppFwk.SiteServices.ABB.Robotics.WinC ore.TPApp.Fwk.Base.ITafSite.LaunchTPAppControll()

at ABB.Robotics.Tps.Controls.TpsABBMenu.ListView_ItemActivate()

at ABB.Robotics.Tps.Windows.Forms.ListView.OnItemActivate()

at ABB.Robotics.Tps.Windows.Forms.ListView.OnMouseUp()

at System.Windows.Forms.Control.WnProc()

at System.Windows.Forms..ContainerControl.WnProc()

at System.Windows.Forms.Control._InternalWnProc()

at Microsoft.AGL.Forms.EVL.EnterMainLoop()

at System.Windows.Forms.Application.Run()

at ABB.Robotics.WinCore.TPAppFwk.MainFrame.Start()

at ABB.Robotics.WinCore.TPAppFwk.TafApp.Start()

at ABB.Robotics.WinCore.TPAppFwk.TafApp.Main()

Hopefully someone here can tell me what I’m doing wrong. It seems that the “GetModules()” is not working for me. Neither does “GetModule(“modName”)” .

annyway thnx in advance for your efforts.

Kindest regards,

Martijn

The GetModules call is supposed to fail with GeneralException, ArgumentOutOfRange exception means something behind the scenes is failing.

At any rate, this works:

Dim rt As RapidDomain.Task

Dim RMods As RapidDomain.Module()

Dim RMod As RapidDomain.Module

Try

rt = ctrl.Rapid.GetTask(“T_ROB1”)

RMods = rt.GetModules

For Each RMod In RMods

Trace.Writeline("found module: " & RMod.Name)

Next

Catch ex as exception

Trace.Writeline("Exception : " & ex.ToString)

Finally

'dispose of RAB objects here

End Try

Thank you very much I’ll give it a try.'I’ll let you know if it works for me.

well it didn’t work… but that’s because of me. I gave the contoller it’s name.

Controller c = new Controller(name) where it should stay empty:

Controller c = new Controller()

My bad…

I still have some trouble updating my comboBoxes though. My first comboBox is filled with all the modules on the controller, that works. But when I select a module and then click the second comboBox it doesn’t fill with all the routines just yet. I have to click it again. What am I doing wrong?

code:

private void comboBox2_Clicked(object sender, EventArgs e)

{

this.comboBox2.Refresh();

if (this.comboBox1.Items.Count != 0)

{

if (this.comboBox2.Items.Count == 0)

{

getRoutinesInModule();//here I get the routines and put them in the comboBox2

this.comboBox2.Refresh();

}

}

}

Well let me know if annyone has got some idea’s

Thanks for the help so far,

Qrius

You might try using another ComboBox event like SelectedIndexChanged rather than a Click event to refresh the list. Also, you might need to use some of the layout/redraw control mthods like SuspendLayout/ ResumeLayout and Invalidate to make sure that things are updated properly.

Thanks I’ll give it a try.

K that works like a charm. thnx RussD!

But I wouldn’t be me if I didn’t have a nother problem :wink:

I now have the RapidData name, but I nead the RapidData value, however everytime I try to get the value like this:

rd.Value; or rd.Value.ToString(); I get an error msg with a code that is not refering to a text. The code is: 0xc004ffff

Can’t seem to find anny info on this error in the guides so maybe someone here does?

Or would it be wiser to start a new thread for this question?

Hopefully waiting for your reply,

Qrius

Here is a sample, the values for taskName, moduleName, and varName are set elsewhere. You should check that rd is not null after you do GetRapidData and quit if it is, otherwise you may get exceptions elsewhere

Dim rd As RapidDomain.RapidData

Dim strRetVal As String

Try

rd = ctrl.Rapid.GetRapidData(taskName, moduleName, varName)

strRetVal = rd.Value.ToString()

'do something with the value

Catch ex As Exception

'do something with exception

Finally

If Not rd Is Nothing Then

rd.Dispose()

rd = Nothing

End If

End Try

Well thanks for the reply BUT that is exactly the way I’m doing it. And still I get the error. I even tried to put rd in a IRapidData iRd before getting the value, but nothing seems to work. And I checked that rd is not null. As I said I can do rd.Name; and get the name of the RapidData, but the value still eludes me.. sadly :grinning:

I guess I’ll continue trying today, but if annyone has got some more insight into my problem… don’t be shy to let me know.

Kindest regards,

Qrius

Are you reading PERS data, I believe that is all you can read. What is the type of the RAPID data you are trying to access?

Are you sure all of the parameters for GetRAPIDData are correct?

Are you getting an exception when you try to do GetRapidData, if not where are you seeing the error?

Have you tried looking at the console output and/or stepping through the code to get a better idea what is going on?

I started a new thread (hope that’s ok) named Topic: Problem getting RapidData out of routine cause this thread was getting pretty off course. so plz answer there. For your question: No I’m using VAR data (which I think I should be able to get in this way) and the error occurs when I try to get the value of the RapidData object.

rd.Value.ToString();

However I have explainend it all a bit better in the other thread, so plz put anny answers there.

Thank you for your efforts,

Qrius