Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: daniba73 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!
-
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.
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
-
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
-
well! I thank you!
I'll try, then let you know
-
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.
-
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*
-
Hi,
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
-
how can i load the.ini file?
-
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 don't understand what to do!
I'm not a programmer!
is it not possible to create a Fixture Save button like in Mach3?
-
Hi,
is it not possible to create a Fixture Save button like in Mach3?
Yes it is possible but it will require some programming whether you like it or not.
There is a pair of API's especially for this purpose, and a number of other API's which could be used to do the same thing, but all of the APIs require some code
to glue it all together.
Craig
-
Daniba,
I am not a programmer either but I made this to help others out.
https://www.machsupport.com/forum/index.php?action=dlattach;topic=43260.0;attach=54239
-
it would be an impossible mission for me ... I would only do damage ..