G-codes/offsets/tools with .Net

Moderators: TomKerekes, dynomotion

Posts: 192
Joined: Thu Apr 26, 2018 10:16 pm

Re: G-codes/offsets/tools with .Net

Post by Moray » Wed Apr 22, 2020 6:24 pm

xdmattz wrote:
Wed Apr 22, 2020 2:36 am

Thanks for the response. I can certainly understand you not wanting to give away all that work, or putting something out there that you don't feel isn't quite finished. But it never hurts to ask. Hope you can get things running how you like. Maybe you can post a short YouTube video of your machine running when you get everything figured out.

I don't know how Tom K. Finds the time to answer all these forum posts. Kflop must be a labor of love for him. But I'm grateful that he does.

Dan Matthews
I would upload the current program, but it's needing the layout fixing, as I've still got the screen randomly extended to try and get the graphics working how I'd like (which have been placed on the back burner for now, as I don't see them as essential at the moment).

User avatar
Posts: 1182
Joined: Mon Dec 04, 2017 1:49 am

Re: G-codes/offsets/tools with .Net

Post by TomKerekes » Wed Apr 22, 2020 10:51 pm

Hi Moray,
I'm sure I tried that while loading offsets, and any change in the global offset never took effect, so I had to use a G52 call.
And having just re-checked, that method doesn't work. The offset itself gets updated (i.e. the new/updated offset value is returned with a GetOffset), but the active offset doesn't get updated (the DRO value doesn't change to reflect the change in global offset).
It's only an issue with the global offset, as there is no way to trigger a reload that I know off, whereas with the work offsets you simply switch offset and back again to reload the new offset values.
Ah. I see KMotionCNC updates the Axis Offsets with:

Code: Select all

		settings->axis_offset_x = Vars[5211];
		settings->axis_offset_y = Vars[5212];
		settings->axis_offset_z = Vars[5213];
		settings->AA_axis_offset = Vars[5214];
		settings->BB_axis_offset = Vars[5215];
		settings->CC_axis_offset = Vars[5216];
In your case since you just changed the Axis Offsets you should have them handy so probably don't need to read them back, just set them also into the current Interpreter Setup Parameters with code like:

Code: Select all

            _Controller.CoordMotion.Interpreter.SetupParams.X_AxisOffset = 10.0;
            _Controller.CoordMotion.Interpreter.SetupParams.Y_AxisOffset = 20.0;
            _Controller.CoordMotion.Interpreter.SetupParams.Z_AxisOffset = 30.0;
            _Controller.CoordMotion.Interpreter.SetupParams.A_AxisOffset = 40.0;
            _Controller.CoordMotion.Interpreter.SetupParams.B_AxisOffset = 50.0;
            _Controller.CoordMotion.Interpreter.SetupParams.C_AxisOffset = 60.0;

Tom Kerekes
Dynomotion, Inc.

Posts: 192
Joined: Thu Apr 26, 2018 10:16 pm

Re: G-codes/offsets/tools with .Net

Post by Moray » Thu Apr 23, 2020 10:49 pm

I was about to post and say that doesn't work, but then realised you mean to use SetOrigin to set the global offsets, then use that code to make them active, which it does.
At least in simulation (I've not got a KFlop handy to test it while connected), although the DRO doesn't immediately reflect the change, unlike when using the G52 call, but my temporary DROs showing offsets and doing a G0 G53 X0 shows the offset is being applied correctly in simulation.

Thanks for that.

Post Reply