@@ -591,7 +591,6 @@ public void writeJobCode(LaserJob job, ProgressListener pl) throws IOException {
591591
592592    for  (JobPart  p  : job .getParts ())
593593    {
594-       float  focus ;
595594      boolean  engrave  = false ;
596595
597596      if  ((p  instanceof  RasterPart ) || (p  instanceof  Raster3dPart ))
@@ -651,13 +650,27 @@ public void writeJobCode(LaserJob job, ProgressListener pl) throws IOException {
651650            {
652651              LaserProperty  pr  = cmd .getProperty ();
653652              FloatMinMaxPowerSpeedFocusFrequencyProperty  prop  = (FloatMinMaxPowerSpeedFocusFrequencyProperty ) pr ;
653+               float  focus  = prop .getFocus ();
654654              if  (first_prop ) {
655655                first_prop  = false ;
656656                currentMinPower  = cmd_layer_percent ("c631" , part_number , currentMinPower , prop .getMinPower ());
657657                currentMaxPower  = cmd_layer_percent ("c632" , part_number , currentMaxPower , prop .getPower ());
658658                  // prop speed is in %, ruida speed is in mm/s (0..1000) 
659659                currentSpeed  = cmd_layer_absoluteMM ("c904" , part_number , currentSpeed , prop .getSpeed () * getMaxVectorCutSpeed () / 100 );
660-                 // focus - n/a 
660+ 
661+                 // negative focus is not applicable on the test device (uses 6442s) 
662+                 if  (focus  <= 0 ) {
663+                   focus  = 0 ;
664+                 }
665+ 
666+                 // configure axis velocity, affects move speed of Z axis 
667+                 stream .hex ("c903" ).absoluteMM (5 );
668+                 // move Z axis to desired focus valueu 
669+                 // the value depends on the device 
670+                 // on an OMTech Polar, for instance, focus needs to be set to 17 - <thickness> 
671+                 // for instance, for a 3mm thick material, one needs to configure a focus of 14.0 
672+                 stream .hex ("800B" ).absoluteMM (focus );
673+ 
661674                // frequency 
662675                stream .hex ("c660" ).byteint (part_number ).hex ("00" ).longint (prop .getFrequency ());
663676                // color - red for now 
@@ -690,6 +703,11 @@ public void writeJobCode(LaserJob job, ProgressListener pl) throws IOException {
690703      currentSpeed  = -1 ;
691704    }
692705
706+     // configure axis velocity, affects move speed of Z axis 
707+     stream .hex ("c903" ).absoluteMM (5 );
708+     // move Z axis back to 0 
709+     stream .hex ("800B" ).absoluteMM (0 );
710+ 
693711    /* work interval */ 
694712    stream .hex ("DA010620" ).longint (travel_distance ).longint (travel_distance );
695713    /* stop */ 
0 commit comments