Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: mcardoso on October 06, 2019, 01:30:30 PM

Title: How to mark an axis as "Homed"
Post by: mcardoso on October 06, 2019, 01:30:30 PM
When you run the out-of-the-box homing script, the axes are homed one at a time and each one has a LED which changes from red to green to mark that the homing has completed on that axis.

I am writing my own homing script which doesn't use the built in "drive to home switch" type of homing. What API call can I use to set that LED green, and mark in software that the axis has been homed?

Thanks,

Mike
Title: Re: How to mark an axis as "Homed"
Post by: smurph on October 06, 2019, 04:25:38 PM
There is no script API to set the homed state of a motor (and thereby the axis it is attached to), only in C or C++ can you do that.  So set the axes to use "home in place" in the configuration dialog and call the regular homing API (mc.mcAxisHome() to turn the LEDs on and mc.mcAxisDeref() to turn the LEDs off)  Then do what you want. 

Steve
Title: Re: How to mark an axis as "Homed"
Post by: mcardoso on October 06, 2019, 05:34:18 PM
Well shoot. So briefly, here is what I am trying to do. I have servo drives on my machine that have the absolute position stored in them through power cycles (even if the motor is moved). I can read this position into Mach and set the axis positions to match using scripts. This is the homing without needing to drive to the switch. Before I can do that though, I need to do a normal home to the home switches on my machine and write that "zero" position to the servo drives.

So technically I need to be able to home both to the switch and in place (which is what will be done most of the time).

I don't know what goes into it, but this would be a feature that would be really helpful (to me) to have exposed to the API. Something like mc.mcAxisSetRef()? Maybe I can use the home in place setting but find another way to accomplish the normal home to switch routine? I'm not sure how I could get the Smoothstepper to execute its homing sequence though...

This is a really weird use case, I know, but it would be really cool for me to get it working.
Title: Re: How to mark an axis as "Homed"
Post by: joeaverage on October 06, 2019, 06:04:16 PM
Hi,

Quote
So technically I need to be able to home both to the switch and in place (which is what will be done most of the time).

But there are APIs that let you do just exactly that.

Craig
Title: Re: How to mark an axis as "Homed"
Post by: mcardoso on October 06, 2019, 06:49:36 PM
Craig,

Didn't think of that... You think I can just change the Mach 4 homing configuration on the fly?

Looking at the API reference, I see mc.mcAxisSetHomeInPlace(inst, AxisID, T/F). I would think I could set this TRUE before calling to home the axis using my servos so they don't move (for absolute homing from the servo drives), and FALSE to home normally?

Thanks
Title: Re: How to mark an axis as "Homed"
Post by: joeaverage on October 06, 2019, 07:26:33 PM
Hi,

Quote
Looking at the API reference, I see mc.mcAxisSetHomeInPlace(inst, AxisID, T/F). I would think I could set this TRUE before calling to home the axis using my servos so they don't move (for absolute homing from the servo drives), and FALSE to home normally?

Yes, that is exactly my understanding.

There are other situations where you can change 'settings' like that. Ordinarily, and in Mach3, once a setting is made then the only way to change it is to restart Mach3.
All semblance of changing machine behaviour on the fly is lost.

I suggest you look at the ability to link, or conversely un-link individual motors to or from an axis. There are some interesting cheats/hacks that can be done using the ability
to programatically change machine settings without the need to restart the program.

One trap is that if you change a setting in this manner is when, or even if, it will ever be written to the .ini file. There is an API that flushes the machine state to the .ini file,
and its use is recommended or unpredictable things can happen.

Craig
Title: Re: How to mark an axis as "Homed"
Post by: mcardoso on October 06, 2019, 09:25:09 PM
Quote
There are other situations where you can change 'settings' like that. Ordinarily, and in Mach3, once a setting is made then the only way to change it is to restart Mach3.
All semblance of changing machine behaviour on the fly is lost.

