586,637 active members*
2,818 visitors online*
Register for free
Login
Results 1 to 14 of 14
  1. #1
    Join Date
    Aug 2007
    Posts
    55

    open and close suction vents

    I have built my down draft table on my plasma with air rams to open and close each section of the table so i can direct the suction to the area the torch is working in, i would like to automate this process.

    I originally was going to build some switches into the zones on the y travel path and arduino it up to open and close but I think it would be more elegant if its handled within the uccnc software.

    Once the machine is homed then the vents become available, this way i don't have vents opening and closing randomly because that origin is off.
    Once available, Y position (machine coordinates) would

    Y0 - 999mm output 1
    Y1000 - 1999mm output 2
    Y2000 - 2999mm output 3
    y3000 - 3999mm output 4

    I suppose you could even go Y 500 - 1500 output 1&2, i think you get the idea.
    I would prefer not to have this solved by embedded outputs in the gcode (from the post processor).

    Can someone smarter than me suggest how I would go about making this work?

  2. #2
    Join Date
    Mar 2003
    Posts
    35538

    Re: open and close suction vents

    macroloop?
    If you ask on the UCCNC forum, someone may even write one for you.
    Gerry

    UCCNC 2017 Screenset
    http://www.thecncwoodworker.com/2017.html

    Mach3 2010 Screenset
    http://www.thecncwoodworker.com/2010.html

    JointCAM - CNC Dovetails & Box Joints
    http://www.g-forcecnc.com/jointcam.html

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  3. #3
    Join Date
    Apr 2014
    Posts
    59

    Re: open and close suction vents

    Do you want to enable the outputs only while g-code is running?

  4. #4
    Join Date
    Apr 2014
    Posts
    59

    Re: open and close suction vents

    I didn't wait for you answer. Set the limits and the output pins as your needs. If the outputs are active low, change ventxNeg to "true". Save code to Mxxxxx.txt where xxxxx is a number (e.g. M10000.txt) and go to General settings / Config macroloops, add 10000 (or the number you selected) to an empty row, set Auto run, click Run, click Save settings. Ready.

    Code:
    // ================================================================================================
    // Auto open vents
    // ================================================================================================
    
    int newState = 0;
    double yPos = 0.0;
    
    if (exec.GetLED(RunLED))
    {
      yPos = exec.GetYmachpos();
      if ((yPos >= lim0) && (yPos < lim1))
        newState = 1;
      else if ((yPos >= lim1) && (yPos < lim2))
        newState = 2;
      else if ((yPos >= lim2) && (yPos < lim3))
        newState = 3;
      else if ((yPos >= lim3) && (yPos < lim4))
        newState = 4;
    }
    
    if (newState != lastState)
    {
      Clroutpin(vent1Port, vent1Pin, vent1Neg);
      Clroutpin(vent2Port, vent2Pin, vent2Neg);
      Clroutpin(vent3Port, vent3Pin, vent3Neg);
      Clroutpin(vent4Port, vent4Pin, vent4Neg);
      switch (newState)
      {
        case 1:
          Setoutpin(vent1Port, vent1Pin, vent1Neg);
          break;
        case 2:
          Setoutpin(vent2Port, vent2Pin, vent2Neg);
          break;
        case 3:
          Setoutpin(vent3Port, vent3Pin, vent3Neg);
          break;
        case 4:
          Setoutpin(vent4Port, vent4Pin, vent4Neg);
          break;
      }
      lastState = newState;
    }
    
    // ================================================================================================
    
    #Events
    
    // ================================================================================================
    
    // =============== Constants
    
    const int vent1Port = 2;                                                        // Port number of vent 1
    const int vent1Pin = 2;                                                         // Pin number of vent 1
    const bool vent1Neg = false;                                                    // Invert pin of vent 1
    
    const int vent2Port = 2;                                                        // Port number of vent 2
    const int vent2Pin = 3;                                                         // Pin number of vent 2
    const bool vent2Neg = false;                                                    // Invert pin of vent 2
    
    const int vent3Port = 2;                                                        // Port number of vent 3
    const int vent3Pin = 4;                                                         // Pin number of vent 3
    const bool vent3Neg = false;                                                    // Invert pin of vent 3
    
    const int vent4Port = 2;                                                        // Port number of vent 4
    const int vent4Pin = 5;                                                         // Pin number of vent 4
    const bool vent4Neg = false;                                                    // Invert pin of vent 4
    
    const double lim0 = 0.0;                                                        // Zone limits
    const double lim1 = 1000.0;
    const double lim2 = 2000.0;
    const double lim3 = 3000.0;
    const double lim4 = 4000.0;
    
    const int RunLED = 19;                                                          // On when code is running
    
    // =============== Static variables
    
    static int lastState = 0;
    
    // =============== Set/Clr output
    
    void Setoutpin(int port, int pin, bool neg)
    {
      if (neg)
        exec.Clroutpin(port, pin);
      else
        exec.Setoutpin(port, pin);
    }
    
    void Clroutpin(int port, int pin, bool neg)
    {
      if (neg)
        exec.Setoutpin(port, pin);
      else
        exec.Clroutpin(port, pin);
    }

  5. #5
    Join Date
    Aug 2007
    Posts
    55

    Re: open and close suction vents

    Quote Originally Posted by dezsoe View Post
    I didn't wait for you answer. Set the limits and the output pins as your needs. If the outputs are active low, change ventxNeg to "true". Save code to Mxxxxx.txt where xxxxx is a number (e.g. M10000.txt) and go to General settings / Config macroloops, add 10000 (or the number you selected) to an empty row, set Auto run, click Run, click Save settings. Ready.

    Code:
    // ================================================================================================
    // Auto open vents
    // ================================================================================================
    
    int newState = 0;
    double yPos = 0.0;
    
    if (exec.GetLED(RunLED))
    {
      yPos = exec.GetYmachpos();
      if ((yPos >= lim0) && (yPos < lim1))
        newState = 1;
      else if ((yPos >= lim1) && (yPos < lim2))
        newState = 2;
      else if ((yPos >= lim2) && (yPos < lim3))
        newState = 3;
      else if ((yPos >= lim3) && (yPos < lim4))
        newState = 4;
    }
    
    if (newState != lastState)
    {
      Clroutpin(vent1Port, vent1Pin, vent1Neg);
      Clroutpin(vent2Port, vent2Pin, vent2Neg);
      Clroutpin(vent3Port, vent3Pin, vent3Neg);
      Clroutpin(vent4Port, vent4Pin, vent4Neg);
      switch (newState)
      {
        case 1:
          Setoutpin(vent1Port, vent1Pin, vent1Neg);
          break;
        case 2:
          Setoutpin(vent2Port, vent2Pin, vent2Neg);
          break;
        case 3:
          Setoutpin(vent3Port, vent3Pin, vent3Neg);
          break;
        case 4:
          Setoutpin(vent4Port, vent4Pin, vent4Neg);
          break;
      }
      lastState = newState;
    }
    
    // ================================================================================================
    
    #Events
    
    // ================================================================================================
    
    // =============== Constants
    
    const int vent1Port = 2;                                                        // Port number of vent 1
    const int vent1Pin = 2;                                                         // Pin number of vent 1
    const bool vent1Neg = false;                                                    // Invert pin of vent 1
    
    const int vent2Port = 2;                                                        // Port number of vent 2
    const int vent2Pin = 3;                                                         // Pin number of vent 2
    const bool vent2Neg = false;                                                    // Invert pin of vent 2
    
    const int vent3Port = 2;                                                        // Port number of vent 3
    const int vent3Pin = 4;                                                         // Pin number of vent 3
    const bool vent3Neg = false;                                                    // Invert pin of vent 3
    
    const int vent4Port = 2;                                                        // Port number of vent 4
    const int vent4Pin = 5;                                                         // Pin number of vent 4
    const bool vent4Neg = false;                                                    // Invert pin of vent 4
    
    const double lim0 = 0.0;                                                        // Zone limits
    const double lim1 = 1000.0;
    const double lim2 = 2000.0;
    const double lim3 = 3000.0;
    const double lim4 = 4000.0;
    
    const int RunLED = 19;                                                          // On when code is running
    
    // =============== Static variables
    
    static int lastState = 0;
    
    // =============== Set/Clr output
    
    void Setoutpin(int port, int pin, bool neg)
    {
      if (neg)
        exec.Clroutpin(port, pin);
      else
        exec.Setoutpin(port, pin);
    }
    
    void Clroutpin(int port, int pin, bool neg)
    {
      if (neg)
        exec.Setoutpin(port, pin);
      else
        exec.Clroutpin(port, pin);
    }
    Im not sure this will solve the problem, when i do things like rip cut the vents wont open? If i understand correctly

    Sent from my SM-G920I using Tapatalk

  6. #6
    Join Date
    Apr 2014
    Posts
    59

    Re: open and close suction vents

    Sorry, I don't know what is "rip cut". I thought you only need the vents while running. If you write some more details of what you need, then I can modify this macro.

  7. #7
    Join Date
    Mar 2010
    Posts
    813

    Re: open and close suction vents

    Quote Originally Posted by dezsoe View Post
    Sorry, I don't know what is "rip cut". I thought you only need the vents while running. If you write some more details of what you need, then I can modify this macro.
    Guessing what he means is cutting along the X axis. Obviously the macro you provided is easily editable and you can only guess how his table/vent ports are setup.

    "Thank you Dezsoe" I copied and saved for future reference.

    Dan

  8. #8
    Join Date
    Apr 2014
    Posts
    59

    Re: open and close suction vents

    He can cut along the X axis. If the Y is in the given ranges the vent will be on. Maybe, he wants to cut with MDI commands or manual jog. It can be enabled, of course, but I thought, it's not important to run the vent while no code is running.

  9. #9
    Join Date
    Mar 2010
    Posts
    813

    Re: open and close suction vents

    Quote Originally Posted by dezsoe View Post
    He can cut along the X axis. If the Y is in the given ranges the vent will be on. Maybe, he wants to cut with MDI commands or manual jog. It can be enabled, of course, but I thought, it's not important to run the vent while no code is running.
    Yes I see that, what vent is open is dependent on Y position, I was just pointing out that its easily editable to adjust.
    Makes perfect sense to me only activate when Gcode is running.

    I was also trying to subtly point out he could of been more appreciative you taking your time to write it..

  10. #10
    Join Date
    Aug 2007
    Posts
    55

    Re: open and close suction vents

    Ive pretty much solved this by having a homing routine then having a macro running to enable disable the output given on the x and y position.

  11. #11
    Join Date
    Mar 2010
    Posts
    813

    Re: open and close suction vents

    Quote Originally Posted by jrslick22 View Post
    Ive pretty much solved this by having a homing routine then having a macro running to enable disable the output given on the x and y position.
    Not going to post your macro solution that could help others??

  12. #12
    Join Date
    Apr 2014
    Posts
    59

    Re: open and close suction vents

    Quote Originally Posted by jrslick22 View Post
    Ive pretty much solved this by having a homing routine then having a macro running to enable disable the output given on the x and y position.
    :idea: Nice! That is what my macro does. The only difference is that the request was to check only the Y axis.

  13. #13
    Join Date
    Aug 2007
    Posts
    55

    Re: open and close suction vents

    the dude who did the work for me did it on the condition that I protected his I.P. happy to point people in the right direction tho

  14. #14
    Join Date
    Mar 2010
    Posts
    813

    Re: open and close suction vents

    Quote Originally Posted by jrslick22 View Post
    the dude who did the work for me did it on the condition that I protected his I.P. happy to point people in the right direction tho
    OK Np, If anyone similar to your needs can just use the macro Dezsoe posted... it works well.

    Dan

Similar Threads

  1. Chuck open close
    By Imperial Sewing in forum Mitsubishi controls
    Replies: 0
    Last Post: 07-11-2016, 07:02 PM
  2. Carbon Fiber, Fiberglass, Plastic Vents. Open to materials
    By Mlewin in forum North America RFQ's
    Replies: 0
    Last Post: 04-20-2016, 08:00 PM
  3. Chuck open/close M-codes on 6T-B
    By L98FIERO in forum Fanuc
    Replies: 35
    Last Post: 01-03-2013, 02:01 AM
  4. Verify door close and open on Fanuc 21 t
    By gtrrpa in forum Fanuc
    Replies: 11
    Last Post: 08-19-2010, 04:38 PM
  5. Open and close while running HL-2 chuck??
    By acrodave in forum Haas Lathes
    Replies: 5
    Last Post: 08-14-2009, 05:29 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •