Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
34d3ea6
added List of Points
i-make-robots Feb 7, 2025
8ec490a
Create PatternAtPoints.java
i-make-robots Feb 7, 2025
22a77e9
added angle so diamonds can be boxes.
i-make-robots Feb 7, 2025
5950ea3
dispose of Graphics2D to be tidy
i-make-robots Feb 7, 2025
344ce5d
Boxxy style
i-make-robots Feb 7, 2025
f82e3ff
fix pom for jitpack
i-make-robots Feb 7, 2025
da9866d
x and y spacing now use InputNumber, added style.
i-make-robots Feb 7, 2025
a179189
fixed an add a Node to Graph more than once.
i-make-robots Feb 7, 2025
6dd0fec
use PrintWithGraphics::getLayer()
i-make-robots Feb 7, 2025
2f67e7b
Added `b / (a spacing)` style to GridOfPoints
i-make-robots Feb 7, 2025
f3d4913
expose min and max for customizing
i-make-robots Feb 7, 2025
12e69b8
expose layer
i-make-robots Feb 8, 2025
88af002
bump dependencies
i-make-robots Feb 8, 2025
9fdb4c8
Create SaveTurtleTest.java
i-make-robots Feb 8, 2025
d1f33da
Changed Variable to Port in nodegraphcore
i-make-robots Feb 8, 2025
b3c9474
Update SaveTurtle.java
i-make-robots Feb 8, 2025
fdba2e6
bump version
i-make-robots Feb 8, 2025
18b05b7
7.66.1
i-make-robots Feb 8, 2025
ec12f20
Variable > Port pt 2
i-make-robots Feb 8, 2025
2563375
center on origin
i-make-robots Feb 10, 2025
b94bdd3
Added CropToRectangle Node
i-make-robots Feb 10, 2025
f109a89
points should be round
i-make-robots Feb 10, 2025
49b5181
pattern should treat images as centered on their origins
i-make-robots Feb 10, 2025
9dbd079
origin at center
i-make-robots Feb 10, 2025
ed72019
expose layer
i-make-robots Feb 10, 2025
bb7b369
reverse mouse wheel - push away to make smaller
i-make-robots Feb 10, 2025
cddbab7
Update Converter_CMYK_Circles.java
i-make-robots Feb 10, 2025
bcecc56
create new instance to prevent accidents
i-make-robots Feb 10, 2025
f5c3470
use progress bar, adjust for centered image
i-make-robots Feb 10, 2025
7de71e6
Output.send now Output.setValue
i-make-robots Feb 10, 2025
fbfe31f
bump version
i-make-robots Feb 11, 2025
897d001
exposed subdivisions
i-make-robots Feb 11, 2025
787fd82
bump versions
i-make-robots Feb 14, 2025
dc19835
fix Exception on empty filename
i-make-robots Feb 14, 2025
8b18150
updates for bumped
i-make-robots Feb 14, 2025
b7d34cb
more exception testing
i-make-robots Feb 14, 2025
4db9c9b
Fix #789
i-make-robots Feb 15, 2025
d68b46f
fix #790 and vastly increase PrintTurtle performance
i-make-robots Feb 17, 2025
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
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.marginallyclever</groupId>
<artifactId>Makelangelo</artifactId>
<version>7.65.0</version>
<version>7.66.2</version>
<name>Makelangelo</name>
<description>Makelangelo Software is a Java program that prepares art for CNC plotters. It is especially designed for the Makelangelo Robot.
It pairs really well with Marlin-polargraph, the code in the brain of the robot that receives instructions and moves the motors.</description>
Expand Down Expand Up @@ -427,7 +427,7 @@ It pairs really well with Marlin-polargraph, the code in the brain of the robot
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.5.9</version>
<version>1.5.16</version>
</dependency>
<dependency>
<groupId>org.codehaus.janino</groupId>
Expand All @@ -438,7 +438,7 @@ It pairs really well with Marlin-polargraph, the code in the brain of the robot
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.12</version>
<version>2.0.16</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -571,7 +571,7 @@ It pairs really well with Marlin-polargraph, the code in the brain of the robot
-->
<groupId>com.github.marginallyclever</groupId>
<artifactId>nodegraphcore</artifactId>
<version>1.1.0</version>
<version>1.3.2</version>
</dependency>
<dependency>
<!--
Expand All @@ -583,7 +583,7 @@ It pairs really well with Marlin-polargraph, the code in the brain of the robot
-->
<groupId>com.github.marginallyclever</groupId>
<artifactId>donatello</artifactId>
<version>1.4.3</version>
<version>1.5.5</version>
</dependency>

