From acd031b7485e3290bab21eb0d3ba0a6b1fa3c739 Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Sun, 11 Jan 2026 16:47:02 -0500 Subject: [PATCH 1/8] updating the tests --- .../scripting/Build123dLoader.java | 38 ++++++++++++++----- test/java/src/junit/bowler/Build123dTest.java | 3 +- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/neuronrobotics/bowlerstudio/scripting/Build123dLoader.java b/src/main/java/com/neuronrobotics/bowlerstudio/scripting/Build123dLoader.java index 89db491b..e2247476 100644 --- a/src/main/java/com/neuronrobotics/bowlerstudio/scripting/Build123dLoader.java +++ b/src/main/java/com/neuronrobotics/bowlerstudio/scripting/Build123dLoader.java @@ -24,16 +24,31 @@ public class Build123dLoader implements IScriptingLanguage { @Override public Object inlineScriptRun(CSGDatabaseInstance db,File code, ArrayList args) throws Exception { - File stl = File.createTempFile(sanitizeString(code.getName()), ".stl"); - stl.deleteOnExit(); - HashMap params=new HashMap(); + HashMap params=new HashMap(); if(args!=null) { Object o = args.get(0); if(HashMap.class.isInstance(o)) { - params=(HashMap)o; + params=(HashMap)o; } } - + File stl = File.createTempFile(sanitizeString(code.getName()), ".stl"); + stl.deleteOnExit(); + CSG back = toCSG(db, code, stl, params); + return back; + } + public static CSG toCSG(CSGDatabaseInstance db, HashMap params) + throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException { + File stl = File.createTempFile("build123d_temp", ".stl"); + stl.deleteOnExit(); + return toCSG(db, null, stl, params); + } + public static CSG toCSG(CSGDatabaseInstance db, File stl, HashMap params) + throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException { + return toCSG(db, null, stl, params); + } + + public static CSG toCSG(CSGDatabaseInstance db, File code, File stl, HashMap params) + throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException { toSTLFile(code,stl,params); CSG back = Vitamins.get(db,stl,true); back.setColor(Color.ANTIQUEWHITE); @@ -60,12 +75,14 @@ public ArrayList getFileExtenetion() { - - public static void toSTLFile(File build123dScript,File stlout, HashMap params) throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException { + public static void toSTLFile(File stlout, HashMap params) throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException { + toSTLFile(null,stlout,params); + } + public static void toSTLFile(File build123dScript,File stlout, HashMap params) throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException { File exe = getConfigExecutable("build123d", null); File dir = getDestinationDir("build123d"); if(params==null) - params=new HashMap(); + params=new HashMap(); ArrayList args = new ArrayList<>(); if(stlout.exists()) @@ -77,7 +94,8 @@ public static void toSTLFile(File build123dScript,File stlout, HashMap params = new HashMap(); + HashMap params = new HashMap(); toSTLFile(testblend, new File("build123dTest.py.stl"),params); } diff --git a/test/java/src/junit/bowler/Build123dTest.java b/test/java/src/junit/bowler/Build123dTest.java index 6099df4c..c68f8c7e 100644 --- a/test/java/src/junit/bowler/Build123dTest.java +++ b/test/java/src/junit/bowler/Build123dTest.java @@ -19,7 +19,6 @@ public class Build123dTest { @Test - @Ignore public void test() throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException { Build123dLoader loader = new Build123dLoader(); Log.enableDebugPrint(); @@ -27,7 +26,7 @@ public void test() throws InvalidRemoteException, TransportException, GitAPIExce File testblend = new File("build123dTest.py"); if(!testblend.exists()) loader.getDefaultContents(testblend); - HashMap params = new HashMap(); + HashMap params = new HashMap(); Build123dLoader.toSTLFile(testblend, new File("build123dTest.py.stl"),params); File gears = ScriptingEngine.fileFromGit("https://github.com/GarryBGoode/gggears.git", "examples/examples.py"); From 088a8c9b19a2139544608467b2feda4870ebde34 Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Sun, 11 Jan 2026 19:56:39 -0500 Subject: [PATCH 2/8] updating the CI test for build 123d --- .../scripting/Build123dLoader.java | 58 +++++++++++-------- test/java/src/junit/bowler/Build123dTest.java | 21 ++----- 2 files changed, 39 insertions(+), 40 deletions(-) diff --git a/src/main/java/com/neuronrobotics/bowlerstudio/scripting/Build123dLoader.java b/src/main/java/com/neuronrobotics/bowlerstudio/scripting/Build123dLoader.java index e2247476..bb04b3aa 100644 --- a/src/main/java/com/neuronrobotics/bowlerstudio/scripting/Build123dLoader.java +++ b/src/main/java/com/neuronrobotics/bowlerstudio/scripting/Build123dLoader.java @@ -3,9 +3,12 @@ import java.io.File; import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.api.errors.InvalidRemoteException; @@ -24,34 +27,39 @@ public class Build123dLoader implements IScriptingLanguage { @Override public Object inlineScriptRun(CSGDatabaseInstance db,File code, ArrayList args) throws Exception { - HashMap params=new HashMap(); + ArrayList params=new ArrayList<>(); if(args!=null) { Object o = args.get(0); if(HashMap.class.isInstance(o)) { - params=(HashMap)o; + params=(ArrayList)o; } } - File stl = File.createTempFile(sanitizeString(code.getName()), ".stl"); - stl.deleteOnExit(); - CSG back = toCSG(db, code, stl, params); + Path tempDir = Files.createTempDirectory("build123d-"); + + List back = toCSG(db, code, tempDir, params); return back; } - public static CSG toCSG(CSGDatabaseInstance db, HashMap params) + public static List toCSG(CSGDatabaseInstance db, ArrayList params) throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException { - File stl = File.createTempFile("build123d_temp", ".stl"); - stl.deleteOnExit(); - return toCSG(db, null, stl, params); + Path tempDir = Files.createTempDirectory("build123d-"); + + return toCSG(db, null, tempDir, params); } - public static CSG toCSG(CSGDatabaseInstance db, File stl, HashMap params) + public static List toCSG(CSGDatabaseInstance db, Path stl, ArrayList params) throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException { return toCSG(db, null, stl, params); } - public static CSG toCSG(CSGDatabaseInstance db, File code, File stl, HashMap params) + public static List toCSG(CSGDatabaseInstance db, File code, Path stl, ArrayList params) throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException { toSTLFile(code,stl,params); - CSG back = Vitamins.get(db,stl,true); - back.setColor(Color.ANTIQUEWHITE); + + ArrayList back=new ArrayList(); + for(File f:stl.toFile().listFiles()) { + CSG b= Vitamins.get(db,f,true); + b.setColor(Color.ANTIQUEWHITE); + back.add(b); + } return back; } @@ -75,29 +83,29 @@ public ArrayList getFileExtenetion() { - public static void toSTLFile(File stlout, HashMap params) throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException { + public static void toSTLFile(Path stlout, ArrayList params) throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException { toSTLFile(null,stlout,params); } - public static void toSTLFile(File build123dScript,File stlout, HashMap params) throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException { + public static void toSTLFile(File build123dScript,Path stlout, ArrayList params) throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException { File exe = getConfigExecutable("build123d", null); File dir = getDestinationDir("build123d"); if(params==null) - params=new HashMap(); + params=new ArrayList< Object>(); ArrayList args = new ArrayList<>(); - if(stlout.exists()) - stlout.delete(); + if(!stlout.toFile().isDirectory()) + throw new RuntimeException("Output file should be a directory"); args.add(exe.getAbsolutePath()); args.add("run"); args.add("python"); - for(String key:params.keySet()) { - args.add("-D"); - args.add(key+"="+params.get(key)); + args.add("build123d_cli"); + for(Object key:params) { + args.add(key.toString()); } if(build123dScript!=null) args.add(build123dScript.getAbsolutePath()); -// args.add("-o"); -// args.add(stlout.getAbsolutePath()); + args.add("export_directory"); + args.add(stlout.toFile().getAbsolutePath()); legacySystemRun(null, dir, System.out, args); } @Override @@ -119,8 +127,8 @@ public static void main(String[] args) throws InvalidRemoteException, TransportE File testblend = new File("build123dTest.py"); if(!testblend.exists()) loader.getDefaultContents(testblend); - HashMap params = new HashMap(); - toSTLFile(testblend, new File("build123dTest.py.stl"),params); + ArrayList params = new ArrayList< Object>(); + toSTLFile(testblend, new File("build123dTest").toPath(),params); } } diff --git a/test/java/src/junit/bowler/Build123dTest.java b/test/java/src/junit/bowler/Build123dTest.java index c68f8c7e..810de3cd 100644 --- a/test/java/src/junit/bowler/Build123dTest.java +++ b/test/java/src/junit/bowler/Build123dTest.java @@ -3,12 +3,8 @@ import static org.junit.Assert.*; import java.io.File; -import java.io.IOException; import java.util.HashMap; -import org.eclipse.jgit.api.errors.GitAPIException; -import org.eclipse.jgit.api.errors.InvalidRemoteException; -import org.eclipse.jgit.api.errors.TransportException; import org.junit.Ignore; import org.junit.Test; @@ -16,21 +12,16 @@ import com.neuronrobotics.bowlerstudio.scripting.ScriptingEngine; import com.neuronrobotics.sdk.common.Log; +import eu.mihosoft.vrl.v3d.parametrics.CSGDatabase; + public class Build123dTest { @Test - public void test() throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException { - Build123dLoader loader = new Build123dLoader(); + public void test() throws Exception { Log.enableDebugPrint(); - // create test file - File testblend = new File("build123dTest.py"); - if(!testblend.exists()) - loader.getDefaultContents(testblend); - HashMap params = new HashMap(); - Build123dLoader.toSTLFile(testblend, new File("build123dTest.py.stl"),params); - - File gears = ScriptingEngine.fileFromGit("https://github.com/GarryBGoode/gggears.git", "examples/examples.py"); - Build123dLoader.toSTLFile(gears, new File("gears.stl"),params); + //ScriptingEngine.pull("https://github.com/madhephaestus/CaDoodle-Example-Objects.git"); + ScriptingEngine.gitScriptRun(CSGDatabase.getInstance(), + "https://github.com/madhephaestus/CaDoodle-Example-Objects.git", "build123d/gggears.groovy"); } From 6aa02b2431dfc77805eebde0869f24288856cca2 Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Sun, 11 Jan 2026 20:06:07 -0500 Subject: [PATCH 3/8] unit test should fail if no files created --- .../bowlerstudio/scripting/Build123dLoader.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/neuronrobotics/bowlerstudio/scripting/Build123dLoader.java b/src/main/java/com/neuronrobotics/bowlerstudio/scripting/Build123dLoader.java index bb04b3aa..92a43144 100644 --- a/src/main/java/com/neuronrobotics/bowlerstudio/scripting/Build123dLoader.java +++ b/src/main/java/com/neuronrobotics/bowlerstudio/scripting/Build123dLoader.java @@ -60,6 +60,8 @@ public static List toCSG(CSGDatabaseInstance db, File code, Path stl, Arra b.setColor(Color.ANTIQUEWHITE); back.add(b); } + if(back.size()==0) + throw new IOException("Failed to create files"); return back; } @@ -86,7 +88,7 @@ public ArrayList getFileExtenetion() { public static void toSTLFile(Path stlout, ArrayList params) throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException { toSTLFile(null,stlout,params); } - public static void toSTLFile(File build123dScript,Path stlout, ArrayList params) throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException { + public static void toSTLFile(File build123dScript,Path stlout, ArrayList params) throws IOException, InterruptedException { File exe = getConfigExecutable("build123d", null); File dir = getDestinationDir("build123d"); if(params==null) From d1937654f61f18fb13d8d2a25280392f10709098 Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Sun, 11 Jan 2026 20:07:58 -0500 Subject: [PATCH 4/8] fail in the test, produce working list in code --- .../bowlerstudio/scripting/Build123dLoader.java | 2 -- test/java/src/junit/bowler/Build123dTest.java | 8 +++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/neuronrobotics/bowlerstudio/scripting/Build123dLoader.java b/src/main/java/com/neuronrobotics/bowlerstudio/scripting/Build123dLoader.java index 92a43144..4e65d75f 100644 --- a/src/main/java/com/neuronrobotics/bowlerstudio/scripting/Build123dLoader.java +++ b/src/main/java/com/neuronrobotics/bowlerstudio/scripting/Build123dLoader.java @@ -60,8 +60,6 @@ public static List toCSG(CSGDatabaseInstance db, File code, Path stl, Arra b.setColor(Color.ANTIQUEWHITE); back.add(b); } - if(back.size()==0) - throw new IOException("Failed to create files"); return back; } diff --git a/test/java/src/junit/bowler/Build123dTest.java b/test/java/src/junit/bowler/Build123dTest.java index 810de3cd..b77598ce 100644 --- a/test/java/src/junit/bowler/Build123dTest.java +++ b/test/java/src/junit/bowler/Build123dTest.java @@ -3,6 +3,8 @@ import static org.junit.Assert.*; import java.io.File; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashMap; import org.junit.Ignore; @@ -12,6 +14,7 @@ import com.neuronrobotics.bowlerstudio.scripting.ScriptingEngine; import com.neuronrobotics.sdk.common.Log; +import eu.mihosoft.vrl.v3d.CSG; import eu.mihosoft.vrl.v3d.parametrics.CSGDatabase; public class Build123dTest { @@ -20,8 +23,11 @@ public class Build123dTest { public void test() throws Exception { Log.enableDebugPrint(); //ScriptingEngine.pull("https://github.com/madhephaestus/CaDoodle-Example-Objects.git"); - ScriptingEngine.gitScriptRun(CSGDatabase.getInstance(), + ArrayList parts = (ArrayList)ScriptingEngine.gitScriptRun(CSGDatabase.getInstance(), "https://github.com/madhephaestus/CaDoodle-Example-Objects.git", "build123d/gggears.groovy"); + + if(parts.size()==0) + throw new IOException("Failed to create files"); } From 5f3044c70ff863a325e5d4414883234e9d84bce0 Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Sun, 11 Jan 2026 20:13:21 -0500 Subject: [PATCH 5/8] remove just at startup --- test/java/src/junit/bowler/GitHub.java | 36 -------------------------- 1 file changed, 36 deletions(-) diff --git a/test/java/src/junit/bowler/GitHub.java b/test/java/src/junit/bowler/GitHub.java index d0ea3004..d13d0d11 100644 --- a/test/java/src/junit/bowler/GitHub.java +++ b/test/java/src/junit/bowler/GitHub.java @@ -32,42 +32,6 @@ public class GitHub { private static boolean shutdownInProgress; - static { - Runtime.getRuntime().addShutdownHook(new Thread(() -> { - if (shutdownInProgress) return; - shutdownInProgress = true; - - Log.info("Beginning graceful shutdown..."); - - try { - // 1. Stop JavaFX - if ( isPlatformInitialized()&&Platform.isFxApplicationThread()) { - Platform.exit(); - Thread.sleep(300); - } - - - // 3. Force GC - System.gc(); - System.runFinalization(); - - // 4. Final wait - Thread.sleep(500); - - Log.info("Shutdown complete"); - } catch (Exception e) { - Log.error( e); - } - }, "Shutdown-Hook")); - } - private static boolean isPlatformInitialized() { - try { - Platform.runLater(() -> {}); - return true; - } catch (IllegalStateException e) { - return false; - } - } @Test public void test() throws Exception { From c92c0f297f66519ab7ab694fb1260bf826c1370d Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Sun, 11 Jan 2026 20:18:04 -0500 Subject: [PATCH 6/8] set image engine on start to pass unit tests --- .../bowlerstudio/scripting/cadoodle/CaDoodleFile.java | 3 ++- test/java/src/junit/bowler/Build123dTest.java | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/neuronrobotics/bowlerstudio/scripting/cadoodle/CaDoodleFile.java b/src/main/java/com/neuronrobotics/bowlerstudio/scripting/cadoodle/CaDoodleFile.java index d0aad781..5e2801d3 100644 --- a/src/main/java/com/neuronrobotics/bowlerstudio/scripting/cadoodle/CaDoodleFile.java +++ b/src/main/java/com/neuronrobotics/bowlerstudio/scripting/cadoodle/CaDoodleFile.java @@ -277,6 +277,7 @@ public void initialize() { // if (initializing) // throw new RuntimeException("Can not initialize while initializing."); fireInitializationStart(); + setImageEngine(new ThumbnailImage()); initializing = true; if (timeCreated < 0) timeCreated = System.currentTimeMillis(); @@ -1505,7 +1506,7 @@ public ThumbnailImage getImageEngine() { return imageEngine; } - public void setImageEngine(ThumbnailImage imageEngine) { + private void setImageEngine(ThumbnailImage imageEngine) { this.imageEngine = imageEngine; } } diff --git a/test/java/src/junit/bowler/Build123dTest.java b/test/java/src/junit/bowler/Build123dTest.java index b77598ce..74160f27 100644 --- a/test/java/src/junit/bowler/Build123dTest.java +++ b/test/java/src/junit/bowler/Build123dTest.java @@ -26,8 +26,8 @@ public void test() throws Exception { ArrayList parts = (ArrayList)ScriptingEngine.gitScriptRun(CSGDatabase.getInstance(), "https://github.com/madhephaestus/CaDoodle-Example-Objects.git", "build123d/gggears.groovy"); - if(parts.size()==0) - throw new IOException("Failed to create files"); +// if(parts.size()==0) +// throw new IOException("Failed to create files"); } From e3b9c05a6e1377cdd6e51bc7a04275c84e52d126 Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Sun, 11 Jan 2026 20:31:38 -0500 Subject: [PATCH 7/8] remove build error --- test/java/src/junit/bowler/Build123dTest.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/java/src/junit/bowler/Build123dTest.java b/test/java/src/junit/bowler/Build123dTest.java index ab74f4f3..74160f27 100644 --- a/test/java/src/junit/bowler/Build123dTest.java +++ b/test/java/src/junit/bowler/Build123dTest.java @@ -3,10 +3,7 @@ import static org.junit.Assert.*; import java.io.File; -<<<<<<< HEAD import java.io.IOException; -======= ->>>>>>> branch 'development' of git@github.com:CommonWealthRobotics/bowler-script-kernel.git import java.util.ArrayList; import java.util.HashMap; From f5cd1dacf77326d13f85ea974fb552d4d349f983 Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Sun, 11 Jan 2026 21:12:01 -0500 Subject: [PATCH 8/8] working loader --- .../scripting/Build123dLoader.java | 79 +++++++++++-------- test/java/src/junit/bowler/Build123dTest.java | 4 +- 2 files changed, 46 insertions(+), 37 deletions(-) diff --git a/src/main/java/com/neuronrobotics/bowlerstudio/scripting/Build123dLoader.java b/src/main/java/com/neuronrobotics/bowlerstudio/scripting/Build123dLoader.java index 4e65d75f..018b296b 100644 --- a/src/main/java/com/neuronrobotics/bowlerstudio/scripting/Build123dLoader.java +++ b/src/main/java/com/neuronrobotics/bowlerstudio/scripting/Build123dLoader.java @@ -1,4 +1,5 @@ package com.neuronrobotics.bowlerstudio.scripting; + import static com.neuronrobotics.bowlerstudio.scripting.DownloadManager.*; import java.io.File; @@ -26,45 +27,50 @@ public class Build123dLoader implements IScriptingLanguage { @Override - public Object inlineScriptRun(CSGDatabaseInstance db,File code, ArrayList args) throws Exception { - ArrayList params=new ArrayList<>(); - if(args!=null) { + public Object inlineScriptRun(CSGDatabaseInstance db, File code, ArrayList args) throws Exception { + ArrayList params = new ArrayList<>(); + if (args != null) { Object o = args.get(0); - if(HashMap.class.isInstance(o)) { - params=(ArrayList)o; + if (HashMap.class.isInstance(o)) { + params = (ArrayList) o; } } Path tempDir = Files.createTempDirectory("build123d-"); - + List back = toCSG(db, code, tempDir, params); return back; } + public static List toCSG(CSGDatabaseInstance db, ArrayList params) throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException { Path tempDir = Files.createTempDirectory("build123d-"); return toCSG(db, null, tempDir, params); } - public static List toCSG(CSGDatabaseInstance db, Path stl, ArrayList params) + + public static List toCSG(CSGDatabaseInstance db, Path stl, ArrayList params) throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException { return toCSG(db, null, stl, params); } - public static List toCSG(CSGDatabaseInstance db, File code, Path stl, ArrayList params) + public static List toCSG(CSGDatabaseInstance db, File code, Path stl, ArrayList params) throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException { - toSTLFile(code,stl,params); - - ArrayList back=new ArrayList(); - for(File f:stl.toFile().listFiles()) { - CSG b= Vitamins.get(db,f,true); - b.setColor(Color.ANTIQUEWHITE); - back.add(b); + toSTLFile(code, stl, params); + + ArrayList back = new ArrayList(); + for (File f : stl.toFile().listFiles()) { + Log.debug("Loading " + f); + if (f.getName().toLowerCase().endsWith(".stl")) { + CSG b = Vitamins.get(db, f, true); + b.setColor(Color.ANTIQUEWHITE); + back.add(b); + } } return back; } @Override - public Object inlineScriptRun(CSGDatabaseInstance db,String code, ArrayList args) throws Exception { + public Object inlineScriptRun(CSGDatabaseInstance db, String code, ArrayList args) throws Exception { throw new RuntimeException("Build123d can not run from a string"); } @@ -81,38 +87,40 @@ public ArrayList getFileExtenetion() { return ext; } - - - public static void toSTLFile(Path stlout, ArrayList params) throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException { - toSTLFile(null,stlout,params); + public static void toSTLFile(Path stlout, ArrayList params) + throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException { + toSTLFile(null, stlout, params); } - public static void toSTLFile(File build123dScript,Path stlout, ArrayList params) throws IOException, InterruptedException { + + public static void toSTLFile(File build123dScript, Path stlout, ArrayList params) + throws IOException, InterruptedException { File exe = getConfigExecutable("build123d", null); File dir = getDestinationDir("build123d"); - if(params==null) - params=new ArrayList< Object>(); + if (params == null) + params = new ArrayList(); ArrayList args = new ArrayList<>(); - if(!stlout.toFile().isDirectory()) + if (!stlout.toFile().isDirectory()) throw new RuntimeException("Output file should be a directory"); args.add(exe.getAbsolutePath()); args.add("run"); args.add("python"); - args.add("build123d_cli"); - for(Object key:params) { + if (build123dScript != null) + args.add(build123dScript.getAbsolutePath()); + else + args.add(".venv/lib64/python3.12/site-packages/build123d_cli/build123d_cli.py"); + for (Object key : params) { args.add(key.toString()); } - if(build123dScript!=null) - args.add(build123dScript.getAbsolutePath()); + args.add("export_directory"); args.add(stlout.toFile().getAbsolutePath()); legacySystemRun(null, dir, System.out, args); } + @Override public String getDefaultContents() { - return "from build123d import *\n" - + "\n" - + "cube = Box(10, 10, 10)"; + return "from build123d import *\n" + "\n" + "cube = Box(10, 10, 10)"; } @Override @@ -120,15 +128,16 @@ public boolean getIsTextFile() { return true; } - public static void main(String[] args) throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException { + public static void main(String[] args) + throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException { Build123dLoader loader = new Build123dLoader(); Log.enableDebugPrint(); // create test file File testblend = new File("build123dTest.py"); - if(!testblend.exists()) + if (!testblend.exists()) loader.getDefaultContents(testblend); - ArrayList params = new ArrayList< Object>(); - toSTLFile(testblend, new File("build123dTest").toPath(),params); + ArrayList params = new ArrayList(); + toSTLFile(testblend, new File("build123dTest").toPath(), params); } } diff --git a/test/java/src/junit/bowler/Build123dTest.java b/test/java/src/junit/bowler/Build123dTest.java index 74160f27..b77598ce 100644 --- a/test/java/src/junit/bowler/Build123dTest.java +++ b/test/java/src/junit/bowler/Build123dTest.java @@ -26,8 +26,8 @@ public void test() throws Exception { ArrayList parts = (ArrayList)ScriptingEngine.gitScriptRun(CSGDatabase.getInstance(), "https://github.com/madhephaestus/CaDoodle-Example-Objects.git", "build123d/gggears.groovy"); -// if(parts.size()==0) -// throw new IOException("Failed to create files"); + if(parts.size()==0) + throw new IOException("Failed to create files"); }