Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates and more structure #1

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
32b38c0
Changes in header
acheever Jun 15, 2012
07b79ab
Changes in Header
acheever Jun 15, 2012
2f02962
Fixed Typo in header
acheever Jun 15, 2012
091a91f
New Header
acheever Jun 15, 2012
724b520
Header fix - what this file does
acheever Jun 15, 2012
2091efb
Header adjustment - what this file does.
acheever Jun 15, 2012
9c4e1aa
header typo
acheever Jun 15, 2012
348e11d
header typo
acheever Jun 15, 2012
da4b130
header typo
acheever Jun 15, 2012
d6f1552
Make Your Own DIWire Video at https://vimeo.com/44274793 for construc…
Jun 19, 2012
4fff1c8
added latest BOM and 3d printed parts
h0st1le Feb 15, 2013
b9cc876
converted all STEP files to STL for easy 3d printing
h0st1le Feb 15, 2013
fa0499e
latest printed parts download was missing Angle_Marker and Top_Plate_…
h0st1le Feb 15, 2013
06fcb90
renamed Top_Plate_Hole_layout and Angle_Marker to fit existing naming…
h0st1le Feb 15, 2013
eeb84a6
added in proper licenses, migrated README to markdown and added sever…
h0st1le Feb 15, 2013
6134a96
added linebreaks to license.txt and stripped all trailing whitespaces…
h0st1le Feb 15, 2013
2cd0771
small fixes to readme
h0st1le Feb 15, 2013
6547c11
added gitignore, feed it with vim file types
h0st1le Feb 15, 2013
e80af05
changed format of the BOM to match that of kitBOM also moved the BOM …
h0st1le Feb 15, 2013
bd2deac
added section 'what can it do' some fixes and cleanup
h0st1le Feb 15, 2013
b79a46d
typo fix
h0st1le Feb 16, 2013
c654375
another typo fix
h0st1le Feb 16, 2013
562873a
just found the instructable, added it as resource to readme
h0st1le Feb 16, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Vim
.*.s[a-w][a-z]
*.un~
Session.vim
.netrwhist
*~
73 changes: 47 additions & 26 deletions 2D-Processing.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,39 @@
//import these libraries from libraries folder
import processing.serial.*;
import geomerative.*;
Serial arduino;

/*
* DIWire Bender
/* DIWire Bender
* 3D Wire Bender by Pensa - www.PensaNYC.com
* Written by Marco Perry. Call (718) 855 - 5354 for questions or support.
* Drives on 3 Stepper Motors to bender wire in 3D space
* Written by Marco Perry. Email DIWire@PensaNYC.com for questions.
* Drives on 3 Stepper Motors to bender wire in 2D space
*
* This file is part of the DIWire project.
* This file bends in 2D by reading and SVG file (vector graphics file).
*
* DIWire is a free software & hardware device: you can redistribute it and/or modify
* it's software under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* The hardware portion is licenced under the Creative Commons-Attributions-Share Alike License 3.0
* The CC BY SA licence can be seen here: http://creativecommons.org/licenses/by-sa/3.0/us/


* DIWIre is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License and CC-BY-SA for more details.

* You should have received a copy of the GNU General Public License
* along with DIWire. If not, see <http://www.gnu.org/licenses/>.
* and http://creativecommons.org/licenses/by-sa/3.0/us/legalcode
*
* No portion of this header can be removed from the code.
* Now enjoy and start making something!
*/

/*the following program uploads a svg file, draws the 2D shape, allows user to set the print resolution,
calculates the feed and bend angles to print the 2D shape, and sends these values to the arduino*/
/* the following program uploads a svg file, draws the 2D shape, allows user to set the print resolution,
calculates the feed and bend angles to print the 2D shape, and sends these values to the arduino*/

//import these libraries from libraries folder
import processing.serial.*;
import geomerative.*;
Serial arduino;


//Declaring the objects being used to print
Expand Down Expand Up @@ -49,11 +70,11 @@ void setup() {
println ("2. PREVIEW SHAPE");
println ("3. SEND SHAPE TO ARDUINO");
println ();
println ("RESOLUTION IS CURRENTLY = " + res);
println ("RESOLUTION IS CURRENTLY = " + res);
println ("NUMBER OF STEPS = " + steps);
}

