Output Problem while Developing C# script in VS

Started by mehradmahnia, April 03, 2025, 06:02:09 PM

Previous topic - Next topic

mehradmahnia

I'm currently developing a C# Component in VisualStusio that outputs KUKA|prc Command. The component shows the KUKA|prc type & icon while hovering over the output but when I connect the output wire to KUKA|prc Core component it turnes RED and says, "Data conversion failed from KUKA|prc Command to KUKA|prc Command".
What should I do to solve this problem?
I've attached two screenshots from the definition.

Extra information:

*This is the RegisterOutputParams in VS script:
protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager){
pManager.AddParameter(new GH_PRC_CommandData_param(), "KUKA|prc Command", "COMMAND", "KUKA|prc command containing LIN or CIR movements.", GH_ParamAccess.tree);}

*And this is how I scripted the CommandData for the movements:
KUKAprcCore.PRC_Classes.PRC_CommandData circ = PRC_Commands.PRC_CIRMove(KPStartPlane, KPAuxPlane, KPEndPlane, v, "C_DIS");
KUKAprcGH.PRC_IOClasses.GH_PRC_CommandData PRCCommand = new KUKAprcGH.PRC_IOClasses.GH_PRC_CommandData(circ);

Johannes @ Robots in Architecture

Hello,
Please take a look at the attached example. The KUKA|prc code is a bit special as we never intended someone else to interact directly with it, so you've been warned ;)
Best,
Johannes

mehradmahnia

Hi Johannes;
Thanks for your reply, regarding your warning, I mostly use KUKAprc for robotic milling applications, and as the milling tool paths consist of linear and circular motions most of the time, I am trying to add an extra component that converts planes into LIN and CIR motions in ONE component (based on the number of planes provided in each branch of component's input, if there is 1 plane the motion will be Linear and if there are 3 planes in the branch the motion is Circular) so the definition could be simplified a lot and redundant processing of planes could be omitted. If what I'm doing is against KUKA|prc's policy let me know.
And regarding the attached example, I connected the output to KUKA|prc's Core component and still have the issue explained above.


Johannes @ Robots in Architecture

Hello,
I only added a robot and it looks fine on my end. I don't believe that there has been any fundamental change between since the community version has been last released and the current state of the member version (relating to the three lines of code in the C# component).
Best,
Johannes

mehradmahnia

Thanks for your reply Johannes;
The problem exists with the latest gh file you've attached. I've checked the installed KUKA|prc version on my machine, its "1.0.8810.26816". Is it possible that the error occurs because I'm using the free version?

Johannes @ Robots in Architecture

Sorry, I cannot reproduce it. I just deleted my member version and installed the most recent Community Version from the package manager - it's showing up just as before. The version is the same as yours, so "1.0.8810.26816".
Maybe the issue is somewhere else. What kind of output are you getting from the script component?
Also double-check that you don't have KUKA|prc installed twice, so once in the package manager and once in the Components Library.

Best,
Johannes

mehradmahnia

#6
Thanks, Johannes, for installing Community Version on your rhino for testing the code.

The output type from script component is "KUKA|prc Command" and the weird thing is that the error message says:
"1. Data conversion failed from KUKA|prc Command to KUKA|prc Command"

I've checked the probability of having double installation of KUKA|prc ... there were two installations, one in Package Manager folder of Rhino7.0 and one in Package Manager folder of Rhino8.0 ... deleting the one in Rhino7.0 doesn't fix the problem.

I've run the script on another laptop, and it worked, the only difference between the two machines is Rhino's service release version, mine is the latest one (SR17 ... 8.17.25066.7001, 2025-03-07) while SR version of Rhino on the other machine that doesn't have problem with the script is SR11.

I must try to downgrade my Rhino and see if that fixes the problem. Weird!

Is it possible for you to tell the Service Release version of your Rhino Johannes?

mehradmahnia

The problem solved;

I've moved the KUKA|prc library to GH's Library folder and removed the folders in Rhinov8 and Rhinov7's package manger folder, and seems that it fixed the problem.