Skip to content

Commit

Permalink
refinement of Art function
Browse files Browse the repository at this point in the history
  • Loading branch information
im-pro-at committed Oct 4, 2016
1 parent f66f9a5 commit 278e8a2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
16 changes: 10 additions & 6 deletions src/cnc/gcode/controller/JPanelArt.java
Original file line number Diff line number Diff line change
Expand Up @@ -843,8 +843,7 @@ protected CNCCommand[] doInBackground() throws Exception {
g2.translate(img.getWidth()/2,img.getHeight()/2);
g2.rotate(Math.PI/180*pa);

//g2.scale(zoom*(pxm?-1:1), zoom*(pym?-1:1));
g2.scale(zoom, zoom);
g2.scale(zoom*(pxm?-1:1), zoom*(pym?-1:1));
g2.translate(-img.getWidth()/2,-img.getHeight()/2);

g2.drawImage(img, 0, 0, null);
Expand Down Expand Up @@ -967,37 +966,42 @@ protected CNCCommand[] doInBackground() throws Exception {
LinkedList<CNCCommand> cmds = new LinkedList<>();

//Init CNC
cmds.add(CNCCommand.getStartCommand());
//cmds.add(CNCCommand.getStartCommand()); will be added in CNCMilling
cmds.add(new CNCCommand("G0 X"+Tools.dtostr(px)+" Y"+Tools.dtostr(py)+" F"+Tools.dtostr(a.ftravel)));
cmds.add(new CNCCommand("G0 Z"+Tools.dtostr(a.zsave)+" F"+Tools.dtostr(a.ftravel)));

//Start Spindel
cmds.add(new CNCCommand("M4"));

boolean down=false;
int count=0;
double lastz=a.zsave;
for(ArrayList<Point> path:paths)
{
for(Point p:path){
//calc pos:
Point2D.Double ap = new Point2D.Double(px+pxw/pointsx*p.x, py+pyw/pointsy*p.y);

if(!boarder.contains(ap)){
if(!boarder.contains(ap) || (z[p.x][p.y]>=a.zsave && lastz>=a.zsave)){
if(down){
cmds.add(new CNCCommand("G0 Z"+Tools.dtostr(a.zsave)+" F"+Tools.dtostr(a.ftravel)));
if(Math.abs(lastz-a.zsave)>0.0001){
cmds.add(new CNCCommand("G0 Z"+Tools.dtostr(a.zsave)+" F"+Tools.dtostr(a.ftravel)));
}
down=false;
}
}
else
{
if(!down){
cmds.add(new CNCCommand("G0 X"+Tools.dtostr(ap.x)+" Y"+Tools.dtostr(ap.y)+" F"+Tools.dtostr(a.ftravel)));
cmds.add(new CNCCommand("G1 Z"+Tools.dtostr(z[p.x][p.y])+" F"+Tools.dtostr(a.fmill)));
cmds.add(new CNCCommand("G1 X"+Tools.dtostr(ap.x)+" Y"+Tools.dtostr(ap.y)+" Z"+Tools.dtostr(z[p.x][p.y])+" F"+Tools.dtostr(a.fmill)));
down=true;
}
else{
cmds.add(new CNCCommand("G1 X"+Tools.dtostr(ap.x)+" Y"+Tools.dtostr(ap.y)+" Z"+Tools.dtostr(z[p.x][p.y])+" F"+Tools.dtostr(a.fmill)));
}
}
lastz=z[p.x][p.y];
}
//Move to save height
if(down){
Expand Down
2 changes: 1 addition & 1 deletion src/cnc/gcode/controller/JPanelCNCMilling.java
Original file line number Diff line number Diff line change
Expand Up @@ -1079,8 +1079,8 @@ public void run() {
fireupdateGUI();
}
});
dopause();
}
dopause();

if(cmd.getType() == CNCCommand.Type.ENDPROGRAM && cmds[cmds.length - 1] != cmd)
{
Expand Down
2 changes: 1 addition & 1 deletion src/cnc/gcode/controller/JPanelSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ private void jBSettingsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI
JSettingsDialog.SDouble[] settings= new JSettingsDialog.SDouble[3];
for(int i = 0; i < 3;i++ )
{
settings[i]= new JSettingsDialog.SDouble("Set Size for the " + CommandParsing.axesName[0] + " axis:", DatabaseV2.getWorkspace(i).getsaved());
settings[i]= new JSettingsDialog.SDouble("Set Size for the " + CommandParsing.axesName[i] + " axis:", DatabaseV2.getWorkspace(i).getsaved());
settings[i].setDmin(Double.MIN_VALUE);
}

Expand Down

0 comments on commit 278e8a2

Please sign in to comment.