I guess that is what I am familiar with (even though I've been in Mach 4 for a while now). Makes sense that it was made to be much more flexible.

Not 100% sure what you mean about the INI file. Is the goal to save your changes to the INI every time you make a change, or are you trying to avoid saving it at all?

At this time my thoughts are that I want to have Mach start up in a defined state every time. I may change settings throughout its use, but unless I crash the program, it should be back to default before shutting down.
Title: Re: How to mark an axis as "Homed"
Post by: mcardoso on October 06, 2019, 09:40:59 PM
OK, here is where I am at on this. I have modified the REF ALL HOME script to ask me in a pop-up window if I want to define home from the absolute data in the servo drives or if I want to execute the normal homing sequence. If I choose normal, at the end of the sequence it asks if I would like to define the home position in the drives as well (which I answer YES to unless the homing failed for some reason). If I opt to restore the position data from the drives, the data is read, converted from hex to decimal, and written to the current position in Mach. I have not yet implemented the home in place to mark the axis as homed.

What I noticed is that the API call mc.mcAxisSetPos() only sets the fixture offset and not the actual machine position (which now as I just looked is what the documentation says - doh!). I think what I need to do is: change mode to home in place, read servo drive position, copy that position to the home offset, then home in place. Since this method can be completed when the machine is in any position, I can't guarantee I will be sitting at 0,0,0. What is pretty neat is I can enable and disable the motors as much as I want and the position data reflects the minuscule changes in shaft position as the motors get energized and de-energized. 

BTW, if anyone is interested, the servo drives are AB Ultra 3000's and I created an interface to the drives over serial (RS485) using the drive's host commands. Took a while to develop, but the serial interface through Mach 4/LUA is really solid and this communication seems bulletproof.
Title: Re: How to mark an axis as "Homed"
Post by: mcardoso on October 06, 2019, 10:26:11 PM
This may be diving into the realm of the Smoothstepper's Plug-in but there really seems to be no change in behavior between setting mc.mcAxisSetHomeInPlace() to TRUE or FALSE. This seems to be the only thing holding this function up for me.

I can correctly set the home offset, and set the API call to home in place, but then all the axes move to the switches and home normally. I'll cross post this question with Warp9 to try and get an idea of what they are doing with homing code on their end.
Title: Re: How to mark an axis as "Homed"
Post by: joeaverage on October 07, 2019, 12:59:29 AM
Hi,
I rather suspect that Mach4 is continuing in the existing homing mode, that you have changed mode has not yet taken effect.

If memory serves there is an API that causes Mach to re-read the .ini file, and then and only then does the change take effect.

I'm due out the door in minutes to play bridge but would otherwise explore this further.

Craig
Title: Re: How to mark an axis as "Homed"
Post by: mcardoso on October 07, 2019, 09:49:54 AM
Quote
I rather suspect that Mach4 is continuing in the existing homing mode, that you have changed mode has not yet taken effect.

If memory serves there is an API that causes Mach to re-read the .ini file, and then and only then does the change take effect.

Went digging through the API reference and couldn't find anything like you are describing (only a save to INI command). That's probably due to me not understanding how the INI works just yet!

Thanks for all the time and help you've given me. Really made a ton of progress yesterday with all of this.

Mike
Title: Re: How to mark an axis as "Homed"
Post by: mcardoso on October 07, 2019, 12:28:50 PM
From Andy at Warp9!

Quote
Hi,

The short answer is that the the SmoothStepper plugin never looks at the mcAxisSetHomeInPlace parameter. Mach4 looks at that parameter and then decides if it should do a home in place operation on that axis (motors) or tell the SmoothStepper to home that axis (motors) .

In order to set that parameter in Mach4 correctly, you need to do a couple other operations
rc = mc.mcCntlConfigStart(inst);
and
rc = mc.mcCntlConfigStop(inst); -- takes the machine out of the config state.
You may also need to do (but I don't think you will need to since you are only modifying a Mach parameter):
local hICU_Command = mc.mcRegGetHandle(inst, string.format("ESS/Force_Config_Update"))
mc.mcRegSetValueLong(hICU_Command, 1)

The second video walks you through the details...

Please understand that you are messing with your config file... you can destroy it if you are not careful! I would recommend backing up your entire c:\mach4Hobby folder before you do any of this.

Will try tonight and see if I can get it working.
Title: Re: How to mark an axis as "Homed"
Post by: rhtuttle on October 07, 2019, 12:33:44 PM
The machine.ini file contains all of the Mach4 settings you are currently using for that 'Profile' in that profiles directory. e.g. myLathe ini is:
C:\Mach4Hobby\Profiles\myLathe\machine.ini

To save or load settings:
mcProfileSave
mcProfileReload

Some motion controllers do not allow you to change motor/other settings on the fly, rather they require a complete restart.

HTH

RT
Title: Re: How to mark an axis as "Homed"
Post by: mcardoso on October 08, 2019, 12:52:31 PM
I spent some time last night trying to get this to work and unfortunately didn't see any change in behavior from what I described before.

Here is my function. The goal is to home in place after having set a home offset equivalent to the drive current position. After homing, the DRO's should display the correct position, all the G54 offsets should be zero, and the LEDs should be illuminated showing the axes as homed. All without moving any axes.

The line "serialError, position = mcServo.GetPosition(address, ctsPerInch)" is a function I made as part of a custom library to communicate to my servos over serial. I'm 99.9% it is working correctly as it always returns the correct value for position (in unit of inches).

Code: [Select]
function mcServo.AbsolutePositionRecovery()
       
        --define local variables
local rError = 0
local sError = 0
local xPosition
local yPosition
local zPosition
local sPosition

        --change Mach 4 config for all axes to home in place, save & reload the profile
mc.mcCntlConfigStart(inst)
mc.mcAxisSetHomeInPlace(inst, 0, 1)
mc.mcAxisSetHomeInPlace(inst, 1, 1)
mc.mcAxisSetHomeInPlace(inst, 2, 1)
mc.mcAxisSetHomeInPlace(inst, 5, 1)
mc.mcCntlConfigStop(inst)
mc.mcProfileSave(inst)
mc.mcProfileReload(inst)

        --Gets the motor counts per inch for each axis
        --Then queries the servo drives for their position
        --Exits the function with an error code if any drive transmission failed
local XctsInch = mc.mcMotorGetCountsPerUnit(inst, 0)
local YctsInch = mc.mcMotorGetCountsPerUnit(inst, 1)
local ZctsInch = mc.mcMotorGetCountsPerUnit(inst, 2)
local SctsInch = mc.mcMotorGetCountsPerUnit(inst, 5)
sError, xPosition = mcServo.GetPosition("00", XctsInch)
if sError ~= 0 then; rError = 1; return rError end
sError, yPosition = mcServo.GetPosition("01", YctsInch)
if sError ~= 0 then; rError = 1; return rError end
sError, zPosition = mcServo.GetPosition("02", ZctsInch)
if sError ~= 0 then; rError = 1; return rError end
sError, sPosition = mcServo.GetPosition("05", SctsInch)
if sError ~= 0 then; rError = 1; return rError end

        --Sets the home offset equal to the position received from the drives
        --Need to multiply by -1 to invert the counts
        --Because the drive polarity on all these servos is inverted
mc.mcAxisSetHomeOffset(inst, 0, (xPosition*-1))
mc.mcAxisSetHomeOffset(inst, 1, (yPosition*-1))
mc.mcAxisSetHomeOffset(inst, 2, (zPosition*-1))
mc.mcAxisSetHomeOffset(inst, 5, (sPosition*-1))

        --Mach 4 API call to home axes (in-place)
mc.mcAxisHome(inst, 0)
mc.mcAxisHome(inst, 1)
mc.mcAxisHome(inst, 2)
mc.mcAxisHome(inst, 5)

--change Mach 4 config for all axes to home normally, save & reload the profile
        mc.mcCntlConfigStart(inst)
mc.mcAxisSetHomeInPlace(inst, 0, 0)
mc.mcAxisSetHomeInPlace(inst, 1, 0)
mc.mcAxisSetHomeInPlace(inst, 2, 0)
mc.mcAxisSetHomeInPlace(inst, 5, 0)
mc.mcCntlConfigStop(inst)
mc.mcProfileSave(inst)
mc.mcProfileReload(inst)

return rError
end

When I run this, the code still wants to bump all of the axes into their home switches. The home offset does seem to get set correctly.

After posting this to Warp 9, I was given a few ideas to try:

Quote
Hi Mike,

My guess is that your problem is that you are doing everything inside a single lua function, which has all of it calls made all in a single sequence.

However, I doubt that Mach4 is actually changing the profile and reloading it immediately when you call those functions, but rather queuing up the changes to be made after the screen scripts (or macros) finish running (the screen script is executed 40 or 50 times each second).

My guess is that if you broke your function into several separate function blocks that you called and waited for a moment before you called the next one, it would work like you wanted. If it did, then we would know that you would need to set up a state machine approach, for this operation. Assuming you have this in your screen script, the first pass through would make the changes to the conifg, and increment the state counter. The next time the screen script runs (1/40th or 1/50th of a second later, it would do the next chunk and increment the state counter. It would repeat this as many times as necessary, but it looks like your code would only need 3 times, or maybe 5 times if you had a do nothing pause step in between the real steps.


Let me know how it goes, but first try making 3 smaller functions that you call from the MDI and see if it works like you would expect it to.

I'm going to try that recommendation and see if it makes any difference.

I'm very much open to ideas or suggestions. Really would love to get this working. Understanding how Mach scans code and executes changes is a huge learning curve for me, but I think it is worth it.
Title: Re: How to mark an axis as "Homed"
Post by: smurph on October 08, 2019, 01:49:08 PM
Code: [Select]
        --change Mach 4 config for all axes to home in place, save & reload the profile
mc.mcCntlConfigStart(inst)
mc.mcAxisSetHomeInPlace(inst, 0, 1)
mc.mcAxisSetHomeInPlace(inst, 1, 1)
mc.mcAxisSetHomeInPlace(inst, 2, 1)
mc.mcAxisSetHomeInPlace(inst, 5, 1)
mc.mcCntlConfigStop(inst)
mc.mcProfileSave(inst)
mc.mcProfileReload(inst)

Why use all of the profile stuff when you are doing nothing with the profile at all? 

mc.mcCntlConfigStart(inst) puts the machine in the configuration state.  The idea is that you would then write things to the profile with mcProfile* functions.  Then call mc.mcCntlConfigStop(inst).  This is EXACTLY what we do with the control configuration dialog.

1. Enter the config state.
2. Read the profile's existing settings and display them in the dialog.
3. Allow the user to make changes.
4. If Ok or Apply is pressed, write the changes to the profile.  Then mc.mcProfileFlush(), which makes the changes stick.
5. Exit the config state.  This causes the control to re-read the profile and bring in the new settings. 

This is a very controlled process and can only be done with the control in the Idle state.  Not good for on-the-fly changes at run time. 

Code: [Select]
        --Set Mach 4 to home all axes in place at run time to take effect immediately. 
        --The changes will be written to the profile when Mach is shut down.
        --If you don't want the changes to be permanent, then change them back before shutting down Mach.
mc.mcAxisSetHomeInPlace(inst, 0, 1)
mc.mcAxisSetHomeInPlace(inst, 1, 1)
mc.mcAxisSetHomeInPlace(inst, 2, 1)
mc.mcAxisSetHomeInPlace(inst, 5, 1)

Steve
Title: Re: How to mark an axis as "Homed"
Post by: mcardoso on October 08, 2019, 03:06:27 PM
Quote
Why use all of the profile stuff when you are doing nothing with the profile at all?

Probably because I don't yet know what I am doing  ;D

Quote
mc.mcCntlConfigStart(inst) puts the machine in the configuration state.  The idea is that you would then write things to the profile with mcProfile* functions.  Then call mc.mcCntlConfigStop(inst).  This is EXACTLY what we do with the control configuration dialog.

1. Enter the config state.
2. Read the profile's existing settings and display them in the dialog.
3. Allow the user to make changes.
4. If Ok or Apply is pressed, write the changes to the profile.  Then mc.mcProfileFlush(), which makes the changes stick.
5. Exit the config state.  This causes the control to re-read the profile and bring in the new settings.

Do you think this is the same process I would follow for changing the homing mode to "home in place"? Is the API call mc.mcAxisSetHomeInPlace() the correct one to do this or do I need to use a mcProfile command?

Quote
This is a very controlled process and can only be done with the control in the Idle state.  Not good for on-the-fly changes at run time.

This is ONLY going to be used when the machine is idle, either during a start-up script that prompts me to enable the control then home, or when the user presses the REF ALL HOME button.  Is there an easy way to check for idle? I've used the mc.mcCntlGetState() command but have never found a reference for what each state corresponds to the number returned from this call. I will add this as a condition for the homing to be allowed.

Based on the advice above, I'm thinking it might look something like this:

Code: [Select]
--change Mach 4 config for all axes to home in place, save & reload the profile
mc.mcCntlConfigStart(inst)
mc.mcAxisSetHomeInPlace(inst, 0, 1)
mc.mcAxisSetHomeInPlace(inst, 1, 1)
mc.mcAxisSetHomeInPlace(inst, 2, 1)
mc.mcAxisSetHomeInPlace(inst, 5, 1)
        mc.mcProfileFlush(inst)
mc.mcCntlConfigStop(inst)
(inst)

Would this immediately make the changes, or would I need to wait a full scan of the code for the changes to take effect?

Thanks again to everyone for the time and help. It is very appreciated.
Title: Re: How to mark an axis as "Homed"
Post by: smurph on October 08, 2019, 04:41:14 PM
I gave you the correct answer and then possibly muddied the water by trying to demonstrate how and why the profile functions are used.  For on the fly changes, which is what you are doing, do this:
Code: [Select]
--Set Mach 4 to home all axes in place at run time to take effect immediately.
--The changes will be written to the profile when Mach is shut down.
--If you don't want the changes to be permanent, then change them back before shutting down Mach.
mc.mcAxisSetHomeInPlace(inst, 0, 1)
mc.mcAxisSetHomeInPlace(inst, 1, 1)
mc.mcAxisSetHomeInPlace(inst, 2, 1)
mc.mcAxisSetHomeInPlace(inst, 5, 1)

--Mach 4 API call to home all of the axes (in-place)
--The home offset in the config dialog will automatically be applied! 
-- No need to programmatically set the home offset every time as it probably won't change.
mc.mcAxisHomeAll(inst)
 
        --Do we really need to swap back? 
mc.mcAxisSetHomeInPlace(inst, 0, 0)
mc.mcAxisSetHomeInPlace(inst, 1, 0)
mc.mcAxisSetHomeInPlace(inst, 2, 0)
mc.mcAxisSetHomeInPlace(inst, 5, 0)

Use the above code. 

But to clarify the profile use case: (which you should NOT use in this circumstance).
Code: [Select]
--change Mach 4 config for all axes to home in place, save & reload the profile
mc.mcCntlConfigStart(inst)
mc.mcProfileWriteInt(inst, "Axis0", "HomeInPlace", 1)
mc.mcProfileWriteInt(inst, "Axis1", "HomeInPlace", 1)
mc.mcProfileWriteInt(inst, "Axis2", "HomeInPlace", 1)
mc.mcProfileWriteInt(inst, "Axis5", "HomeInPlace", 1)
mc.mcProfileFlush(inst)
mc.mcCntlConfigStop(inst)

Either way will work.  But going the config state and profile route is a LOT slower. 

Also, for brevity, none of these examples are looking at the return codes from the API calls.  You REALLY want to do that in your real live script. 

One more thing.  Usually, for ABS encoders, this would be the setup:

1. Conifgure Mach axis homing tab. 
2. Set home in place for each axis with a ABS encoder. 
3. Set the offset for each axis in machine coordinates.  Find this for each axis prior to configuring the homing by:
   a. Put the position DROs in machine coordinates mode.
   b. Jog to the desired home position and record the current machine coordinates.  This will become your home offset.
4. Set the desire home order.  Base 1.  Z is usually 1 on a mill.  X and Y can usually be homed together set as 2. Maybe not important for ABS encoders.  But set it for completeness. 

Then the regular homing buttons will just set the home offset with no modifications required.  After a RefAll, issuing "G00 G53 X0 Y0" in MDI should carry the axes to the home positions. 

You do not need to set the home offsets again unless you change the encoder to table relationship. In most cases, this would only need to be done once and would not need to be update unless the machine was repaired or something.  If you are worried that this relationship will change and need to be updated every so often, I would consider that a mechanical problem that needs to be fixed.  Loose servo motor coupler, etc.. 

But if you have to have the optional switch homing, then you can expand on this stuff.  If want to use the profile method to set the home offsets, look at the profile and find an Axis# section (where # is 0 to 5) to get the keys you are interested in.  (section, key, value)

If you set values wit the mcProfile*() functions, use mcProfileFlush() to make the modifications stick.  If you modify axis values with the API functions, use mcProfileSave() to make the modifications stick.

Steve
Title: Re: How to mark an axis as "Homed"
Post by: mcardoso on October 09, 2019, 09:37:52 AM
Good news! I got it working! Thanks again to all who helped me out.

I ended up having to do a ton of test scripts to get an understanding of what exactly Mach 4 was doing with the code I was running.

Here are the key snippets I figured out to make this work (and I am sure they were discussed above already):

I figured this out by added 3 test buttons to the screen. One turned ON home in place, one ran the homing code, and one turned OFF home in place. If I clicked through these in sequence, the code worked great. If I put them together in a script, it didn't work at all. I was going to build a state machine, but figured I would try a raw delay first and that worked great (wx.wxMilliSleep()). This has yet to fail at 50ms, but if I set it to 10ms, some axes will home in place while others won't. I decided to play it safe and choose 100ms. There may be a cleaner way to do this, but execution time isn't important to me since it only runs one time at startup.

The code is executed while the axes are enabled. I can have the axes anywhere and they don't need to be moved. I get the current position of the motors from the drives which is tracked mechanically in the encoders while the machine is powered off. I throw this value into the homing offset then home in place. Finally the home offset and home in place values are returned to normal and the code ends. This still allows me to home to my switches like normal if I want. It is cool to see a tenth or two of movement when I disable and later re-enable. It is the closest thing to position feedback into Mach that I have.

Here is the code contained in the Ref All Home button:

Code: [Select]
--RefAllHome()
local e1 = 0

local HomeBox = wx.wxMessageBox("Do you wish to restore absolute position data from Servo Drives? \n \nChoose YES to restore homing data. \nChoose NO to Home to Limit Switches. \nChoose CANCEL to skip homing.", "Homing Type",18)
if HomeBox == 2 then
e1 = mcServo.AbsolutePositionRecovery()
if e1 ~= 0  then
wx.wxMessageBox("Home Position Recovery Failed! \n \n Axes must be referenced to switch before operation.", "Homing Failed",4)
else
wx.wxMessageBox("Home Position successfully read from Servo Drives", "Step 3/5 - Homing",4)
end
elseif HomeBox == 8 then
wait = coroutine.create (RefAllHome) --This is the code from the ref all home button
end


And the code for absolute homing using Allen Bradley Ultra 3000 servo drives, consuming data over RS485 Serial Host commands:

Code: [Select]
function mcServo.AbsolutePositionRecovery()

local rError = 0
local sError = 0
local xPosition = 0
local yPosition = 0
local zPosition = 0
local sPosition = 0

mc.mcAxisSetHomeInPlace(inst, 0, 1)
mc.mcAxisSetHomeInPlace(inst, 1, 1)
mc.mcAxisSetHomeInPlace(inst, 2, 1)
mc.mcAxisSetHomeInPlace(inst, 6, 1)
mc.mcProfileSave(inst)

wx.wxMilliSleep(100) --Sleep 100 milliseconds

local XctsInch = mc.mcMotorGetCountsPerUnit(inst, 0)
local YctsInch = mc.mcMotorGetCountsPerUnit(inst, 1)
local ZctsInch = mc.mcMotorGetCountsPerUnit(inst, 2)
local SctsInch = mc.mcMotorGetCountsPerUnit(inst, 6)
sError, xPosition = mcServo.GetPosition("00", XctsInch)
if sError ~= 0 then; rError = 1; return rError end
sError, yPosition = mcServo.GetPosition("01", YctsInch)
if sError ~= 0 then; rError = 1; return rError end
sError, zPosition = mcServo.GetPosition("02", ZctsInch)
if sError ~= 0 then; rError = 1; return rError end
sError, sPosition = mcServo.GetPosition("05", SctsInch)
if sError ~= 0 then; rError = 1; return rError end

mc.mcAxisSetHomeOffset(inst, 0, (xPosition*-1))
mc.mcAxisSetHomeOffset(inst, 1, (yPosition*-1))
mc.mcAxisSetHomeOffset(inst, 2, (zPosition*-1))
mc.mcAxisSetHomeOffset(inst, 6, (sPosition*-1))

mc.mcAxisHomeAll(inst)

wx.wxMilliSleep(100) --Sleep 100 milliseconds

mc.mcAxisSetHomeOffset(inst, 0, 0)
mc.mcAxisSetHomeOffset(inst, 1, 0)
mc.mcAxisSetHomeOffset(inst, 2, 0)
mc.mcAxisSetHomeOffset(inst, 6, 0)

mc.mcAxisSetHomeInPlace(inst, 0, 0)
mc.mcAxisSetHomeInPlace(inst, 1, 0)
mc.mcAxisSetHomeInPlace(inst, 2, 0)
mc.mcAxisSetHomeInPlace(inst, 6, 1) --Leave Spindle as Home in Place
mc.mcProfileSave(inst)

wx.wxMilliSleep(100) --Sleep 100 milliseconds

return rError

end

Thanks again to all!
Title: Re: How to mark an axis as "Homed"
Post by: rhtuttle on October 09, 2019, 10:02:19 AM
Thank you for posting the results of your endeavors.  Posts like these go a long way to furthering the knowledge bank for Mach4 users.

BTW, Stumbled across your Grizzly mill build on Hobby-Machinist.  Spent two hour reading the whole thread.  Great photos, explanation and design.

RT
Title: Re: How to mark an axis as "Homed"
Post by: mcardoso on October 09, 2019, 10:27:25 AM
RT,

Thanks for the complement! I keep that as a log for my own enjoyment as much as sharing it with others. Just something fun to play with after work. Keeps me from going crazy working at a computer all day  ;D

Happy to share when I get stuff working!

Mike