<!-- read audio files -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public class LineSegment2D {

public LineSegment2D(Point2D start, Point2D end, Color color) {
super();
this.start = start;
this.end = end;
this.start = new Point2D(start);
this.end = new Point2D(end);
this.color = color;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,12 @@ public static void main(String[] args) {
JFrame frame = new JFrame("Collapsible Panel");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

JPanel jPanel = new JPanel();
jPanel.setLayout(new BorderLayout());
SelectBoolean a = new SelectBoolean("A", "AAAAAAAAAAA", false);
jPanel.add(a, BorderLayout.NORTH);
JPanel jPanel = new JPanel(new GridBagLayout());

CollapsiblePanel cpanel = new CollapsiblePanel(frame, "lot of buttons", 400, true);
jPanel.add(cpanel, BorderLayout.CENTER);

SelectBoolean a = new SelectBoolean("A", "AAAAAAAAAAA", false);
SelectButton b = new SelectButton("B", "B");
SelectColor c = new SelectColor("C", "CCCCCC", Color.BLACK, frame);
SelectFile d = new SelectFile("D", "D", null,cpanel);
Expand All @@ -205,15 +203,19 @@ public static void main(String[] args) {
SelectSlider i = new SelectSlider("I", "I", 200, 0, 100);
SelectTextArea j = new SelectTextArea("J", "J", ipsum);

cpanel.add(b);
cpanel.add(c);
cpanel.add(d);
cpanel.add(e);
cpanel.add(f);
cpanel.add(g);
cpanel.add(h);
cpanel.add(i);
cpanel.add(j);
var inner = new JPanel(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
a.attach(inner, gbc); gbc.gridy++;
b.attach(inner,gbc); gbc.gridy++;
c.attach(inner,gbc); gbc.gridy++;
d.attach(inner,gbc); gbc.gridy++;
e.attach(inner,gbc); gbc.gridy++;
f.attach(inner,gbc); gbc.gridy++;
g.attach(inner,gbc); gbc.gridy++;
h.attach(inner,gbc); gbc.gridy++;
i.attach(inner,gbc); gbc.gridy++;
j.attach(inner,gbc); gbc.gridy++;
cpanel.add(inner);

frame.setPreferredSize(new Dimension(600, 90));
frame.add(jPanel);
Expand Down
14 changes: 1 addition & 13 deletions src/main/java/com/marginallyclever/makelangelo/MainFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.marginallyclever.convenience.FileAccess;
import com.marginallyclever.donatello.Donatello;
import com.marginallyclever.donatello.NodeFactoryPanel;
import com.marginallyclever.donatello.actions.undoable.NodeAddAction;
import com.marginallyclever.makelangelo.applicationsettings.MetricsPreferences;
import com.marginallyclever.makelangelo.donatelloimpl.DonatelloDropTarget;
import com.marginallyclever.makelangelo.makeart.io.LoadFilePanel;
Expand Down Expand Up @@ -85,18 +84,7 @@ public MainFrame() {
setJMenuBar(mainMenuBar);

setupDropTarget();
connectFactoryToPreview();
}

private void connectFactoryToPreview() {
nodeFactoryPanel.addListener(e->{
var p = donatello.getPopupPoint();
if(p!=null) p = donatello.getPaintArea().transformScreenToWorldPoint(p);
else p = donatello.getPaintArea().getCameraPosition();

var add = new NodeAddAction("Add",donatello,nodeFactoryPanel);
add.commitAdd(e,p);
});
donatello.connectNodeFactory(nodeFactoryPanel);
}

private void initDocking() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private Node loadFile(String absolutePath) {
*/
private Node loadImage(String absPath) {
LoadImage loadImage = new LoadImage();
var first = loadImage.getVariable(0);
var first = loadImage.getPort(0);
if(!(first instanceof Input<?> inputFile)) throw new IllegalStateException("First variable is not an Input");
if(!(inputFile.getValue() instanceof Filename)) throw new IllegalStateException("Input value is not a Filename");
donatello.getGraph().add(loadImage);
Expand All @@ -101,7 +101,7 @@ private Node loadImage(String absPath) {
*/
private Node loadVector(String absPath) {
LoadTurtle loadTurtle = new LoadTurtle();
var first = loadTurtle.getVariable(0);
var first = loadTurtle.getPort(0);
if(!(first instanceof InputFilename inputFile)) throw new IllegalStateException("First variable is not an Input");
if(inputFile.getValue() == null) throw new IllegalStateException("Input value is not a Filename");
donatello.getGraph().add(loadTurtle);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.marginallyclever.makelangelo.donatelloimpl;

import com.marginallyclever.makelangelo.donatelloimpl.nodes.points.PointsDAO4JSON;
import com.marginallyclever.makelangelo.donatelloimpl.nodes.turtle.TurtleDAO4JSON;
import com.marginallyclever.makelangelo.turtle.Turtle;
import com.marginallyclever.nodegraphcore.DAO4JSONFactory;
Expand Down Expand Up @@ -32,5 +33,6 @@ public void registerNodes() {
public void registerDAO() {
logger.info("Registering makelangelo-software DAOs");
DAO4JSONFactory.registerDAO(new TurtleDAO4JSON());
DAO4JSONFactory.registerDAO(new PointsDAO4JSON());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,47 @@ public class Canvas extends Node implements PrintWithGraphics {
private final InputInt width = new InputInt("width", 1);
private final InputInt height = new InputInt("height", 1);
private final InputColor color = new InputColor("color", Color.WHITE);
private final InputInt layer = new InputInt("layer",5);
private final OutputInt outx = new OutputInt("x",0);
private final OutputInt outy = new OutputInt("y",0);
private final OutputInt outw = new OutputInt("width",width.getValue());
private final OutputInt outh = new OutputInt("height",height.getValue());

public Canvas() {
super("Canvas");
addVariable(width);
addVariable(height);
addVariable(color);
addVariable(outx);
addVariable(outy);
addVariable(outw);
addVariable(outh);
addPort(width);
addPort(height);
addPort(color);
addPort(outx);
addPort(outy);
addPort(outw);
addPort(outh);
addPort(layer);
}

@Override
public void update() {
var w = Math.max(1,width.getValue());
var h = Math.max(1,height.getValue());
outx.send(0);
outy.send(0);
outw.send(w);
outh.send(h);
outx.setValue(-w/2);
outy.setValue(-h/2);
outw.setValue(w);
outh.setValue(h);
}


@Override
public void print(Graphics g) {
var x = outx.getValue();
var y = outy.getValue();
var w = Math.max(1,width.getValue());
var h = Math.max(1,height.getValue());
g.setColor(color.getValue());
g.fillRect(0,0,w,h);
g.fillRect(x,y,w,h);
}

@Override
public int getLayer() {
return layer.getValue();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package com.marginallyclever.makelangelo.donatelloimpl.nodes.points;

import com.marginallyclever.donatello.ports.InputDouble;
import com.marginallyclever.donatello.ports.InputNumber;
import com.marginallyclever.donatello.ports.InputOneOfMany;
import com.marginallyclever.nodegraphcore.Node;

import javax.vecmath.Matrix3d;
import javax.vecmath.Point2d;
import javax.vecmath.Point3d;
import java.util.stream.IntStream;

/**
* Create a grid of points controlled by the number (quantity) and spacing (distance between points).
*/
public class GridOfPoints extends Node {
private final InputNumber Xa = new InputNumber("Xa",10);
private final InputNumber Xb = new InputNumber("Xb",10d);
private final InputNumber Ya = new InputNumber("Ya",10);
private final InputNumber Yb = new InputNumber("Yb",10d);
private final InputOneOfMany style = new InputOneOfMany("style");
private final InputDouble angle = new InputDouble("angle");
private final OutputPoints output = new OutputPoints("output");

public GridOfPoints() {
super("GridOfPoints");
addPort(Xa);
addPort(Xb);
addPort(Ya);
addPort(Yb);
addPort(style);
addPort(angle);
addPort(output);

style.setOptions(new String[]{"a * b","b / (a count)","b / (a distance)"});
}

@Override
public void update() {
// we're going to make a grid nx,ny with margin dx,dy.
int nx,ny;
double dx, dy;

var list = new ListOfPoints();
switch(style.getValue()) {
case 2: {
// d = a
// n = total distance (b) divided by spacing (a)
dx = Math.max(1, Xa.getValue().doubleValue());
dy = Math.max(1, Ya.getValue().doubleValue());
nx = (int)Math.max(1, Xb.getValue().doubleValue() / dx);
ny = (int)Math.max(1, Yb.getValue().doubleValue() / dy);
break;
}
case 1: {
// n = a
// d = total distance (b) divided by number of points (a).
nx = Math.max(1, Xa.getValue().intValue());
ny = Math.max(1, Ya.getValue().intValue());
dx = Xb.getValue().doubleValue() / nx;
dy = Yb.getValue().doubleValue() / ny;
break;
}
default: {
// n = a
// d = b
nx = Math.max(1, Xa.getValue().intValue());
ny = Math.max(1, Ya.getValue().intValue());
dx = Xb.getValue().doubleValue();
dy = Yb.getValue().doubleValue();
break;
}
}

double halfX = (nx*dx) / 2;
double halfY = (ny*dy) / 2;
Matrix3d transform = new Matrix3d();
transform.rotZ(Math.toRadians(angle.getValue()));

// now make the grid
IntStream.range(0,ny).forEach(y -> {
IntStream.range(0,nx).forEach(x -> {
var p = new Point3d(x * dx - halfX, y * dy - halfY,0d);
transform.transform(p);
list.add(new Point2d(p.x, p.y));
});
});
output.setValue(list);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.marginallyclever.makelangelo.donatelloimpl.nodes.points;

import com.marginallyclever.nodegraphcore.port.Input;

/**
* {@link Input} for a {@link ListOfPoints}.
*/
public class InputPoints extends Input<ListOfPoints> {
public InputPoints(String _name) throws IllegalArgumentException {
super(_name, ListOfPoints.class, new ListOfPoints());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.marginallyclever.makelangelo.donatelloimpl.nodes.points;

import javax.vecmath.Point2d;
import java.util.ArrayList;

/**
* A list of 2D points with double precision.
*/
public class ListOfPoints extends ArrayList<Point2d> {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.marginallyclever.makelangelo.donatelloimpl.nodes.points;

import com.marginallyclever.nodegraphcore.port.Output;

/**
* {@link Output} for a {@link ListOfPoints}.
*/
public class OutputPoints extends Output<ListOfPoints> {
public OutputPoints(String _name) throws IllegalArgumentException {
super(_name, ListOfPoints.class, new ListOfPoints());
}
}
Loading
Loading