ZBoylan / 3DPrinterUI

CS 350 - UI team
0 stars 0 forks source link

Checklist for Slicing #2

Closed zbhujwala closed 6 years ago

zbhujwala commented 6 years ago

Printer Settings

Slicer Settings

ZBoylan commented 6 years ago

For the input box to place the path to the file after the user has selected the file, it does not seem that there is a member function for that GUI element (GTextField) to get its text value that it holds. http://www.lagers.org.uk/g4p/ref/classg4p__controls_1_1_g_text_field.html#ab16fb51f759d643e2aafc066f28929a3 We may need to use another GUI element

The GTextArea has two functions - getText and getTextAsArray. Plus, it has setText so we can set it to the file path. http://www.lagers.org.uk/g4p/ref/classg4p__controls_1_1_g_text_area.html#a622e64a7f9f17755b7433c93ad9b377f

peralta013 commented 6 years ago

I figured out how to choose a file and set the file path to a variable (String STLFile) then display the selected path on the main window. `

//Select File
public void searchFileBtn_click(GButton source, GEvent event){
  printIn("searchFileBtn - GButton >> GEvent." + event + "@" + millis());
  selectInput("Select a STL file:", "fileSelected");
}

public void fileSelected(File selection) {
  STLFile = selection.getAbsolutePath();
  fileTextBox.setText(STLFile);
}

//Display Path
public void confirmBtn_click(GButton source, GEvent event) { //_CODE_:confirmBtn:275116:
  println("confirmBtn - GButton >> GEvent." + event + " @ " + millis());
  if (fileTextBox.getText() == STLFile) {
    currentFile.setText(STLFile);
    inputWindow.setVisible(false);
  }

`

I have also completed the Layer Height of the slicer setting where the user can select the value of the height (0-0.4) by using a GSlider.

I am trying to create a new branch to upload my code and then use the pull request but I'm afraid I might delete something important. Can you guys break down the steps for me?

ZBoylan commented 6 years ago

Chris Iossa thought it would be nice to put the contents of the STL file in the box below the choose file box (GTextArea box) after the file was selected.

Steve and Chris want to know if G4P GUI Builder is multithreaded? So if the user hits the print button, the user can still hit the pause or cancel button while the print function is running.

GeorgeVentura commented 6 years ago

Chris Iossa thought it would be nice to put the contents of the STL file in the box below the choose file box (GTextArea box).

we could have a preview button that loads the text, since the stl file could be massive and lag the program when loading a file.

I think that text area was originally for raw g-code, but we could also put that somewhere else, depending on what the purpose is for, (printer testing??)

GeorgeVentura commented 6 years ago

Steve and Chris want to know if G4P GUI Builder is multithreaded? So if the user hits the print button, the user can still hit the pause or cancel button while the print function is running.

I tested it, it's not multithreaded by default; a loop will lock the gui.

But I did get it to work using processing threads ex:

public class Test
{
 public boolean flag = true;
 public int counter = 0;

 void runTest()
 {
   while (flag)
   {
     println(counter);
     counter++;
   }
 }

 void toogle()
 {
    flag = flag ? false : true;
 }

}

gui file:

Test threadTest = new Test();

public void runTest()
{
  threadTest.runTest();
}

public void startSliceBtn_click(GButton source, GEvent event) { //_CODE_:startSliceBtn:735941:
  println("button1 - GButton >> GEvent." + event + " @ " + millis());
  thread("runTest");
}

public void pauseSliceBtn_click(GButton source, GEvent event) { //_CODE_:pauseSliceBtn:624877:
  println("pauseSliceBtn - GButton >> GEvent." + event + " @ " + millis());
  threadTest.toogle();
}
ZBoylan commented 6 years ago

screen shot 2017-11-16 at 9 46 53 pm

ZBoylan commented 6 years ago

Added nozzle diameter and layer size sliders and x, y, z textbooks in the add-Variables branch.

Should layer size be split into top and bottom? With the code in there right now, if you enter values < 1 or > 200, it crashes. We could probably put a label message on there to say "x, y, z range is 1 - 200" or some type of error message to alert user if an invalid number is entered.

ZBoylan commented 6 years ago

DeviceController team has implemented multithreading, so we do not need to anymore.

"the DeviceController class now handles all threading and synchronization needed for printing. When a print job is started, it runs in a separate thread, allowing the UI to issue start/stop commands from the main thread."

ZBoylan commented 6 years ago

Implementing slice code (from Andrew):

//parse STL STLParser parser = new STLParser(); ArrayList facets = parser.parseSTL();

//slice object, including timing the slicing procedure long startTime = millis(); Slicer slice = new Slicer(facets, , 0); ArrayList layers = slice.sliceLayers(); long endTime = millis(); println("\nTotal time: " + (endTime - startTime) + "ms"); println("Total number of layers: " + layers.size());

//draw sliced object size(800, 800); int layerToDraw = ; ArrayList lines = layers.get(layerToDraw).getCoordinates(); for (Line li : lines) { //scale and translate drawn layer (units are in mm and the model is centered around 0) li.x1 = 10; li.y1 = 10; li.x2 = 10; li.y2 = 10;

li.x1 += 400; li.y1 += 400; li.x2 += 400; li.y2 += 400;

line(li.x1, li.y1, li.x2, li.y2); } println("Num lines on drawn layer (" + layerToDraw + "): " + lines.size());

ZBoylan commented 6 years ago

I'm trying to implement this. Doesn't seem like they'll have this done for prototype submission by tomorrow.

Our job - we need to use the slicer functions to create a Model object. Then pass that Model object to the rendering team functions. The rendering team needs the facets and gcode from that object. For the slicing team functions, we need to pass the STL file path, create the facets variable and create the gcode variable. The slicing team still needs to create a function that creates the gcode and store that in a variable for the Model class.

Still in flux, but we may not need to slice the object. The rendering team may call those functions.


int layerToDraw = ; For now, just put a number for one of the layers. It just draws one layer at the moment.

GeorgeVentura commented 6 years ago

I got the renders and slicers code working for rendering stl files. The render team also implemented mouse events for controling the render view, but they don't seem to be working perfect.

a

ZBoylan commented 6 years ago

If I comment out the two lines I just pushed to first-prototype, I get an infinite loop of the following (using Smile.STL):

Reading file... Converting strings to floats... Allocating space in the ByteBuffer... Filling in the header... Converting floats to bytes... Moving bytes from ByteBuffer to byte[]... Conversion from ASCII to Binary is complete. STLParser.interpretBinarySTL(): STL Facet count: 1069

ZBoylan commented 6 years ago

If I leave those two lines in, I get an infinite loop of the following:

Slicer.sliceLayer(): Intersecting facets at height 505.92166: 2

-> Sent this to Paul on the slicing team. Error might be on their end. Hopefully once they finish the Model and Slicer classes, it will work.

ZBoylan commented 6 years ago

Changes to UI we need to make:

Change "Layer height" to "Layer scale" Get rid of "layer size" New variable "Filament diameter" - pass in as float. value - 1.75 OR 3.00 Need baud rate fill in box Need drop down for which usb port you are using Two input boxes for what temp you are preheating the bed and head to. Rename the "Back to origin" button to "Homing"

ZBoylan commented 6 years ago

Status update:

Device Controller team - they seem to have printing GCode completely done. I saw their object they printed yesterday and it looked great.

Slicing team - Chris just showed me they are pretty much done too. The GCode is nearly perfect. It just adds a little more to corners at the moment. Should be fixed in the next day or two.

Rendering team - not sure where they stand.