@@ -582,7 +582,6 @@ public void writeJobCode(LaserJob job, ProgressListener pl) throws IOException {
582582
583583    for  (JobPart  p  : job .getParts ())
584584    {
585-       float  focus ;
586585      boolean  engrave  = false ;
587586
588587      if  ((p  instanceof  RasterPart ) || (p  instanceof  Raster3dPart ))
@@ -642,13 +641,27 @@ public void writeJobCode(LaserJob job, ProgressListener pl) throws IOException {
642641            {
643642              LaserProperty  pr  = cmd .getProperty ();
644643              FloatMinMaxPowerSpeedFocusFrequencyProperty  prop  = (FloatMinMaxPowerSpeedFocusFrequencyProperty ) pr ;
644+               float  focus  = prop .getFocus ();
645645              if  (first_prop ) {
646646                first_prop  = false ;
647647                currentMinPower  = cmd_layer_percent ("c631" , part_number , currentMinPower , prop .getMinPower ());
648648                currentMaxPower  = cmd_layer_percent ("c632" , part_number , currentMaxPower , prop .getPower ());
649649                  // prop speed is in %, ruida speed is in mm/s (0..1000) 
650650                currentSpeed  = cmd_layer_absoluteMM ("c904" , part_number , currentSpeed , prop .getSpeed () * getMaxVectorCutSpeed () / 100 );
651-                 // focus - n/a 
651+ 
652+                 // negative focus is not applicable on the test device (uses 6442s) 
653+                 if  (focus  <= 0 ) {
654+                   focus  = 0 ;
655+                 }
656+ 
657+                 // configure axis velocity, affects move speed of Z axis 
658+                 stream .hex ("c903" ).absoluteMM (5 );
659+                 // move Z axis to desired focus valueu 
660+                 // the value depends on the device 
661+                 // on an OMTech Polar, for instance, focus needs to be set to 17 - <thickness> 
662+                 // for instance, for a 3mm thick material, one needs to configure a focus of 14.0 
663+                 stream .hex ("800B" ).absoluteMM (focus );
664+ 
652665                // frequency 
653666                stream .hex ("c660" ).byteint (part_number ).hex ("00" ).longint (prop .getFrequency ());
654667                // color - red for now 
@@ -681,6 +694,11 @@ public void writeJobCode(LaserJob job, ProgressListener pl) throws IOException {
681694      currentSpeed  = -1 ;
682695    }
683696
697+     // configure axis velocity, affects move speed of Z axis 
698+     stream .hex ("c903" ).absoluteMM (5 );
699+     // move Z axis back to 0 
700+     stream .hex ("800B" ).absoluteMM (0 );
701+ 
684702    /* work interval */ 
685703    stream .hex ("DA010620" ).longint (travel_distance ).longint (travel_distance );
686704    /* stop */ 
0 commit comments