void draw() {
void draw() {
translate(width/4, height/4); // Sets draw location and scale
noFill();

Expand All @@ -69,8 +90,8 @@ void draw() {
res = map(float(mouseY), 0.0, float(height), minDist, 128); //resolution based on mouse location
shp.draw();
}
RG.setPolygonizerLength(res);
points = shp.getPoints(); //point resolution based on mouse location
RG.setPolygonizerLength(res);
points = shp.getPoints(); //point resolution based on mouse location

// draw a shape of lines connecting the points
if (points != null) {
Expand Down Expand Up @@ -99,11 +120,11 @@ void draw() {
noFill();
beginShape();
for (int i=1; i<=steps+2; i++) { //preview bend by relative angles
line (0, 0, 0, feeds[i-1]);
line (0, 0, 0, feeds[i-1]);
translate (0, feeds [i-1]);
rotate (-radians(angles [i+1])); //bend
}
preview = !preview;
preview = !preview;
popMatrix ();
}
}
Expand All @@ -116,14 +137,14 @@ void mousePressed() { //mouse press sets resolution based on mouse location
chngRes = !chngRes;
}

void keyPressed() { //If keys are pressed run corresbonding subroutine
void keyPressed() { //If keys are pressed run corresbonding subroutine
switch (key) {
case '1': //calculates bend angles and feed lengths
calcs();
calcs();
break;

case '2': //shows a shape preview based on set resolution
preview = !preview;
preview = !preview;
break;

case '3': //sends bend angles and feed lengths to the arduino for printing
Expand All @@ -135,7 +156,7 @@ void keyPressed() { //If keys are pressed run corresbonding subroutine

//this subroutine accepts feedback from the arduino. It is not necessary but sometimes needed to establish initial serial communication
/*void serialEvent (Serial p) {
String inString = arduino.readStringUntil ('\n');
String inString = arduino.readStringUntil ('\n');
if (inString !=null) {
println(inString);
}
Expand All @@ -153,22 +174,22 @@ void calcs () {
println (points.length);
//calculate relative angles between points and assign to array angles[]
angles [0] = 0; // first angle is zero
for (int i = 1; i < points.length; i++) {
for (int i = 1; i < points.length; i++) {
feeds[i-1] = dist (points[i-1].x, points[i-1].y, points[i].x, points[i].y); //feed legths are the distances between points
float deltaX = points[i].x - points[i-1].x; //change in x axis between points
float deltaY = points[i].y - points[i-1].y; //change in y axis between points

//the following equations calculate the bend angles between each point
//there are different equations for each coordinate quadrant
if ((deltaX >=0 && deltaY >=0)||(deltaX <=0 && deltaY >=0)) {
if ((deltaX >=0 && deltaY >=0)||(deltaX <=0 && deltaY >=0)) {
angles[i] =(degrees(atan(deltaX/deltaY)) - (lastAng + lastlastAng));
}
if (deltaX <= 0 && deltaY < 0) {
angles[i] = (180 + abs(degrees(atan(deltaX/deltaY)))) - (lastAng + lastlastAng);
}
if (deltaX >0 && deltaY <0) {
angles[i] = (180 - abs(degrees(atan(deltaX/deltaY)))) - (lastAng + lastlastAng);
}
}
if (angles[i]>720) {
angles[i] = angles[i]-360;
}
Expand All @@ -177,7 +198,7 @@ void calcs () {
}
if (angles[i]>180) {
angles[i] = angles[i]-360;
}
}

//shows matrix of feeds and bend angles
println (round(1*(feeds[i-1]))+"\t"+round(angles[i])+"\t"+"0"); //change the 1 before feeds to change scale. z bend remains 0 because this is a 2D shape
Expand All @@ -192,7 +213,7 @@ void calcs () {
void sendArd () { //sends bend angles and feed lengths to the arduino board for printing
byte feedmotor = 126; //these byte values are markers so the arduino knows if a value is a bend, feed, or end it's the end of the array
byte bendmotor = 125;
byte end = 127;
byte end = 127;

println ( key );
println ();
Expand Down
Loading