Thank you! I went with your approach as it's nicer and cleaner.
And how would you get the length of a 2-D char array? Or in general, how would you write to a 2-D char array?
Thank you! I went with your approach as it's nicer and cleaner.
And how would you get the length of a 2-D char array? Or in general, how would you write to a 2-D char array?
Oh, very clean and intuitive as an approach. Thank you!
However, I tried it and looks like WorkVisual doesn't like it.
EDIT: . It works perfectly inside of a function but I however would like to declare it in $config.dat
Cheers,
Zaid
SkyeFire,
Thank you for your answer.
If I understood you correctly, everytime we've gone over the array limit, we catch and simply continue the program?
So there's no actual straight forward as strlen to get the length of a 3-D array?
I unfortunately don't have my laptop close by to check the msglib.
Panic mode,
Thank you for your answer.
I actually don't see how would it be feasible to use a structure, could you please elaborate more?
Cheers,
Zaid
Hello,
I'm currently trying to set-up a catalog of errors using 3-D arrays.
The idea is to define bunch of errors on different levels (by levels - I mean Warning, info, errors). Here's an example:
DECL CHAR C_msg[3,80,80] ; where plane 1: info/ plane 2: Warning / plane 3: errors
C_msg[1,1,]="(I01) Gripper Changed to "
C_msg[2,1,]="(A01) Could not change GRIPPER. Please put back the previous gripper "
C_msg[3,1,]="(E01) Error returned by the gripper - See device"
The idea behind defining all the errors in one 3-D array is to keep the code nice and clean rather than defining bunch of 1-D array for each level of errors (at least, to my liking).
I'm after that trying to build strings by adding values at for example the end of sentence and therefore display them using msgNotify().
I first tried to simply write to C_msg[1,1,] using SWRITE command then display the string using msgNotify but an error is returned.
Then I thought about copying the 2-D char array to a 1-D char array using a for loop to finally display the 1-D array using msgNotify():
DEF copyString(C_array1[]:OUT, C_array2[,,]:IN, I_index1:IN, I_index2:IN)
DECL CHAR C_array1[], C_array2[,,]
DECL INT I_index1, I_index2, I_lenArray2, it
I_lenArray2 = STRLEN(C_array2[I_index1,I_index2,])
FOR it = 1 to I_lenArray2
C_array1[it] = C_array2[I_index1,I_index2,it]
msgNotify(C_array1[], "Test")
ENDFOR
END
When I set manually the for loop maximum value to be exactly the length of the string, it works all fine but if the value is one value above the exact length, an error is returned.
So I tried STRLEN but it doesn't look like to be working with 2-D arrays. Any ideas (or maybe a better way to solve the problem)?
Cheers,
Zaid
Panic mode,
Thanks a lot for your answer!
Have a nice day/evening.
Well, why don't you use Swrite to create a complete string you want displayed and use that as a parameter for any of the MsgLib functions? If you are this new to programing in general, I suggest first learning some C or Pascal (or some other simple language with strong typing) to understand some basics. KRL is bad as a first programing language
Mentat,
Thanks for your answer. I'm actually not a beginner in the programming world. I've used multiple languages including C professionally.
I've used KRL for some time already but I still haven't find out the best way to display notifications messages in KRL. In fact, I've thought already about creating a complete string and display it but thought that it was a really weird way to do stuff. If there's any other way, I'd be glad to get to know it!
Anyway, thank you for your answers guys. Have a nice evening/day!
Hello,
I'm trying to display a notify message with two parameters (for instance - string and an int)
To at the end display something like:
I tried to use the "msglib" library but no success. Is there anything I'm missing?
Thank you panic mode and massula for your answers!
Have a nice day
Hello,
Excuse my newbie question. I have been looking for an answer everywhere but no success.
What I'm trying to achieve:
I would like to create multiple routines (startWelding, stopWelding etc) and use them globally in any file.I would like to, if possible, have all these routines in one single file
My questions:
Looking forward for your answers.
Zaid
Hello,
I have a Kuka KR 60-3 and a welding machine (Citowave III) that can be connected through EtherNetIP protocol.
I've been trying to connect the two devices together but so far, no success.
Here are the details:
KSS 8.5.7 HF1
Robot: 192.168.133.9
Welding machine: 192.168.133.50
I've also added a generic device where I'm setting the EDS and IP address of the welding machine as well as IO mapping
My questions:
Thanks.