Hello Guest it is March 28, 2024, 06:49:02 PM

Author Topic: How to remember DRO and Fixtures in Mach4?  (Read 776 times)

0 Members and 1 Guest are viewing this topic.

How to remember DRO and Fixtures in Mach4?
« on: November 18, 2022, 05:52:01 AM »
I'm using google translate, sorry for any mistakes.
How can I make Mach4 remember the last seen position in the DROs, the next time the program is reopened?
How can I save the fixture G54, G55 etc etc?
I asked this question, because sometimes the electricity goes out.
When this happens I lose fixture offset.
thanks!
Re: How to remember DRO and Fixtures in Mach4?
« Reply #1 on: November 18, 2022, 03:23:37 PM »
Hi,
in most cases g54,g55...etc are saved when Mach closes down.

When Mach is closed down it executes the ScreenUnload script. That script will save all the usual stuff like g54,g55 etc. If you want to save other items that's where you put the code.
Any data you save will be stored in the .ini file.

When Mach is restarted at the first run of the PLC script (which occurs after Mach loads and runs) you can retrieve the data from the .ini file and restore whatever DROs or variables within Mach.

Quote
I asked this question, because sometimes the electricity goes out.

This is your problem, if the power goes out then Mach just crashes, the ScreenUnload script will never get to run....and so none of the current data will be saved. Thats just bad luck
and nothing you can do about it. You need an uninterruptable power supply for your PC. If the power goes out then the power supply will know about it and shut down Mach gracefully,
ie run the ScreenUnload script.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: How to remember DRO and Fixtures in Mach4?
« Reply #2 on: November 19, 2022, 05:35:23 AM »
You can use mc.mcFixtureSaveFile(inst) to save the fixture offsets file. So you can add this to the end of any button script that you use to set the offsets
Re: How to remember DRO and Fixtures in Mach4?
« Reply #3 on: November 19, 2022, 06:11:42 AM »
well! I thank you!
I'll try, then let you know
Re: How to remember DRO and Fixtures in Mach4?
« Reply #4 on: November 20, 2022, 03:24:57 AM »
Hello.
I tried putting the code you wrote inside the Custom Button.
no result.
Origin of the piece made and button pressed.
if i turn off the power to the pc i lose origin.
Re: How to remember DRO and Fixtures in Mach4?
« Reply #5 on: November 20, 2022, 01:42:29 PM »
If your machine has home switches or if you home in the same spot every time, you can put your fixture offsets
in your program with G10 L2 X* Y* Z* A*
Re: How to remember DRO and Fixtures in Mach4?
« Reply #6 on: November 20, 2022, 02:20:29 PM »
Hi,

Quote
if i turn off the power to the pc i lose origin.

Did you restore the origin? You may have saved the origin but you need to read from the .ini file and restore the g54 coordinates.

Craig

'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: How to remember DRO and Fixtures in Mach4?
« Reply #7 on: November 20, 2022, 04:47:45 PM »
how can i load the.ini file?
Re: How to remember DRO and Fixtures in Mach4?
« Reply #8 on: November 20, 2022, 04:54:54 PM »
Hi,
you have to use the complementary API to that which you saved the fixture table:

LUA Syntax:
rc = mc.mcFixtureLoadFile(
      number mInst,
      string FileToLoad);

Description:
Used to load a fixture table into the core.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: How to remember DRO and Fixtures in Mach4?
« Reply #9 on: November 21, 2022, 06:54:19 AM »
I don't understand what to do!
I'm not a programmer!
is it not possible to create a Fixture Save button like in Mach3?