Coolant on/off on Rapids

If you have a question about the software please ask it here.

Re: Coolant on/off on Rapids

Postby alex_s » Wed Jan 03, 2018 12:11 pm

i thought along something like this
Code: Select all
const double ZHeight = 5;

double Zpos = AS3.Getfielddouble(228);
bool stateNow = Zpos < ZHeight &&  AS3.Getbuttonstate(666);

if (lastState != stateNow) {
   lastState = stateNow;
}

if(stateNow) {
   exec.Miston();
   while(exec.IsMoving()){}
}   
else {
   exec.Stopcoolant(); 
}


i made an extra button for MistOn while Cutting, and ZHeight at 5. So the Misting starts before the bit enters the material and still blows when it leaves. 5 is very save 1 or 2 should also work, the valve solenoid operates fairly quick and i generally only rapid to 3mm above the part.

i also used the execs directly so you can set the pin in option as usual, not tested yet because its effing cold right now in the Shop ^^
alex_s
 
Posts: 65
Joined: Tue Nov 29, 2016 11:45 am

Re: Coolant on/off on Rapids

Postby Dan911 » Thu Jan 04, 2018 4:25 pm

Hi Alex,
I'm glad you found my suggestion using a Z height useful. I'm also very happy to see you eliminated the exec.code(G4) for a pause because that wouldn't have worked with Gcode running. Thanks to Dezsoe who pointed this out to me, and I had to promised him I'll add a Breathalyzer test to my keyboard to continue posting.

Since it's only 11am here I think I can safely make some remarks to your posted macro.

Haven't tested your macro but it seems you eliminate the M7 call from gcode. I suggest using the macro loop for button on/off and M7 calls with Z height. If you have your toggle button just set to true/false this should work.

If anyone sees errors or have a better solution please post, I do think many can find this useful.

Code: Select all
/ ================================================================================================
// Mist on/off  M7 and ZHeight with toggle button override
// ================================================================================================

double Zpos = AS3.Getfielddouble(228);
bool ButOnOff = AS3.Getbuttonstate(20302);
bool stateNow = ((Zpos < ZHeight) &&  (exec.GetLED(52) && (!ButOnOff)));

 
 
  if(stateNow) {exec.Setoutpin(Port, Pin);}   

  else
 
  if(ButOnOff) {exec.Setoutpin(Port, Pin);}

else

{exec.Clroutpin(Port, Pin);}

// ================================================================================================

#Events

// ================================================================================================

const int Port = 1;     // Port number
const int Pin = 1;     // Pin number
const double ZHeight = 0; // Set  Z Height below on above off

Dan911
 
Posts: 613
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: Coolant on/off on Rapids

Postby alex_s » Thu Jan 04, 2018 4:32 pm

Hi Dan,

yep as pointed out by this thread z height seems to make much more sense here.
Thanks for looking into it, the button is a toggle true/false button.
The pause did not seem to be an good option, even if it would work, because the movement could be janky, and if you set zHeightValue above zZero with an equivalent amount for the specific solenoid and travel speeds it should not be needed

I also think that this is very use full for anyone who want's to save on coolant in Mist setup, especially the special expensive stuff. I wanted to use a different Button for it because i sometimes use my mister as semi flood ^^

here is a nice Datron video with a more advanced integration of the cooling feature, only on actual cutting + directional
https://www.youtube.com/watch?v=7PQxwte-2z4

but this solution is more then adequate for at least my purpose

cheers Alex
alex_s
 
Posts: 65
Joined: Tue Nov 29, 2016 11:45 am

Re: Coolant on/off on Rapids

Postby adamscncmachine » Wed Jul 31, 2024 1:42 am

I apologize for reviving such an old thread. I am having trouble implementing this macro, I have a couple questions that pertain:
First, would the construction of this macro be any different if using a different screenset than the one this was made for? I am using the default2019 profile and maybe that's why I can't get it to run properly. I have been able to get somewhat of a response from the machine using one version of the various code clips posted in this thread (but I don't remember which one). But all it seems to do is rapid fire my mist relay like it's in infinite loop.

My default 2019 screenset has a mist button on the main screen that I would like to be able to continue using for it's intended purpose, toggling on and off the air blast. But I would like this macro to begin running when the spindle is turned on and it is reading gcode.

I have been helpless as to getting this macro stuff to work, c# and coding seems to be too abstract for me to get my head around. I am usually good at identifying patterns and reworking them to get my result, but I am getting nowhere.

So to be clear from my end:

My mist button on the main screen acts as a toggle button (it is assigned to buttonnumber 116), it hasn't been changed from the factory settings other than when i first set up the machine, assigning the output pins for the m7 blast in the spindle settings.
I would like to slide one of my unused buttons on the main screen behind something else and create a button for this macro, I tried to make a button on the "User" page that has blank space, and then somehow managed to delete the entire user page using the edit screen tool and now it's white where the user menu would be, and the user button is gone now. Oh well, the program still works. Can anyone help me? I even resorted to asking chatgpt and it's giving me almost the identical same code, so I am probably making a dumb mistake somewhere. I won't post the code here because of redundancy, but I have tried both iterations that users have posted so far with no luck.

As a user posted above, now I have changed the port and pin to 0 and 0 in the M7 section of the spindle settings, and in output settings assigned port 1 pin 3 to LED 52. field 228 is in fact my work z DRO.

In the end, I'd like the mist/air blast/m7 relay to come on when the Z axis goes below 0, but only when code is running and the spindle is on. And for this cycle to end/turn off at the end of the file. In a perfect world I would like to be able to override/pause this macro so the air compressor can catch up, or I can selectively use the macro during heavy cutting and then manually toggle when doing smaller stuff.

Would this be too much to ask? I have been reading these forums voraciously and dezsoe (sp?) Dan911 and alex_S and cncdrive's posts have been worth so much to me! I'm endlessly amazed by the knowledge in here.
Thank you,
Adam
adamscncmachine
 
Posts: 1
Joined: Tue Jul 30, 2024 2:08 am

Previous

Return to Ask a question from support here

Who is online

Users browsing this forum: RsX and 9 guests