Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 3 additions & 3 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ jobs:
run: xvfb-run -s '-screen 0 1024x768x24' ./gradlew test

- name: Test Bezier
run: xvfb-run -s '-screen 0 1024x768x24' java -Dprism.order=sw -Dprism.verbose=true -jar build/libs/bowler-kernel.jar -g https://gist.github.com/4aeeaa49bd3a807eed8f8ff3dea84c48.git BezierEditorDemo.groovy
run: xvfb-run -s '-screen 0 1024x768x24' java --enable-preview -Dprism.order=sw -Dprism.verbose=true -jar build/libs/bowler-kernel.jar -g https://gist.github.com/4aeeaa49bd3a807eed8f8ff3dea84c48.git BezierEditorDemo.groovy
- name: start xvfb
run:
Xvfb :0 &
- name: Test Local
run: xvfb-run -s '-screen 0 1024x768x24' java -Dprism.order=sw -Dprism.verbose=true -jar build/libs/bowler-kernel.jar -f kernel-return-test.groovy
run: xvfb-run -s '-screen 0 1024x768x24' java --enable-preview -Dprism.order=sw -Dprism.verbose=true -jar build/libs/bowler-kernel.jar -f kernel-return-test.groovy

- name: Clean Cad
run: rm -rf $HOME/bowler-workspace/gitcache/github.com/Hephaestus-Arm/HephaestusArm2
- name: build Cad
run: xvfb-run -s '-screen 0 1024x768x24' java -Dprism.order=sw -Dprism.verbose=true -jar build/libs/bowler-kernel.jar -g https://github.com/Hephaestus-Arm/HephaestusArm2.git hephaestus.xml
run: xvfb-run -s '-screen 0 1024x768x24' java --enable-preview -Dprism.order=sw -Dprism.verbose=true -jar build/libs/bowler-kernel.jar -g https://github.com/Hephaestus-Arm/HephaestusArm2.git hephaestus.xml



