Page 1 of 1

Custom COMBOBOX

Posted: Tue Feb 05, 2019 9:47 pm
by cnc_freak
Hello Tom.
I have already install more than 10 Kmotion+Kanalog boards on plasma/oxyfuel cutting applications.
In the plasma cutting application, is needed to configure the cutting parameters, like pierce delay, cutting voltage, cutting speed,cutting height and more others. Those parameters are all depended from the cutting material, like the thickness of the sheet, the material its self, carbon steel, stainless steel,aluminum etc. Additionally every plasma source manufacture has its own cutting parameters. The bottom line of all is that there are a lot of parameters that the user has to adjust every time he want to make a cut. One approach is, that those parameters can be set in the CAM software and embedded into the gcode. This approach require a cam software that can do that. The problem is that the customer already has a cam software that can't do the job and has to buy a new one. One other approach is that all those parameters can be set via the Kmotioncnc software. Something like the tool library already embedded in the KmotionCNC. The problem with this approach is that this library,table is not customizable and cannot be used to handle the cutting parameters. So my idea is to include a combobox functionality on the screen editor that would be customizable to handle a generic text file, perhaps comma delimited and an edit button in order to edit the parameter table. So the user can choose from the drop down list the cutting appropriate parameters.
How ease or difficult is do implement something like that?

Re: Custom COMBOBOX

Posted: Wed Feb 06, 2019 8:08 pm
by Moray
I'm going to guess that during use, those parameters are stored within the KFlop?

My initial thought was a custom screen that allows you to view/edit those parameters, then have the KFlop push them out a text file, although I'm not sure if the KFlop would be able to read the values back in, plus it doesn't help you with the selecting different configurations.

What about a small standalone program, that can be executed via a screen button, then once you've made any changes, runs a C program to transfer the new values to the KFlop?
This would remove the limitations of the KFlop/KMCNC in terms of file handling, and you could store the values however you'd like.

Re: Custom COMBOBOX

Posted: Thu Feb 07, 2019 10:40 am
by cnc_freak
Very good idea. I will give it a try.
Thanks.

Re: Custom COMBOBOX

Posted: Thu Feb 07, 2019 6:34 pm
by TomKerekes
Hi cnc_freak,

It doesn't look like it would be too difficult to add some additional Combo Boxes. We will look into it.

Re: Custom COMBOBOX

Posted: Thu Feb 14, 2019 10:15 pm
by TomKerekes
Here is a patch to add Combo Box functionality. 40 ComboBox Controls have been added to the custom screen.

ComboBox.png
ComboBox.png (2.58 KiB) Viewed 9895 times

We also added basic Unicode capability for the Combo Boxes as well as Edit Controls. Non ANSI Unicode characters are sent as hex strings to KFLOP.

The patch involves several files:
KMotionCNC.exe - copy to \Release Folder
KMotionCNCScreenEditor.exe - copy to \Release Folder
KMotionCNC.rc - copy to \PC VC Examples\KMotionCNC Folder
resource.h - copy to \PC VC Examples\KMotionCNC Folder

Here an example Screen Script and KFLOP C Program that reads the Combo Box:
Combo.scr - copy to \PC VC Examples\KMotionCNC\Screens Folder
ComboBoxCopyToDROLabelwhenChangedUnicode.c - copy to \C Programs Folder

See Video:



Please let us know if it works for you.

Re: Custom COMBOBOX

Posted: Sun Oct 18, 2020 9:53 am
by cnc_freak
Hello Tom.
Finally i test this, in load the last version 435d, and it does not work as described.
I load the combo.scr to test it but the box looks like in the attached picture. Please advice.
Regards.

Re: Custom COMBOBOX

Posted: Wed Oct 21, 2020 5:06 am
by TomKerekes
Hi cnc_freak,

Here is a patch that should fix the issue in Version 4.35d.

Copy this KMotionCNC.exe to your <>\KMotion\Release folder.

Re: Custom COMBOBOX

Posted: Mon Oct 26, 2020 8:53 am
by cnc_freak
How can i do a string compare in c program, so that when i select for example "ALUMINUM' to do something.
I try to do switch(s) case(Aluminum):,case(Steel):,case(Wood): etc, but does not work, in s is the combobox string.
Is there another way to implement that?

Re: Custom COMBOBOX

Posted: Mon Oct 26, 2020 8:03 pm
by TomKerekes
Strings (actually null terminated char arrays) need to be compared character by character. Normally strcmp() can do this but it looks like we forgot to include it. A switch statement can't do this. You could use this function:

Code: Select all

#include "KMotionDef.h"
BOOL StrEq(char *a, char *b);

void main()
{
	if (StrEq("ABCD", "XYZ"))
		printf("Equal\n");
	else
		printf("Not Equal\n");
}

// compare strings return 1 if same 0 if not
BOOL StrEq(char *a, char *b)
{
	while (*a != 0 && *a == *b) // loop while not at end and same
	{
		a++;
		b++;
	}
	
	return *a == *b;
}
HTH