User:Lucatorsera/Prototyping
Experiments
Graph-ing Music
Following Special Issue#28 first radio show, where I shared the song Construção and prototyping class, I played around with GraphViz to translate the song in a visual format. By substituting the spaces between words with "->", you can easily create graphs, and understant the repetition of words in a song.
This became one of the fundaments of my SI28 public project, Marginalia.
Text2Graph
Taxan XY Plotter
On Prototyping session #6 (28.10.25), there was a pen plotter jam session. We learned HPGL and how to interface with some of them via RS232.
I was graced with the TAXAN X-Y KPL710. According to the logs, it was a difficult one to talk to, and latest reports called it fixed succesfully. Nevertheless, it wouldn't print files from InkScape or other programs fully. Chiplotle also didn't work for me.
My solution was to print a design "command by command" using serial.write() within processing. It works, but it is quite cumbersome depending on the design to be plotted.
/**
* TAXAN KPL710 Test Plot
* Sends a simple HPGL test pattern to the plotter.
*
* Before running:
* - Set the correct serial port name (e.g. "COM3" on Windows, "/dev/ttyUSB0" on Linux)
* - Match the plotter’s baud rate, parity, stop bits, etc. from your manual.
*/
import processing.serial.*;
Serial plotter;
void plotRect(float xPos, float yPos, float width, float height){
float p1x = xPos - width/2;
float p1y = yPos - height/2;
float p2x = xPos + width/2;
float p2y = yPos - height/2;
float p3x = xPos + width/2;
float p3y = yPos + height/2;
float p4x = xPos - width/2;
float p4y = yPos + height/2;
sendCmd("PD"+p1x+","+p1y+";");
delay(100);
sendCmd("PD"+p2x+","+p2y+";");
delay(100);
sendCmd("PD"+p3x+","+p3y+";");
delay(100);
sendCmd("PD"+p4x+","+p4y+";");
delay(100);
}
void setup() {
// List available ports
println(Serial.list());
// Replace this with your actual serial port name
String portName = "COM10";
int baudRate = 9600; // or 4800, 19200, etc. depending on your plotter settings
plotter = new Serial(this, portName, baudRate);
// Give plotter a moment to initialize
delay(2000);
// Send HPGL-like initialization sequence
sendCmd("IN;"); // Initialize
sendCmd("SP1;"); // Select pen 1
sendCmd("PA0,0;"); // Absolute mode, move to origin
sendCmd("PU;"); // Pen up
for(int i = 0; i < 10; i++){
float posX = random(5000, 10000);
float posY = random(5000, 10000);
float w = random(100, 1000);
float h = random(100,1000);
plotRect(posX,posY,w, h);
}
// Optionally move pen away and end
sendCmd("PA500,500;");
sendCmd("SP0;"); // Deselect pen
println("Test drawing sent!");
}
void draw() {
// Nothing here
}
void sendCmd(String cmd) {
print(">> " + cmd);
plotter.write(cmd);
}
Something to look further is the HPGL processing library that spits out pure HPGL. With that, it's also possible to preview the design. Then the same processing sketch could read that file and send the commands one by one.