2 changes: 1 addition & 1 deletion GithubPasswordManager
2 changes: 1 addition & 1 deletion JCSG
Submodule JCSG updated 50 files
+0 −6 .github/workflows/verify.yml
+84 −84 box.svg
+23 −40 build.gradle
+94 −94 gradlew.bat
+293 −0 src/main/java/com/neuronrobotics/manifold3d/CSGManifold3d.java
+11 −0 src/main/java/com/neuronrobotics/manifold3d/NonManifoldShapeError.java
+744 −464 src/main/java/eu/mihosoft/vrl/v3d/CSG.java
+5 −7 src/main/java/eu/mihosoft/vrl/v3d/CSGClient.java
+2 −2 src/main/java/eu/mihosoft/vrl/v3d/CSGServerHandler.java
+2 −4 src/main/java/eu/mihosoft/vrl/v3d/ChamferedCube.java
+2 −4 src/main/java/eu/mihosoft/vrl/v3d/ChamferedCylinder.java
+10 −20 src/main/java/eu/mihosoft/vrl/v3d/Cube.java
+18 −34 src/main/java/eu/mihosoft/vrl/v3d/Cylinder.java
+2 −4 src/main/java/eu/mihosoft/vrl/v3d/Dodecahedron.java
+10 −9 src/main/java/eu/mihosoft/vrl/v3d/Edge.java
+2 −2 src/main/java/eu/mihosoft/vrl/v3d/Extrude.java
+2 −2 src/main/java/eu/mihosoft/vrl/v3d/Fillet.java
+2 −4 src/main/java/eu/mihosoft/vrl/v3d/Hexagon.java
+2 −3 src/main/java/eu/mihosoft/vrl/v3d/Icosahedron.java
+2 −4 src/main/java/eu/mihosoft/vrl/v3d/Isosceles.java
+0 −56 src/main/java/eu/mihosoft/vrl/v3d/Modifier.java
+2 −3 src/main/java/eu/mihosoft/vrl/v3d/Octahedron.java
+0 −96 src/main/java/eu/mihosoft/vrl/v3d/Polyhedron.java
+11 −20 src/main/java/eu/mihosoft/vrl/v3d/Primitive.java
+4 −12 src/main/java/eu/mihosoft/vrl/v3d/RoundedCube.java
+2 −3 src/main/java/eu/mihosoft/vrl/v3d/RoundedCylinder.java
+44 −4 src/main/java/eu/mihosoft/vrl/v3d/STL.java
+8 −5 src/main/java/eu/mihosoft/vrl/v3d/Slice.java
+43 −29 src/main/java/eu/mihosoft/vrl/v3d/Sphere.java
+2 −4 src/main/java/eu/mihosoft/vrl/v3d/Tetrahedron.java
+2 −7 src/main/java/eu/mihosoft/vrl/v3d/Text3d.java
+10 −4 src/main/java/eu/mihosoft/vrl/v3d/Toroid.java
+4 −0 src/main/java/eu/mihosoft/vrl/v3d/Vertex.java
+2 −4 src/main/java/eu/mihosoft/vrl/v3d/Wedge.java
+4 −0 src/main/java/eu/mihosoft/vrl/v3d/ext/imagej/STLLoader.java
+1 −1 src/main/java/eu/mihosoft/vrl/v3d/ext/org/poly2tri/PolygonUtil.java
+24 −9 src/main/java/eu/mihosoft/vrl/v3d/ext/quickhull3d/HullUtil.java
+8 −6 src/test/java/eu/mihosoft/vrl/v3d/CSGTest.java
+0 −30 src/test/java/eu/mihosoft/vrl/v3d/ConcavePolygonExtrusionTest.java
+6 −4 src/test/java/eu/mihosoft/vrl/v3d/DodecahedronTest.java
+4 −2 src/test/java/eu/mihosoft/vrl/v3d/IcosahedronTest.java
+43 −0 src/test/java/eu/mihosoft/vrl/v3d/Manifold3d_test.java
+2 −2 src/test/java/eu/mihosoft/vrl/v3d/OctahedronTest.java
+16 −12 src/test/java/eu/mihosoft/vrl/v3d/ServerClientTest.java
+2 −2 src/test/java/eu/mihosoft/vrl/v3d/SliceTest.java
+3 −1 src/test/java/eu/mihosoft/vrl/v3d/StlExportTest.java
+1 −1 src/test/java/eu/mihosoft/vrl/v3d/StlLoadTest.java
+9 −1 src/test/java/eu/mihosoft/vrl/v3d/SvgExportTest.java
+20 −0 src/test/java/eu/mihosoft/vrl/v3d/TestFlatData.java
+2 −2 src/test/java/eu/mihosoft/vrl/v3d/TetrahedronTest.java
10 changes: 10 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,17 @@ task sourcesJar(type: Jar) {
artifacts {
archives javadocJar, sourcesJar, jar
}
tasks.withType(JavaCompile).configureEach {
options.compilerArgs += ['--enable-preview']
}

tasks.withType(Test).configureEach {
jvmArgs '--enable-preview'
}

tasks.withType(JavaExec).configureEach {
jvmArgs '--enable-preview'
}
//test {
// testLogging.showExceptions = true
// testLogging.showCauses = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import com.neuronrobotics.sdk.common.Log;

import eu.mihosoft.vrl.v3d.CSG;
import eu.mihosoft.vrl.v3d.CSG.OptType;
import eu.mihosoft.vrl.v3d.CSGServer;
import eu.mihosoft.vrl.v3d.ICSGProgress;
import eu.mihosoft.vrl.v3d.JavaFXInitializer;
Expand Down Expand Up @@ -434,7 +435,7 @@ public static void startupProcedures()
com.neuronrobotics.sdk.common.Log.error("ERROR No UI engine available");
}
ScriptingEngine.waitForLogin();

CSG.setDefaultOptType(OptType.Manifold3d);
CSGDatabase.setInstance(new CSGDatabaseInstance(
new File(ScriptingEngine.getWorkspace().getAbsoluteFile() + "/csgDatabase.json")));
File logfile = new File(ScriptingEngine.getWorkspace().getAbsoluteFile() + "/kernelLog.txt");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.neuronrobotics.bowlerstudio.vitamins.Vitamins;
import com.neuronrobotics.sdk.addons.kinematics.VitaminLocation;
import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR;
import com.neuronrobotics.sdk.common.Log;

