summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradrian-bowyer <adrian-bowyer>2010-01-24 14:17:36 +0000
committeradrian-bowyer <adrian-bowyer@cb376a5e-1013-0410-a455-b6b1f9ac8223>2010-01-24 14:17:36 +0000
commitc5ef04a3ca5784002fa4f2ec7d574323801137fe (patch)
tree80fbf8dfe1db9d1e816bc7398e9069fdd03f89f6
parent292ce4de36c3a5ea2f8328d24a18f614aa0fb80c (diff)
downloadreprap-c5ef04a3ca5784002fa4f2ec7d574323801137fe.tar.gz
reprap-c5ef04a3ca5784002fa4f2ec7d574323801137fe.zip
Multiple prints of single objects added to load function.
git-svn-id: https://reprap.svn.sourceforge.net/svnroot/reprap@3451 cb376a5e-1013-0410-a455-b6b1f9ac8223
-rw-r--r--trunk/users/adrian/host/src/org/reprap/gui/Panel3D.java156
-rw-r--r--trunk/users/adrian/host/src/org/reprap/gui/PreviewPanel.java291
-rw-r--r--trunk/users/adrian/host/src/org/reprap/gui/PreviewWindow.java63
-rw-r--r--trunk/users/adrian/host/src/org/reprap/gui/Previewer.java17
-rw-r--r--trunk/users/adrian/host/src/org/reprap/gui/RepRapBuild.java73
-rw-r--r--trunk/users/adrian/host/src/org/reprap/gui/STLObject.java2
6 files changed, 146 insertions, 456 deletions
diff --git a/trunk/users/adrian/host/src/org/reprap/gui/Panel3D.java b/trunk/users/adrian/host/src/org/reprap/gui/Panel3D.java
index 5db22c51..ddd4acb1 100644
--- a/trunk/users/adrian/host/src/org/reprap/gui/Panel3D.java
+++ b/trunk/users/adrian/host/src/org/reprap/gui/Panel3D.java
@@ -408,84 +408,84 @@ abstract public class Panel3D extends JPanel {
c3d.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}
- protected void addBlock(BranchGroup root, Appearance appearance,
- double x1, double y1, double z1,
- double x2, double y2, double z2,
- float width, float height) {
- root.addChild(addRectangularSegment(appearance, x1, y1, z1, x2, y2, z2, width, height));
- }
-
- protected void addBlock(TransformGroup root, Appearance appearance,
- double x1, double y1, double z1,
- double x2, double y2, double z2,
- float width, float height) {
- root.addChild(addRectangularSegment(appearance, x1, y1, z1, x2, y2, z2, width, height));
- }
-
- protected TransformGroup addRectangularSegment(Appearance appearance,
- double x1, double y1, double z1,
- double x2, double y2, double z2,
- float width, float height) {
-
- z1 += width / 2.0;
- z2 += width / 2.0;
-
- Point3d p1 = new Point3d(x1, y1, z1);
- //Point3d p2 = new Point3d(x2, y2, z2);
-
- Vector3d unity = new Vector3d(0, 1, 0);
- Vector3d v = new Vector3d(x2 - x1, y2 - y1, z2 - z1);
-
- Primitive segment = new Box(width, (float)v.length() / 2.0f, height, appearance);
-
- Transform3D transform = new Transform3D();
-
- Vector3d translate = new Vector3d(p1);
- v.scale(0.5);
- translate.add(v);
- transform.setTranslation(translate);
-
- double angle = v.angle(unity);
- Vector3d axis = new Vector3d();
- axis.cross(unity, v);
- AxisAngle4d rotationAngle = new AxisAngle4d(axis.x, axis.y, axis.z, angle);
- transform.setRotation(rotationAngle);
-
- TransformGroup tg = new TransformGroup(transform);
- tg.addChild(segment);
- return tg;
- }
-
- protected TransformGroup addCylindricalSegment(Appearance appearance,
- double x1, double y1, double z1,
- double x2, double y2, double z2,
- float thickness) {
-
- Point3d p1 = new Point3d(x1, y1, z1);
- //Point3d p2 = new Point3d(x2, y2, z2);
-
- Vector3d unity = new Vector3d(0, 1, 0);
- Vector3d v = new Vector3d(x2 - x1, y2 - y1, z2 - z1 + thickness / 2.0);
-
- Primitive segment = new Cylinder(thickness, (float)v.length(), appearance);
-
- Transform3D transform = new Transform3D();
-
- Vector3d translate = new Vector3d(p1);
- v.scale(0.5);
- translate.add(v);
- transform.setTranslation(translate);
-
- double angle = v.angle(unity);
- Vector3d axis = new Vector3d();
- axis.cross(unity, v);
- AxisAngle4d rotationAngle = new AxisAngle4d(axis.x, axis.y, axis.z, angle);
- transform.setRotation(rotationAngle);
-
- TransformGroup tg = new TransformGroup(transform);
- tg.addChild(segment);
- return tg;
- }
+// protected void addBlock(BranchGroup root, Appearance appearance,
+// double x1, double y1, double z1,
+// double x2, double y2, double z2,
+// float width, float height) {
+// root.addChild(addRectangularSegment(appearance, x1, y1, z1, x2, y2, z2, width, height));
+// }
+//
+// protected void addBlock(TransformGroup root, Appearance appearance,
+// double x1, double y1, double z1,
+// double x2, double y2, double z2,
+// float width, float height) {
+// root.addChild(addRectangularSegment(appearance, x1, y1, z1, x2, y2, z2, width, height));
+// }
+//
+// protected TransformGroup addRectangularSegment(Appearance appearance,
+// double x1, double y1, double z1,
+// double x2, double y2, double z2,
+// float width, float height) {
+//
+// z1 += width / 2.0;
+// z2 += width / 2.0;
+//
+// Point3d p1 = new Point3d(x1, y1, z1);
+// //Point3d p2 = new Point3d(x2, y2, z2);
+//
+// Vector3d unity = new Vector3d(0, 1, 0);
+// Vector3d v = new Vector3d(x2 - x1, y2 - y1, z2 - z1);
+//
+// Primitive segment = new Box(width, (float)v.length() / 2.0f, height, appearance);
+//
+// Transform3D transform = new Transform3D();
+//
+// Vector3d translate = new Vector3d(p1);
+// v.scale(0.5);
+// translate.add(v);
+// transform.setTranslation(translate);
+//
+// double angle = v.angle(unity);
+// Vector3d axis = new Vector3d();
+// axis.cross(unity, v);
+// AxisAngle4d rotationAngle = new AxisAngle4d(axis.x, axis.y, axis.z, angle);
+// transform.setRotation(rotationAngle);
+//
+// TransformGroup tg = new TransformGroup(transform);
+// tg.addChild(segment);
+// return tg;
+// }
+//
+// protected TransformGroup addCylindricalSegment(Appearance appearance,
+// double x1, double y1, double z1,
+// double x2, double y2, double z2,
+// float thickness) {
+//
+// Point3d p1 = new Point3d(x1, y1, z1);
+// //Point3d p2 = new Point3d(x2, y2, z2);
+//
+// Vector3d unity = new Vector3d(0, 1, 0);
+// Vector3d v = new Vector3d(x2 - x1, y2 - y1, z2 - z1 + thickness / 2.0);
+//
+// Primitive segment = new Cylinder(thickness, (float)v.length(), appearance);
+//
+// Transform3D transform = new Transform3D();
+//
+// Vector3d translate = new Vector3d(p1);
+// v.scale(0.5);
+// translate.add(v);
+// transform.setTranslation(translate);
+//
+// double angle = v.angle(unity);
+// Vector3d axis = new Vector3d();
+// axis.cross(unity, v);
+// AxisAngle4d rotationAngle = new AxisAngle4d(axis.x, axis.y, axis.z, angle);
+// transform.setRotation(rotationAngle);
+//
+// TransformGroup tg = new TransformGroup(transform);
+// tg.addChild(segment);
+// return tg;
+// }
protected double getScale() {
return 1.0;
diff --git a/trunk/users/adrian/host/src/org/reprap/gui/PreviewPanel.java b/trunk/users/adrian/host/src/org/reprap/gui/PreviewPanel.java
deleted file mode 100644
index fab44324..00000000
--- a/trunk/users/adrian/host/src/org/reprap/gui/PreviewPanel.java
+++ /dev/null
@@ -1,291 +0,0 @@
-// Obsolete - to be removed at some point. - AB
-
-
-//package org.reprap.gui;
-//
-//import javax.media.j3d.AmbientLight;
-//import javax.media.j3d.Background;
-//import javax.media.j3d.Bounds;
-//import javax.media.j3d.BranchGroup;
-//import javax.media.j3d.DirectionalLight;
-//import javax.media.j3d.Group;
-//import javax.media.j3d.TransformGroup;
-//import javax.media.j3d.ViewPlatform;
-//import javax.swing.JFrame;
-//import javax.vecmath.Color3f;
-//
-//import org.reprap.Printer;
-//
-////import javax.vecmath.Vector3d;
-//
-//public class PreviewPanel extends Panel3D implements Previewer {
-// private static final long serialVersionUID = 1L;
-// private Printer reprap;
-//// private Extruder extruder = null;
-// @SuppressWarnings("unused")
-// private double previousZ = Double.NaN;
-// private BranchGroup extrusionsNew;
-// private BranchGroup extrusionsOld = null;
-// private BranchGroup lowerShell = null;
-//
-// @SuppressWarnings("unused")
-// private StatusMessage statusWindow;
-//
-//// private double extrusionSize = 1.0;
-//// private double extrusionHeight = 1.0;
-//
-// /**
-// * Constructor
-// */
-// public PreviewPanel() throws Exception {
-// initialise();
-// statusWindow = new StatusMessage(new JFrame());
-// extrusionsOld = null;
-// lowerShell = null;
-// }
-//
-// /**
-// *
-// */
-// public void setMachine(Printer p) { reprap = p; }
-//
-// /**
-// * Set bg light grey
-// */
-// protected Background createBackground() {
-// Background back = new Background(bgColour);
-// back.setApplicationBounds(createApplicationBounds());
-// return back;
-// }
-//
-// protected BranchGroup createViewBranchGroup(TransformGroup[] tgArray,
-// ViewPlatform vp) {
-// BranchGroup vpBranchGroup = new BranchGroup();
-//
-// if (tgArray != null && tgArray.length > 0) {
-// Group parentGroup = vpBranchGroup;
-// TransformGroup curTg = null;
-//
-// for (int n = 0; n < tgArray.length; n++) {
-// curTg = tgArray[n];
-// parentGroup.addChild(curTg);
-// parentGroup = curTg;
-// }
-//
-// tgArray[tgArray.length - 1].addChild(vp);
-// } else
-// vpBranchGroup.addChild(vp);
-//
-// return vpBranchGroup;
-// }
-//
-// /**
-// * Set stuff up for the constructors - called by all of them that actually
-// * do anything.
-// */
-//
-//
-// /**
-// * Set up the RepRap working volume
-// */
-// protected BranchGroup createSceneBranchGroup() throws Exception {
-// sceneBranchGroup = new BranchGroup();
-//
-// BranchGroup objRoot = sceneBranchGroup;
-//
-// Bounds lightBounds = getApplicationBounds();
-//
-// AmbientLight ambLight = new AmbientLight(true, new Color3f(1.0f, 1.0f,
-// 1.0f));
-// ambLight.setInfluencingBounds(lightBounds);
-// objRoot.addChild(ambLight);
-//
-// DirectionalLight headLight = new DirectionalLight();
-// headLight.setInfluencingBounds(lightBounds);
-// objRoot.addChild(headLight);
-//
-// wv_and_stls.setCapability(Group.ALLOW_CHILDREN_EXTEND);
-// extrusionsNew = new BranchGroup();
-// extrusionsNew.setCapability(Group.ALLOW_CHILDREN_EXTEND);
-// extrusionsNew.setCapability(Group.ALLOW_CHILDREN_WRITE);
-// extrusionsNew.setCapability(BranchGroup.ALLOW_DETACH);
-// wv_and_stls.addChild(extrusionsNew);
-//
-// // Load the STL file for the working volume
-//
-// world = new STLObject(wv_and_stls, worldName);
-//
-// String stlFile = getStlBackground();
-//
-// workingVolume = new STLObject();
-// workingVolume.addSTL(stlFile, wv_offset, wv_app, null);
-// wv_and_stls.addChild(workingVolume.top());
-//
-// // Set the mouse to move everything
-// MouseObject mouse = new MouseObject(getApplicationBounds(), mouse_tf, mouse_zf);
-// mouse.move(world, false);
-//
-// objRoot.addChild(world.top());
-//
-// return objRoot;
-// }
-//
-// /**
-// * Set the current extrusion material (or equivalently, the extruder head)
-// */
-//// public void setMaterial(Extruder ext) {
-//// extruder = ext;
-//// }
-//
-// /**
-// * Called to add a new segment of extruded material to the preview
-// */
-// public void addSegment(double x1, double y1, double z1, double x2, double y2, double z2) {
-//// if (layerPauseCheckbox != null && layerPauseCheckbox.isSelected() &&
-//// z2 != previousZ)
-//// layerPause();
-////
-//// if (segmentPauseCheckbox != null && segmentPauseCheckbox.isSelected())
-//// segmentPause();
-//
-// //if (isCancelled()) return;
-//
-// BranchGroup group = new BranchGroup();
-// group.setCapability(BranchGroup.ALLOW_DETACH);
-// addBlock(group, reprap.getExtruder().getAppearance(),
-// x1, y1, z1,
-// x2, y2, z2,
-// (float)(reprap.getExtruder().getExtrusionSize() * 0.5), (float)(reprap.getExtruder().getExtrusionHeight() * 0.5));
-// extrusionsNew.addChild(group);
-// previousZ = z2;
-// }
-//
-// /**
-// * Clear and prepare for a new preview
-// *
-// */
-// public void reset() {
-// extrusionsNew.removeAllChildren();
-// if(extrusionsOld != null)
-// extrusionsOld.removeAllChildren();
-//
-// if(lowerShell != null)
-// lowerShell.removeAllChildren();
-//
-// extrusionsOld = null;
-// lowerShell = null;
-// previousZ = Double.NaN;
-// //setCancelled(false);
-// }
-//
-//// /**
-//// * Display a message indicating a segment is about to be
-//// * printed and wait for the user to acknowledge
-//// */
-//// private void segmentPause() {
-//// ContinuationMesage msg =
-//// new ContinuationMesage(null, "A new segment is about to be produced",
-//// segmentPauseCheckbox, layerPauseCheckbox);
-//// msg.setVisible(true);
-//// try {
-//// synchronized(msg) {
-//// msg.wait();
-//// }
-//// } catch (Exception ex) {
-//// }
-//// if (msg.getResult() == false)
-//// setCancelled(true);
-//// msg.dispose();
-//// }
-////
-//// /**
-//// * Display a message indicating a layer is about to be
-//// * printed and wait for the user to acknowledge
-//// */
-//// private void layerPause() {
-//// ContinuationMesage msg =
-//// new ContinuationMesage(null, "A new layer is about to be produced",
-//// segmentPauseCheckbox, layerPauseCheckbox);
-//// msg.setVisible(true);
-//// try {
-//// synchronized(msg) {
-//// msg.wait();
-//// }
-//// } catch (Exception ex) {
-//// }
-//// if (msg.getResult() == false)
-//// setCancelled(true);
-//// msg.dispose();
-//// }
-////
-//// /**
-//// * Set the source checkbox used to determine if there should
-//// * be a pause between segments.
-//// *
-//// * @param segmentPause The source checkbox used to determine
-//// * if there should be a pause. This is a checkbox rather than
-//// * a boolean so it can be changed on the fly.
-//// */
-//// public void setSegmentPause(JCheckBoxMenuItem segmentPause) {
-//// segmentPauseCheckbox = segmentPause;
-//// }
-////
-//// /**
-//// * Set the source checkbox used to determine if there should
-//// * be a pause between layers.
-//// *
-//// * @param layerPause The source checkbox used to determine
-//// * if there should be a pause. This is a checkbox rather than
-//// * a boolean so it can be changed on the fly.
-//// */
-//// public void setLayerPause(JCheckBoxMenuItem layerPause) {
-//// layerPauseCheckbox = layerPause;
-//// }
-////
-//// public void setMessage(String message) {
-//// if (message == null)
-//// statusWindow.setVisible(false);
-//// else {
-//// statusWindow.setMessage(message);
-//// statusWindow.setVisible(true);
-//// }
-//// }
-////
-//// public boolean isCancelled() {
-//// return statusWindow.isCancelled();
-//// }
-////
-//// public void setCancelled(boolean isCancelled) {
-//// statusWindow.setCancelled(isCancelled);
-//// }
-//
-// public void setLowerShell(BranchGroup ls)
-// {
-// if(extrusionsOld != null)
-// extrusionsOld.removeAllChildren();
-//
-// if(lowerShell != null)
-// lowerShell.removeAllChildren();
-//
-// extrusionsOld = extrusionsNew;
-//
-// lowerShell = new BranchGroup();
-// BranchGroup subLower = new BranchGroup();
-// if(ls != null)
-// {
-// subLower.addChild(ls);
-// lowerShell.addChild(subLower);
-// }
-// lowerShell.setCapability(BranchGroup.ALLOW_DETACH);
-// lowerShell.setCapability(Group.ALLOW_CHILDREN_WRITE);
-// subLower.setCapability(BranchGroup.ALLOW_DETACH);
-// subLower.setCapability(Group.ALLOW_CHILDREN_WRITE);
-//
-// extrusionsNew = new BranchGroup();
-// extrusionsNew.setCapability(Group.ALLOW_CHILDREN_EXTEND);
-// extrusionsNew.setCapability(Group.ALLOW_CHILDREN_WRITE);
-// extrusionsNew.setCapability(BranchGroup.ALLOW_DETACH);
-// wv_and_stls.addChild(extrusionsNew);
-// wv_and_stls.addChild(lowerShell);
-// }
-//} \ No newline at end of file
diff --git a/trunk/users/adrian/host/src/org/reprap/gui/PreviewWindow.java b/trunk/users/adrian/host/src/org/reprap/gui/PreviewWindow.java
deleted file mode 100644
index 9f7a34e9..00000000
--- a/trunk/users/adrian/host/src/org/reprap/gui/PreviewWindow.java
+++ /dev/null
@@ -1,63 +0,0 @@
-
-// Obsolete - to be removed at some point. - AB
-
-//package org.reprap.gui;
-//import java.awt.BorderLayout;
-//
-//import javax.media.j3d.BranchGroup;
-//import javax.swing.WindowConstants;
-//import org.reprap.Printer;
-//
-//public class PreviewWindow extends javax.swing.JFrame implements Previewer {
-// private static final long serialVersionUID = 1L;
-// private PreviewPanel panel;
-//
-// public PreviewWindow(Printer p) {
-// super();
-// initGUI(p);
-// }
-//
-// private void initGUI(Printer p) {
-// try {
-// panel = new PreviewPanel();
-// panel.setMachine(p);
-// getContentPane().add(panel, BorderLayout.CENTER);
-// setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
-// pack();
-// setSize(500, 350);
-//
-// } catch (Exception e) {
-// e.printStackTrace();
-// }
-// }
-//
-// public void setMachine(Printer p) {
-// panel.setMachine(p);
-// }
-//
-// public void addSegment(double x1, double y1, double z1,
-// double x2, double y2, double z2) {
-// panel.addSegment(x1, y1, z1, x2, y2, z2);
-// }
-//
-//// public void setMessage(String message) {
-//// panel.setMessage(message);
-//// }
-////
-//// public boolean isCancelled() {
-//// return panel.isCancelled();
-//// }
-//
-// public void reset() {
-// panel.reset();
-// }
-//
-//// public void setCancelled(boolean isCancelled) {
-//// panel.setCancelled(isCancelled);
-//// }
-//
-// public void setLowerShell(BranchGroup ls)
-// {
-// panel.setLowerShell(ls);
-// }
-//}
diff --git a/trunk/users/adrian/host/src/org/reprap/gui/Previewer.java b/trunk/users/adrian/host/src/org/reprap/gui/Previewer.java
deleted file mode 100644
index fbfc9c05..00000000
--- a/trunk/users/adrian/host/src/org/reprap/gui/Previewer.java
+++ /dev/null
@@ -1,17 +0,0 @@
-//package org.reprap.gui;
-//
-//import javax.media.j3d.BranchGroup;
-//
-//import org.reprap.Printer;
-//
-//public interface Previewer {
-//
-// public void setMachine(Printer p);
-// public void addSegment(double x1, double y1, double z1,
-// double x2, double y2, double z2);
-// //public void setMessage(String message);
-// public void reset();
-// //public boolean isCancelled();
-// //public void setCancelled(boolean isCancelled);
-// public void setLowerShell(BranchGroup ls);
-//}
diff --git a/trunk/users/adrian/host/src/org/reprap/gui/RepRapBuild.java b/trunk/users/adrian/host/src/org/reprap/gui/RepRapBuild.java
index 43eb0d12..ba44e0e9 100644
--- a/trunk/users/adrian/host/src/org/reprap/gui/RepRapBuild.java
+++ b/trunk/users/adrian/host/src/org/reprap/gui/RepRapBuild.java
@@ -92,7 +92,6 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
-import java.util.ArrayList;
import javax.media.j3d.AmbientLight;
import javax.media.j3d.Background;
@@ -104,16 +103,20 @@ import javax.media.j3d.Group;
import javax.media.j3d.Node;
import javax.media.j3d.TransformGroup;
import javax.media.j3d.ViewPlatform;
+
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
+import javax.swing.JTextField;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.SwingConstants;
+
import javax.vecmath.Color3f;
+import javax.vecmath.Vector3d;
import com.sun.j3d.utils.picking.PickCanvas;
import com.sun.j3d.utils.picking.PickResult;
@@ -134,6 +137,9 @@ class MaterialRadioButtons extends JPanel {
private static final long serialVersionUID = 1L;
private static Attributes att;
private static JFrame frame;
+ private static JTextField copies;
+ private static RepRapBuild rrb;
+ private static int stlIndex;
private MaterialRadioButtons()
{
@@ -143,9 +149,19 @@ class MaterialRadioButtons extends JPanel {
String[] names;
radioPanel = new JPanel(new GridLayout(0, 1));
radioPanel.setSize(300,200);
+
+ JLabel jLabel2 = new JLabel();
+ radioPanel.add(jLabel2);
+ jLabel2.setText(" Number of copies of the object just loaded to print: ");
+ jLabel2.setHorizontalAlignment(SwingConstants.CENTER);
+ copies = new JTextField("1");
+ radioPanel.add(copies);
+ copies.setHorizontalAlignment(SwingConstants.CENTER);
+
+
JLabel jLabel1 = new JLabel();
radioPanel.add(jLabel1);
- jLabel1.setText(" Select the material for the object just loaded ");
+ jLabel1.setText(" Select the material for the object(s): ");
jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
try
@@ -171,7 +187,7 @@ class MaterialRadioButtons extends JPanel {
okButton.setText("OK");
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
- frame.dispose();
+ OKHandler();
}
});
@@ -184,9 +200,21 @@ class MaterialRadioButtons extends JPanel {
ex.printStackTrace();
}
}
+
+ public static void OKHandler()
+ {
+ //System.out.println("Copies: " + copies.getText());
+ int number = Integer.parseInt(copies.getText().trim()) - 1;
+ STLObject stl = rrb.getSTLs().get(stlIndex);
+ rrb.moreCopies(stl, att, number);
+ frame.dispose();
+ }
- public static void createAndShowGUI(Attributes a) {
+ public static void createAndShowGUI(Attributes a, RepRapBuild r, int index)
+ {
att = a;
+ rrb = r;
+ stlIndex = index;
//Create and set up the window.
frame = new JFrame("Material selector");
frame.setLocation(500, 400);
@@ -213,6 +241,10 @@ class MaterialRadioButtons extends JPanel {
*/
public class RepRapBuild extends Panel3D implements MouseListener {
+
+
+
+
private static final long serialVersionUID = 1L;
private MouseObject mouse = null;
private PickCanvas pickCanvas = null; // The thing picked by a mouse click
@@ -386,7 +418,8 @@ public class RepRapBuild extends Panel3D implements MouseListener {
// Callback for when the user selects an STL file to load
- public void anotherSTLFile(String s) {
+ public void anotherSTLFile(String s)
+ {
if (s == null)
return;
//objectIndex++;
@@ -400,7 +433,35 @@ public class RepRapBuild extends Panel3D implements MouseListener {
wv_and_stls.addChild(stl.top());
stls.add(stl);
}
- MaterialRadioButtons.createAndShowGUI(att);
+ MaterialRadioButtons.createAndShowGUI(att, this, stls.size() - 1);
+ }
+ }
+
+ public void moreCopies(STLObject original, Attributes originalAttributes, int number)
+ {
+ if (number <= 0)
+ return;
+ String fileName = original.fileItCameFrom();
+ Vector3d offset = new Vector3d(original.size());
+ offset.y = 0;
+ offset.z = 0;
+ offset.x += 5;
+ double increment = offset.x;
+ for(int i = 0; i < number; i++)
+ {
+ STLObject stl = new STLObject();
+ Attributes newAtt = stl.addSTL(fileName, offset, original.getAppearance(), null);
+ newAtt.setMaterial(originalAttributes.getMaterial());
+ if(newAtt != null)
+ {
+ // New separate object, or just appended to lastPicked?
+ if(stl.numChildren() > 0)
+ {
+ wv_and_stls.addChild(stl.top());
+ stls.add(stl);
+ }
+ }
+ offset.x += increment;
}
}
diff --git a/trunk/users/adrian/host/src/org/reprap/gui/STLObject.java b/trunk/users/adrian/host/src/org/reprap/gui/STLObject.java
index 976fc9c0..82576642 100644
--- a/trunk/users/adrian/host/src/org/reprap/gui/STLObject.java
+++ b/trunk/users/adrian/host/src/org/reprap/gui/STLObject.java
@@ -111,7 +111,7 @@ public class STLObject
private Vector3d size = null; // X, Y and Z extent
private BoundingBox bbox = null; // Temporary storage for the bounding box while loading
private Vector3d rootOffset = null; // Offset of the first-loaded STL under stl
- private String sourceFile = null;
+ private String sourceFile = null; // The STL file I was laded from
public STLObject()