Hello Guest it is April 18, 2024, 05:09:35 PM

Author Topic: Reference all axiss from M function  (Read 812 times)

0 Members and 1 Guest are viewing this topic.

Reference all axiss from M function
« on: May 02, 2021, 01:31:30 AM »
when i define " home in place"
then on Mfunction:
 mc.mcAxisSetHomeOffset(0,0,200)
      mc.mcAxisSetHomeOffset(0,1,300)
      mc.mcAxisSetHomeOffset(0,2,150)      
      mc.mcAxisHomeAll(0)
its put the value but only if i push manually the button Reference
how can i make that its will activate also the comand
mc.mcAxisHomeAll(0)
?
Re: Reference all axiss from M function
« Reply #1 on: May 04, 2021, 04:18:44 AM »
do you really want to reference axes in a script? scripts are supposed to perform routines over and over again. Typically you want to reference your machine once and run the crap out of it.

Maybe work offsets are a better choice. home once. in the m script if you want to return to a 'particular' zero place, then make that a work offset and move to zero with gcode like G54 X0 or G55 X0. If your G54 is set to x=2.54, y=3.9 then going to zero using a work offset would go to these positions, relative to your machine home position. then from there you can make moves from your 'new zero reference point'. G54 X12 would have the offset of the work coordinates (relative to machine zero) plus the new location you just directed it to. So it would be X12 + X2.54 = G54 X14.54

The notes for the mcAxisSetHomeOffset API call says that the Mach core doesn't do anything with it. It is there for plugins maybe????

Code: [Select]
Notes:
The core provides a container for the axis home offset only. It currently does nothing with it. However, a motion plugin may retrieve the stored offset and use it.

Maybe some motion controllers use this for delegate sensor backoff ???
« Last Edit: May 04, 2021, 04:30:33 AM by compewter_numerical »

Offline Bill_O

*
  •  563 563
    • View Profile
Re: Reference all axiss from M function
« Reply #2 on: May 04, 2021, 11:00:33 AM »
Katz,

I think it would be best to do it like compewter is saying.
Having said that for some of our machines I do a home in script.
It needs to be done as a GCode.
mc.mcCntlGcodeExecute(inst, "G28.1 X0.0")

Bill

Offline smurph

*
  • *
  •  1,546 1,546
  • "That there... that's an RV."
    • View Profile
Re: Reference all axiss from M function
« Reply #3 on: May 05, 2021, 02:59:43 PM »
Here is the reason why mc.mcAxisHomeAll() doesn't work from an M code:

Homing from a script that calls mc.mcAxisHomeAll() can only be done when the machine is in the IDLE state.  For example, the "Ref All Home" button calls this API function.  But it only works when the machine is IDLE.  Therefore, running and M code that calls mc.mcAxisHomeAll(), the machine obviously NOT be in the IDLE state.  So it just isn't possible.

As Bill stated use G28.1.  For mc.mcAxisHomeAll() type functionality, name all of the axes that you need in the G code block.  E.g.  "G28.1 X0 Y0 Z0" to home X, Y, and Z.  The block will follow the home order setup in the Homing/Softlimits tab of the configuration dialog. 

Steve
Re: Reference all axiss from M function
« Reply #4 on: May 06, 2021, 02:29:07 PM »
Ill explain my self batter
I want use absolute encoder
When i turn on mach ,or even press star ,each time i check the value from encoder, cheack if its same as shuld be and run
So all yours suggest with shift not available
Why can't use the api as its wrote in manual?

Offline smurph

*
  • *
  •  1,546 1,546
  • "That there... that's an RV."
    • View Profile
Re: Reference all axiss from M function
« Reply #5 on: May 06, 2021, 03:24:03 PM »
I don't get it.  If you are using abs encoders, then why do you even want to home?  Maybe you just need to set the axes as homed with mc.mcAxisRef(inst, axisNumber) or mc.mcAxisRefAll(inst).

I explained why you can't use the API function mc.mcAxisHomeAll() in a M code script.  Because the mc.mcAxisHomeAll() requires the machine to be idle.  If you are "running" an M code, the machine is NOT idle.  It is mutually exclusive. 

Steve
Re: Reference all axiss from M function
« Reply #6 on: May 06, 2021, 03:47:10 PM »
Yes exactly i want set the position
As i mentioned i found solution ,its ...
I made event ,and in screen load i care this event snd do the ref there,there bug about motor revers,if its mark then home in position randomly put value in minus