import eu.mihosoft.vrl.v3d.CSG;
import eu.mihosoft.vrl.v3d.parametrics.CSGDatabase;
Expand Down Expand Up @@ -83,26 +84,31 @@ public void build(CaDoodleFile f) {
dir.mkdirs();
stlFile = new File(absolutePath + delim() + type + ".stl");
if (stlFile.exists()) {
indicator = Vitamins.get(f.getCsgDBinstance(), stlFile);
getIndicator().setColor(Color.WHITE);
return;
} else {
AddRobotController arc = new AddRobotController().setController(this);
arc.setCaDoodleFile(f);
List<CSG> so = arc.process(new ArrayList<>());
for (CSG c : so) {
for (String s : c.getParameters(f.getCsgDBinstance())) {
f.getCsgDBinstance().delete(s);
}
try {
indicator = Vitamins.get(f.getCsgDBinstance(), false, stlFile);
getIndicator().setColor(Color.WHITE);
return;
} catch (Exception e) {
Log.error(e);
stlFile.delete();
}
indicator = so.get(0);
if (so.size() > 1) {
for (int i = 1; i < so.size(); i++) {
indicator = getIndicator().dumbUnion(so.get(i));
}

}
AddRobotController arc = new AddRobotController().setController(this);
arc.setCaDoodleFile(f);
List<CSG> so = arc.process(new ArrayList<>());
for (CSG c : so) {
for (String s : c.getParameters(f.getCsgDBinstance())) {
f.getCsgDBinstance().delete(s);
}
}
indicator = so.get(0);
if (so.size() > 1) {
for (int i = 1; i < so.size(); i++) {
indicator = getIndicator().dumbUnion(so.get(i));
}
getIndicator().setColor(Color.WHITE);
}
getIndicator().setColor(Color.WHITE);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,17 @@ public void build(CaDoodleFile f) throws IOException {
File imageFile = new File(absolutePath + delim() + type + name + ".png");
File stlFile = new File(absolutePath + delim() + type + name + ".stl");
if (imageFile.exists() && stlFile.exists()) {
indicator = Vitamins.get(f.getCsgDBinstance(), stlFile);
indicator = indicator.transformed(TransformFactory.nrToCSG(LimbRotationOffset));
indicator.setColor(Color.WHITE);
image = new Image(imageFile.toURI().toString());
return;
try {
indicator = Vitamins.get(f.getCsgDBinstance(), false, stlFile);
indicator = indicator.transformed(TransformFactory.nrToCSG(LimbRotationOffset));
indicator.setColor(Color.WHITE);
image = new Image(imageFile.toURI().toString());
return;
} catch (Exception e) {
Log.error("Failed to load cached STL, deleting " + stlFile.getAbsolutePath());
Log.error(e);
stlFile.delete();
}
}
AddRobotLimb add = new AddRobotLimb().setLimb(this).setLocation(new TransformNR());
add.setCaDoodleFile(f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
import org.eclipse.jgit.api.errors.TransportException;

import com.neuronrobotics.bowlerstudio.vitamins.Vitamins;
import com.neuronrobotics.manifold3d.NonManifoldShapeError;

import eu.mihosoft.vrl.v3d.CSG;
import eu.mihosoft.vrl.v3d.ColinearPointsException;
import eu.mihosoft.vrl.v3d.FileUtil;
import eu.mihosoft.vrl.v3d.parametrics.CSGDatabaseInstance;
import javafx.scene.paint.Color;
Expand All @@ -24,7 +26,7 @@ public Object inlineScriptRun(CSGDatabaseInstance db, File code, ArrayList<Objec
File stl = File.createTempFile(code.getName(), ".stl");
stl.deleteOnExit();
toSTLFile(db, code, stl);
CSG back = Vitamins.get(db, stl, true);
CSG back = Vitamins.get(db, true, stl, true);
back.setColor(Color.ORANGE);
return back;
}
Expand Down Expand Up @@ -92,24 +94,31 @@ public static void toBlenderFile(CSGDatabaseInstance db, File stl, File blenderf
}

public static void scaleStl(CSGDatabaseInstance db, File incoming, File outgoing, double scale) {
CSG back = Vitamins.get(db, incoming, true).scale(scale);
CSG back;
try {
boolean manifold = CSG.isPreventNonManifoldTriangles();
CSG.setPreventNonManifoldTriangles(false);
FileUtil.write(Paths.get(outgoing.getAbsolutePath()), back.toStlString());

CSG.setPreventNonManifoldTriangles(manifold);
} catch (IOException e) {
// Auto-generated catch block
com.neuronrobotics.sdk.common.Log.error(e);
back = Vitamins.get(db, false, incoming, true).scale(scale);
try {
boolean manifold = CSG.isPreventNonManifoldTriangles();
CSG.setPreventNonManifoldTriangles(false);
FileUtil.write(Paths.get(outgoing.getAbsolutePath()), back.toStlString());

CSG.setPreventNonManifoldTriangles(manifold);
} catch (IOException e) {
// Auto-generated catch block
com.neuronrobotics.sdk.common.Log.error(e);
}
} catch (NonManifoldShapeError | ColinearPointsException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

public static CSG remesh(CSGDatabaseInstance db, CSG incoming, double MMVoxel, CSGDatabaseInstance instance)
throws Exception {
File stl = DownloadManager.getTmpSTL(incoming);
remeshSTLFile(db, stl, MMVoxel);
CSG back = Vitamins.get(db, stl, true);
CSG back = Vitamins.get(db, true, stl, true);
return back.syncProperties(instance, incoming).setName(incoming.getName());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
import org.eclipse.jgit.api.errors.TransportException;

import com.neuronrobotics.bowlerstudio.vitamins.Vitamins;
import com.neuronrobotics.manifold3d.NonManifoldShapeError;
import com.neuronrobotics.sdk.common.Log;

import eu.mihosoft.vrl.v3d.CSG;
import eu.mihosoft.vrl.v3d.ColinearPointsException;
import eu.mihosoft.vrl.v3d.parametrics.CSGDatabaseInstance;
import javafx.scene.paint.Color;

Expand All @@ -39,26 +41,29 @@ public Object inlineScriptRun(CSGDatabaseInstance db, File code, ArrayList<Objec
}

public static List<CSG> toCSG(CSGDatabaseInstance db, ArrayList<Object> params)
throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException {
throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException,
NonManifoldShapeError, ColinearPointsException {
Path tempDir = Files.createTempDirectory("build123d-");

return toCSG(db, null, tempDir, params);
}

public static List<CSG> toCSG(CSGDatabaseInstance db, Path stl, ArrayList<Object> params)
throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException {
throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException,
NonManifoldShapeError, ColinearPointsException {
return toCSG(db, null, stl, params);
}

public static List<CSG> toCSG(CSGDatabaseInstance db, File code, Path stl, ArrayList<Object> params)
throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException {
throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException,
NonManifoldShapeError, ColinearPointsException {
toSTLFile(code, stl, params);

ArrayList<CSG> back = new ArrayList<CSG>();
for (File f : stl.toFile().listFiles()) {
Log.debug("Loading " + f);
if (f.getName().toLowerCase().endsWith(".stl")) {
CSG b = Vitamins.get(db, f, true);
CSG b = Vitamins.get(db, true, f, true);
b.setColor(Color.ANTIQUEWHITE);
back.add(b);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.google.gson.reflect.TypeToken;
import com.neuronrobotics.bowlerstudio.physics.TransformFactory;
import com.neuronrobotics.bowlerstudio.vitamins.Vitamins;
import com.neuronrobotics.manifold3d.NonManifoldShapeError;
import com.neuronrobotics.sdk.addons.kinematics.math.RotationNR;
import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR;

Expand All @@ -52,7 +53,7 @@ public Object inlineScriptRun(eu.mihosoft.vrl.v3d.parametrics.CSGDatabaseInstanc
File stl = File.createTempFile(code.getName(), ".stl");
stl.deleteOnExit();
toSTLFile(code, stl);
CSG back = Vitamins.get(db, stl, true);
CSG back = Vitamins.get(db, true, stl, true);
//back.snapPoints();
back.setColor(Color.BLUE);
back.setNoScale(true);
Expand Down Expand Up @@ -237,9 +238,11 @@ public static void open(File freecadModel) {
* @throws GitAPIException
* @throws TransportException
* @throws InvalidRemoteException
* @throws ColinearPointsException
* @throws NonManifoldShapeError
*/
public static void main(String[] args)
throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException {
public static void main(String[] args) throws InvalidRemoteException, TransportException, GitAPIException,
IOException, InterruptedException, NonManifoldShapeError, ColinearPointsException {
JavaFXInitializer.go();
PasswordManager.login();
FreecadLoader l = new FreecadLoader();
Expand All @@ -249,7 +252,7 @@ public static void main(String[] args)
l.getDefaultContents(test);
File stlToImport = ScriptingEngine.fileFromGit("https://github.com/NeuronRobotics/NASACurisoity.git",
"STL/upper-arm.STL");
CSG toSlice = Vitamins.get(null, stlToImport, true);
CSG toSlice = Vitamins.get(null, true, stlToImport, true);
// toSlice=toSlice.union(
// new Cube(20).toCSG()
// .toXMin()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class ObjLoader implements IScriptingLanguage {
@Override
public Object inlineScriptRun(eu.mihosoft.vrl.v3d.parametrics.CSGDatabaseInstance db, File code,
ArrayList<Object> args) throws Exception {
CSG sllLoaded = Vitamins.get(db, code);
CSG sllLoaded = Vitamins.get(db, true, code);
return sllLoaded;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public Object inlineScriptRun(eu.mihosoft.vrl.v3d.parametrics.CSGDatabaseInstanc
}

toSTLFile(code, stl, params);
CSG back = Vitamins.get(db, stl, true);
CSG back = Vitamins.get(db, true, stl, true);
back.setColor(Color.YELLOW);
return back;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class StlLoader implements IScriptingLanguage {
@Override
public Object inlineScriptRun(eu.mihosoft.vrl.v3d.parametrics.CSGDatabaseInstance db, File code,
ArrayList<Object> args) throws Exception {
CSG sllLoaded = Vitamins.get(db, code);
CSG sllLoaded = Vitamins.get(db, true, code);
return sllLoaded;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,8 @@ public void setOperations(ArrayList<CaDoodleOperation> operations) {
public TransformNR getWorkplane() {
if (workplane == null)
workplane = new TransformNR();
RotationNR r = workplane.getRotation();
r.normalize();
return workplane;
}

Expand Down
Loading
Loading