fix normals for vertices
- now stl output can be porcessed directly by slic3r without intermediate fix wihtin blender - created Wall3dStream instead of keeping all within Wall3d - can save only stl output ( 'Save stl' )
This commit is contained in:
@@ -33,6 +33,7 @@ import javax.swing.event.ChangeListener;
|
||||
|
||||
import org.artisanlogiciel.games.*;
|
||||
import org.artisanlogiciel.games.stl.Wall3d;
|
||||
import org.artisanlogiciel.games.stl.Wall3dStream;
|
||||
import org.artisanlogiciel.util.UTF8Control;
|
||||
|
||||
import org.artisanlogiciel.graphics.Drawing;
|
||||
@@ -332,7 +333,7 @@ public class Display extends JFrame {
|
||||
final JButton saveSvgButton = new JButton(labels.getString("save") + " svg");
|
||||
Action saveSvgAction = new AbstractAction() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
writeSentence("save png");
|
||||
writeSentence("save svg");
|
||||
setMazeName(saveName.getText());
|
||||
saveSvg();
|
||||
}
|
||||
@@ -359,12 +360,25 @@ public class Display extends JFrame {
|
||||
}
|
||||
};
|
||||
saveImcButton.addActionListener(saveImcAction);
|
||||
final JButton saveStlButton = new JButton(labels.getString("save") + " stl");
|
||||
Action saveStlAction = new AbstractAction() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
//
|
||||
System.out.println("save stl");
|
||||
setMazeName(saveName.getText());
|
||||
MazeParamsFixed p = (MazeParamsFixed) params;
|
||||
saveStl(p, model);
|
||||
}
|
||||
};
|
||||
saveStlButton.addActionListener(saveStlAction);
|
||||
|
||||
|
||||
JMenu saveMenu = new JMenu("Save");
|
||||
saveMenu.add(saveName);
|
||||
saveMenu.add(saveSvgButton);
|
||||
saveMenu.add(savePngButton);
|
||||
saveMenu.add(saveButton);
|
||||
saveMenu.add(saveStlButton);
|
||||
saveMenu.add(saveImcButton);
|
||||
|
||||
return saveMenu;
|
||||
@@ -997,6 +1011,24 @@ public class Display extends JFrame {
|
||||
Display display = new Display(model, W, H, params);
|
||||
}
|
||||
|
||||
public static void saveStl(MazeParamsFixed params, LabyModel model) {
|
||||
File outfile = new File(params.getSaveDir(), params.getName() + ".stl");
|
||||
if (!outfile.exists()) {
|
||||
System.out.println("Saving to " + outfile + " ...");
|
||||
try {
|
||||
FileOutputStream out = new FileOutputStream(outfile);
|
||||
new Wall3dStream(params.getName(), model, out, false).stream(10,10,10);
|
||||
out.close();
|
||||
System.out.println("... Done.");
|
||||
} catch (IOException io) {
|
||||
io.printStackTrace(System.err);
|
||||
}
|
||||
} else {
|
||||
System.out.println("" + outfile + " already exists");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void save(MazeParamsFixed params, LabyModel model) {
|
||||
File outfile = new File(params.getSaveDir(), params.getName() + ".raw");
|
||||
if (!outfile.exists()) {
|
||||
@@ -1013,24 +1045,9 @@ public class Display extends JFrame {
|
||||
} else {
|
||||
System.out.println("" + outfile + " already exists");
|
||||
}
|
||||
outfile = new File(params.getSaveDir(), params.getName() + ".stl");
|
||||
if (!outfile.exists()) {
|
||||
System.out.println("Saving to " + outfile + " ...");
|
||||
try {
|
||||
FileOutputStream out = new FileOutputStream(outfile);
|
||||
Wall3d.streamWallsOut(params.getName(), model, out);
|
||||
out.flush();
|
||||
out.close();
|
||||
System.out.println("... Done.");
|
||||
} catch (IOException io) {
|
||||
io.printStackTrace(System.err);
|
||||
}
|
||||
} else {
|
||||
System.out.println("" + outfile + " already exists");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void main(String pArgs[]) {
|
||||
LabyModel model = null;
|
||||
int W = 600;
|
||||
|
||||
Reference in New Issue
Block a user