Hi Zoltan,
The KM_Interpreter_SetupParams has a property OriginIndex.
But to update all the Interpreter internal things for a Fixture change call the Interpreter member function:
public void ChangeFixtureNumber(int fixture)
HTH
Regards
Hi Tim!
I have a question: How can I get the current fixture in C#, and how can I set them?
Thanks,
Zoltan
Zoltan,
http://zoltan.buru.hu/
Hi Zoltan,
The KM_Interpreter_SetupParams has a property OriginIndex.
But to update all the Interpreter internal things for a Fixture change call the Interpreter member function:
public void ChangeFixtureNumber(int fixture)
HTH
Regards
Regards
TK http://dynomotion.com
Hi Tom!
Thanks you for the quick answer! Now I know how to read, and set the fixture. Next thing is how to set the offsets in each fixtures? I mean like in the examples there is a "Zero All" button, what put everything into global, and there is a panel to set every offset by manual. I see it in the C++ code, but I don't know how to access it thru C#.
Thanks,
Z
Zoltan,
http://zoltan.buru.hu/
Hi Z,
KMotionCNC now has a option to "Zero" with G92 global offsets or with the current fixture offset.
See the KM_Interpreter class
public void GetOrigin(int index, ref double x, ref double y, ref double z, ref double a, ref double b, ref double c)
public void SetOrigin(int index, double x, double y, double z, double a, double b, double c)
Regards
Regards
TK http://dynomotion.com
Hi Tom!
Another problem. When I CompileAndLoadCoff and Execute a C Program It looks something strange on the board (I made a C File with a loop in it, It is just flashing LEDs).
If I'm using KMotion C Program Panel to Compile, Load, Execute it's just works great! But if I'm doing the same from my C# code, the LED just flashing really strange.
try
{
string result = CompileAndLoadCoff(thread, filePath, false);
/*
if (result != "")
{
MessageBox.Show("Compile Error", Properties.Settings.Default.Text, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
}
else
{
this.WriteLineException(String.Format("Execute{0}" , thread));
}
*/
this.WriteLineException(String.Format("Execute{0}" , thread));
}
catch (DMException ex)
{
MessageBox.Show(ex.InnerException.Message, Properties.Settings.Default.Text, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
}
Zoltan,
http://zoltan.buru.hu/
Hi Zoltan,
Why did you comment out the error test?
Regards
Regards
TK http://dynomotion.com
Hi Tom!
(The Thread1.c is in the same folder the TCC67.exe file is)
tcc: file '?.\Thread1.c' not found
I call this:
this.KM.CompileLoadExec(1, ".\\Thread1.c");
This is my function:
public void CompileLoadExec(int thread, string filePath)
{
try
{
string result = this.CompileAndLoadCoff(thread, filePath, false);
if (result != "")
{
MessageBox.Show(String.Format("Thread {0} Compile Error\r\n{1}\r\n{2}", thread, filePath, result), Properties.Settings.Default.Text, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
}
else
{
this.WriteLineException(String.Format("Execute{0}" , thread));
}
}
catch (DMException ex)
{
MessageBox.Show(ex.InnerException.Message, Properties.Settings.Default.Text, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
}
}
Zoltan,
http://zoltan.buru.hu/
Hi Zoltan,
Specify the full path to the C File. You might use the method in the examples of how to find the root directory of your application executable. Search for "MainPath"
Regards
Regards
TK http://dynomotion.com
Hi Tom!
Get FullPath works fine! Thank you.
Another question: CoordMotion.Interpreter.SetMcodeAction() in C#. Can you tell me more about the parameters?
Zoltan,
http://zoltan.buru.hu/
Hi Zoltan,
You might read how the "Actions" are configured in KMotionCNC here:
Tool Setup Screen M3-M9
For specific programming details you can read the function InvokeAction() in GCodeInterpreter.cpp
Please note that the Index into the Array of Actions is not always the MCode Number as various types of Actions are all packed consecutively into the Array.
HTH
Regards
TK
Regards
TK http://dynomotion.com
Hi Tom!
Thanks you. Now it works.
Another thing: How can I do the to set the DAC output level with the S### command? I still have one dark spot, how to send varieables between my C# code and the C program what is running on the KFLOP.
Thanks,
Zoltan
Zoltan,
http://zoltan.buru.hu/
Hi Zoltan,
The GCode Interpreter will Interpret the S word and do the assigned "Action" in a similar manner as M codes. The S Action is index 10 into the table (after M9). So you can either configure the S word Action to simply write the scaled/offset Speed to a DAC. Or you can invoke a C Program to do whatever you wish. If you configure an Axis channel to drive a DAC (in either open or closed loop), then the Spindle Jog Examples can be used. This should all be the same as if you were using KMotionCNC as described here:
KMotionCNC Spindle Control
Regards
Regards
TK http://dynomotion.com
Hi Tom!
I'm playing aroundd with the InvokeAction.
I set this (12 should be the 25 Invoke):
CoordMotion.Interpreter.SetMcodeAction(12, MCODE_TYPE.M_Action_Setbit, 47, 1, 0, 0, 0, "");
After this I run this command:
CoordMotion.Interpreter.InvokeAction(25, false);
Nothing happend. Why?
Zoltan,
http://zoltan.buru.hu/
Hi Zoltan,
I don't think your Action number is correct. To find these type of issues it is often helpful to set a breakpoint with the debugger and step through the function to see what is being performed/referenced.
I made a table that maps the current Action Index to Action # here in the wiki:
KMotion Libraries - GCode Interpreter - Trajectory Planner - Coordinated Motion - .NET - Dynomotion
HTH
Regards
Regards
TK http://dynomotion.com
Thanks Tom! Now it's clear.
I tried this: this.CoordMotion.Interpreter.SetupParams.X_OriginO ffset = value;
It won't change the X origin offset in the actual origin. Why? (The original thing what I want to try is to set just one axis offset in the current origin)
Zoltan,
http://zoltan.buru.hu/
Hi Zoltan,
You didn't provide background for what you are trying to do. But that call should effect the instantaneous offset in use. The offsets are saved/loaded from GCode Variables (5221...) and that parameter will be updated from those when a fixture is selected. To change the offset table use:
/// <summary>
/// Sets the origin offset
/// </summary>
/// <param name="index">Origin index - 0 for G92 offsets, 1-9 for fixture offsets</param>
/// <param name="x">X offset</param>
/// <param name="y">Y offset</param>
/// <param name="z">Z offset</param>
/// <param name="a">a offset</param>
/// <param name="b">b offset</param>
/// <param name="c">c offset</param>
public void SetOrigin(int index, double x, double y, double z, double a, double b, double c)
HTH
Regards
Regards
TK http://dynomotion.com
Hi Tom!
Thanks. I'm already using that. I don't understand something:
1. I added the InterpreterUserMCodeCallbackRequested event.
2. I set this:
this.CoordMotion.Interpreter.SetMcodeAction(1, MCODE_TYPE.M_Action_Callback, 0.0, 0.0, 0.0, 0.0, 0.0, ""); // M1 set to Callback
3. This is mine Callback event (CC_OPT_STOP is TRUE):
private int Interpreter_InterpreterUserMCodeCallbackRequested( int code)
{
if(this.CC_OPT_STOP) {
this.CoordMotion.Interpreter.InvokeAction(0, true);
}
return 0;
}
Nothing happend. (I'm trying to add some kind of OPT-STOP stuff to M1)
UPDATE:
Sorry for the question, I'm done this:
private int Interpreter_InterpreterUserMCodeCallbackRequested( int code)
{
if(code == KMotionMCodeIndexes.ACTION_M1 && this.CC_OptionalStop)
{
this.Halt();
}
return 0;
}
public void Halt()
{
//
// 1 - Invoke Action
//
this.CoordMotion.Interpreter.InvokeAction(KMotionI nvokeActions.ACTION_HALT, false);
//
// 2 - Interpreter Halt
//
this.CoordMotion.Interpreter.Halt();
}
NOW IT IS GOOD!
Last edited by Buruhazard; 11-10-2015 at 02:34 PM. Reason: Realize
Zoltan,
http://zoltan.buru.hu/
Hi Tom!
I see this:
CoordMotion.Interpreter.VarsFile
CoordMotion.Interpreter.ToolFile
CoordMotion.Interpreter.SetupFile
Where should I put the GeoFile?
Zoltan,
http://zoltan.buru.hu/
Hi Zoltan,
To load a Geocorrection Table a call to:
Interpreter->CoordMotion->Kinematics->ReadGeoTable(m_GeoFile);
like KMotionCNC does is required. Unfortunately ReadGeoTable is not currently exposed in .NET. It will be added in the next Version
Here is a patch compatable with V3.33q that adds:
/// <summary>
/// Loads Coordinated Motion Kinematics Geo Correction Table
/// </summary>
/// <param name="filename">Geo Correction File Name to load</param>
public void KinematicsReadGeoTable(string filename)
to KM_CoordMotion
Index of /Software/Patch/Add.NETLoadGeoTableV433q
Copy the dlls to the \KMotion\Release directory. The sources are included if needed.
HTH
Regards
Regards
TK http://dynomotion.com
Hi Tom!
Thank you verry much!
I seen some diagrams or drawings about the DLL's how they calling/connecting each other (KMotionDLL, the dotNET dll, intercorp DLL, Interepter, etc...., TCC....) If you have something like this let me know!
I'm almost done with the UI in C#, I'm trying to integrate most of the features (and testing it on out machines) Everything looks great! But I moved all the DLL files what needed to my project folder:
./ is my current Debug/Release folder
Files:
./KMotionDLL.dll
./KMotion_dotNet.dll
./KMotion_dotNet_Interop.dll
./KMotionServer.exe
./GCodeInterpreter.dll
./TCC67.exe
Folders:
../DSP_KFLOP
Zoltan,
http://zoltan.buru.hu/