1. Hey guyz. Welcome to the All New Phlatforum!



    Sign Up and take a look around. There are so many awesome new features.

    The Phlatforum is a place we can all hang out and

    have fun sharing our RC adventures!

  2. Dismiss Notice

Hot wire cut constant chord wings from Phlatscript

Discussion in 'SketchUcam Related Software' started by swarfer, Aug 21, 2013.

  1. swarfer

    swarfer Moderator Staff Member

    Offline
    Messages:
    808
    Trophy Points:
    28
    Location:
    Grahamstown, South Africa
    My humming brain has produced a small bit of software....

    I recall seeing a hot wire bow attached to a MK3 head cannot find that post now though.
    But any gantry machine can do this I think, attach a hot wire bow to the head so that Y movement will pull the wire through the foam.

    Now draw your constant chord aerofoil shape as in this image, trailing edge down, top surface to the right.
    [​IMG]
    [​IMG]

    Apply an outside cut to it.
    Generate the Gcode.

    Now the tricky bit, you need PHP installed, the command line processor. Google it, you need the Windows package.

    Now you can run the attached file against the gcode you generated, so in a 'Command prompt'

    Code:
    php wing.php gcode_out.nc > wing.nc
    which takes input from 'gcode_out.nc' and outputs it to 'wing.nc'

    wing.nc now contains Gcode that moves Z instead of X, and Y as usual.
    Set the wire at the bottom front corner of the foam, it will start cutting from there, hopefully doing the top surface first. IF it doesn't, you need to turn 'overhead gantry' on or off (opposite what it was) and regenerate the Gcode.

    You can do tapered wings by tethering one end of the wire to the table and having the head move the other end only. Good luck with the figuring out of the taper ratio and the wire length needed etc. (-:
    You will need a spring to keep the tension.

    hohum, cannot upload a .php file, just save the code in the next block to wing.php
    Code:
    <?php
    // To select between a MK3 and another gantry mill, put // before the line you DONT want
    // This code has been tested against Gcode generated by the TRUEPLUNGE extensions, 
    // if you don't have that, test the cut on air then scrap before committing.
    // The extensions optimize the cut start point to be the nearest to the origin.
    
    //$mk3 = true;   // use this if you have a PhlatPrinter Mk3, cut in X-Z
    $mk3 = false;  // use this if you have an ordinary gantry mill, cut in Y-Z
    // choose one of the above
    $feed = 100;
    $input = file($argv[1]);
    $cnt = 0;
    $firstz = true;
    foreach ($input as $line)
       {
       if (preg_match('/\(|G90|M3|\%/',$line))
          {
             // find the material thickness
          if (preg_match('/Material Thickness/',$line)         )
             {
             $bits = preg_split('/[ ]+|\)/',trim($line));   
             if ($bits[2] == '~')
                $idx = 3;
             else
                $idx = 2;
             $mat = preg_replace('/mm|"/','',$bits[$idx]);
             unset($bits);
             }           
    // find feed rate from header      
          if (preg_match('/\(Feed rate/',$line)         )
             {
             $bits = preg_split('/[ ]+|\)/',trim($line));   
             if ($bits[2] == '~')
                $idx = 3;
             else
                $idx = 2;
             $feed = preg_replace('/mm|"|\/min/','',$bits[$idx]);
             unset($bits);   
             }
             
          if (preg_match('/X0 Y0/',$line))
             if ($mk3)
                $line = "G01 Z$mat X0 f". $feed . "\n";   
             else
                $line = "G01 Z$mat Y0 f" . $feed . "\n";   
          if (preg_match('/G90/',$line))   
             {
             print "(WIRE CUT)\n";
             if ($mk3)
                print "(MK3)\n";
             }
          print $line;
          continue;
          }
       if (preg_match('/Z/',$line))
          {
          if ($firstz)
             {
             if ($mk3)
                print "G01 Z$mat X0 F$feed\n";   
             else
                print "G01 Z$mat Y0 F$feed\n";   
             $firstz =false;
             }   
             // ignore these lines
          continue;
          }
       if (preg_match('/X|Y/',$line))
          {
          $bits = preg_split('/[ ]+/',$line);
          if ($mk3)  
             {       
             $line = preg_replace('/X/','z',$line)   ;
             $line = preg_replace('/Y/','x',$line)    ;
             $bits = preg_split('/[ ]+/',$line);
             }
          else
             $bits[1] = preg_replace('/X/','Z',$bits[1]);
          if ($bits[0] == '')
            $bits[0] = 'G01 ';
             
          foreach($bits as $bit)
             print $bit . " ";
          $cnt++;         
          continue;
          }   
       }
    ?>
    UPDATED: now works with MK3 and a normal gantry.
     
  2. kram242

    kram242 Administrator Staff Member

    Offline
    Messages:
    6,311
    Trophy Points:
    13
    Location:
    NJ
    WOW :twitch: This is amazing Swarfer! :twitch: :doubleup:
    Sorry that we can't upload I am still trying to figure out why.
     
  3. swarfer

    swarfer Moderator Staff Member

    Offline
    Messages:
    808
    Trophy Points:
    28
    Location:
    Grahamstown, South Africa
    I'm hoping someone who can get to a machine quicker than I can and test it will let us all benefit from the experience by giving us detailed test results.

    I can also add that in mk3 mode you zero the wire at 'bottom of foam' but start with the wire ABOVE the foam, it will feed down to the trailing edge of the wing, and at the end of the cut will feed back up to 'material thickness' and X0, so make sure you set the material thickness correctly before generating the Gcode.

    If this code is successful I'll add it to my growing list of options to put into sketchUcam (-: We'll need a bigger options menu soon....
     
  4. swarfer

    swarfer Moderator Staff Member

    Offline
    Messages:
    808
    Trophy Points:
    28
    Location:
    Grahamstown, South Africa
  5. kram242

    kram242 Administrator Staff Member

    Offline
    Messages:
    6,311
    Trophy Points:
    13
    Location:
    NJ
    :doubleup:


     

Share This Page