Nozzletip scripting

80 views
Skip to first unread message

Jim

unread,
Nov 23, 2019, 7:36:33 AM11/23/19
to OpenPnP
Normally when a job is done and you restart job then actual loaded nozzletips will be used.

I prefer starting job with small nozzles and made a script for it.

Maybe someone could use it.


// Job.Finished.js
//
// loads desired nozzletips when job done

var imports = new JavaImporter(org.openpnp.spi.machine);
with (imports) {

   
function CheckNT (nozzle, nozzlename, nozzletipname) {
       
var nn = nozzle.getName();
       
if (nn == nozzlename) {
           
var result = "#  Nozzle: " + nn + " -> ";
           
var nt = nozzle.getNozzleTip();
           
var ntn = nt.getName();
            result
+= ntn;
           
var changed = false;
           
if (ntn == nozzletipname) {
                result
+= " -> OK";
               
} else {
                   
for each (var nozzletip in machine.getNozzleTips()) {
                        ntn1
= nozzletip.getName();
                       
if (ntn1 == nozzletipname) {
                        nozzle
.loadNozzleTip(nozzletip);
                        changed
= true;
                       
break;
                   
}    
               
}
               
if (changed) {
                    result
+= " -> changed to " + ntn1;
               
} else {
                    result
+= " -> not changed!";
               
}
           
}
           
print (result);
       
}
   
}

   
// Head One
   
var head = machine.getHead("One");
   
print("##################################################################");
   
print("#  Head: " + head.getName());
   
for each (var nozzle in head.getNozzles()) {
       
// First Nozzle
       
CheckNT(nozzle, "Left", "502a");
       
// Second Nozzle
       
CheckNT(nozzle, "Right", "502b");
   
}
   
print("##################################################################");

}



In the logfile it might look like this:

2019-11-23 12:26:20.004 ReferenceFiducialLocator INFO: Fiducial results: scale (0.9999941259118006, 1.0005782615410312), translate (274.3583280548599, 46.52800205424256), shear (1.895372458915051E-4, 1.7144306518868113E-4)
2019-11-23 12:52:39.625 ReferencePnpJobProcessor$Finish INFO: Job finished 1074 parts in 1,591.4 sec. This is 2,429.6 CPH
2019-11-23 12:52:39.654 SystemLogger INFO: ##################################################################
2019-11-23 12:52:39.655 SystemLogger INFO: #  Head: One
2019-11-23 12:52:55.067 SystemLogger INFO: #  Nozzle: Left -> 505a -> changed to 503a
2019-11-23 12:53:10.678 SystemLogger INFO: #  Nozzle: Right -> 506a -> changed to 503b
2019-11-23 12:53:10.679 SystemLogger INFO: ##################################################################
2019-11-23 12:53:10.679 ReferencePnpJobProcessor$Finish INFO: Errored Placements:






Reply all
Reply to author
Forward
0 new messages