UC100 wrapper

If you have a question about the software please ask it here.

UC100 wrapper

Postby valhallaCNC » Fri Feb 17, 2023 12:32 pm

I can get the UC100.function to work . I can't get the status structure members(ex Idle). What is the format for getting Idle in c# ? It is supposed to be true when motion controller is idle. Any pointers would be great. Thanks
valhallaCNC
 
Posts: 81
Joined: Wed Jun 30, 2021 8:04 pm

Re: UC100 wrapper

Postby cncdrive » Sat Feb 18, 2023 6:29 am

You can query the status structure with the Getstatus function and then check the idle struct member boolean value if it is true or false.
cncdrive
Site Admin
 
Posts: 4887
Joined: Tue Aug 12, 2014 11:17 pm

Re: UC100 wrapper

Postby valhallaCNC » Sun Feb 19, 2023 2:23 am

Even with that tip.....I'm having a real mental block with this...Are there any C# people that can make this work ? As you can tell I'm not a C# programming whiz. Thanks in advance Joe
valhallaCNC
 
Posts: 81
Joined: Wed Jun 30, 2021 8:04 pm

Re: UC100 wrapper

Postby cncdrive » Sun Feb 19, 2023 9:42 pm

Code: Select all
UC100.Stat UCstat = new UC100.Stat();
UC100.GetStatus(ref UCstat);
if (UCstat.Idle)
{
//Do something
}
else
{
//Do something else
}
cncdrive
Site Admin
 
Posts: 4887
Joined: Tue Aug 12, 2014 11:17 pm

Re: UC100 wrapper

Postby valhallaCNC » Mon Feb 20, 2023 12:03 pm

Thanks .. I was trying to use a pointer, as per one of your older posts in 2017. " int GetStatus(Stat * _Stat) " . There is not much info on any of this.
valhallaCNC
 
Posts: 81
Joined: Wed Jun 30, 2021 8:04 pm

Re: UC100 wrapper

Postby cncdrive » Mon Feb 20, 2023 2:58 pm

Yes, it is pointer, but in C# there is no such thing as the classical pointers in C++.
The motion control API is in C++ and this function has a pointer parameter, but in C# this is written with the ref keyword, because this works like that in C#.

You can look into the UCCNC/API folder for the C# wrapper it has all the API function prototypes, so you can see all return values, function names and parameters so then you see the syntaxes.
cncdrive
Site Admin
 
Posts: 4887
Joined: Tue Aug 12, 2014 11:17 pm

Re: UC100 wrapper

Postby valhallaCNC » Tue Feb 21, 2023 12:53 pm

Thanks again very helpful information. Along this same line, all the Stat structure function that I have tested work fine. The exception being Softlimit, It never changes state. Is this related to the soflimit LED 268 issue, I have seen posted. I did post a bug report on its behavior with a MPG also. Thanks
valhallaCNC
 
Posts: 81
Joined: Wed Jun 30, 2021 8:04 pm

Re: UC100 wrapper

Postby cncdrive » Wed Feb 22, 2023 12:17 am

Softlimit should wrok fine, but you should setup the softlimits and enable it first to make it work.
cncdrive
Site Admin
 
Posts: 4887
Joined: Tue Aug 12, 2014 11:17 pm


Return to Ask a question from support here

Who is online

Users browsing this forum: Bing [Bot] and 19 guests