Skip to content

Commit edaba5d

Browse files
committed
removing depricated API
1 parent 48d8ff9 commit edaba5d

File tree

14 files changed

+157
-141
lines changed

14 files changed

+157
-141
lines changed

src/main/java/com/neuronrobotics/bowlerstudio/assets/ConfigurationDatabase.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.neuronrobotics.bowlerstudio.scripting.ScriptingEngine;
2424

2525
import eu.mihosoft.vrl.v3d.parametrics.CSGDatabase;
26+
import eu.mihosoft.vrl.v3d.parametrics.CSGDatabaseInstance;
2627

2728
import java.nio.charset.*;
2829
import java.nio.file.Files;
@@ -164,7 +165,7 @@ public static void getDatabase() {
164165
File loadFile = loadFile();
165166
if(loadFile.exists())
166167
try {
167-
Object inlineFileScriptRun = ScriptingEngine.inlineFileScriptRun(CSGDatabase.getInstance(),loadFile, null);
168+
Object inlineFileScriptRun = ScriptingEngine.inlineFileScriptRun(new CSGDatabaseInstance(new File("CSGdatabase.json")),loadFile, null);
168169
database = Collections.synchronizedMap((HashMap<String, HashMap<String, Object>>) inlineFileScriptRun);
169170

170171
} catch (Exception e) {

src/main/java/com/neuronrobotics/bowlerstudio/creature/CadFileExporter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import eu.mihosoft.vrl.v3d.FileUtil;
1717
import eu.mihosoft.vrl.v3d.JavaFXInitializer;
1818
import eu.mihosoft.vrl.v3d.Transform;
19+
import eu.mihosoft.vrl.v3d.parametrics.CSGDatabaseInstance;
1920
import eu.mihosoft.vrl.v3d.svg.SVGExporter;
2021
import javafx.scene.transform.Affine;
2122

@@ -186,7 +187,7 @@ private File makeBlender(String nameBase,List<CSG> current ) throws IOException
186187
File blend = new File(nameBase + ".blend");
187188
com.neuronrobotics.sdk.common.Log.debug("Writing "+blend.getAbsolutePath());
188189
for(CSG tmp:current)
189-
BlenderLoader.toBlenderFile(tmp, blend);
190+
BlenderLoader.toBlenderFile(null,tmp, blend);
190191
return blend;
191192
}
192193

src/main/java/com/neuronrobotics/bowlerstudio/creature/ControllerOption.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public void build(CaDoodleFile f) {
8383
dir.mkdirs();
8484
stlFile = new File(absolutePath + delim() + type + ".stl");
8585
if ( stlFile.exists()) {
86-
indicator = Vitamins.get(stlFile);
86+
indicator = Vitamins.get(f.getCsgDBinstance(),stlFile);
8787
getIndicator().setColor(Color.WHITE);
8888
return;
8989
}else {

src/main/java/com/neuronrobotics/bowlerstudio/creature/LimbOption.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public void build(CaDoodleFile f) throws IOException {
122122
File imageFile = new File(absolutePath + delim() + type + name + ".png");
123123
File stlFile = new File(absolutePath + delim() + type + name + ".stl");
124124
if (imageFile.exists() && stlFile.exists()) {
125-
indicator = Vitamins.get(stlFile);
125+
indicator = Vitamins.get(f.getCsgDBinstance(),stlFile);
126126
indicator=indicator.transformed(TransformFactory.nrToCSG(LimbRotationOffset));
127127
indicator.setColor(Color.WHITE);
128128
image = new Image(imageFile.toURI().toString());

src/main/java/com/neuronrobotics/bowlerstudio/scripting/BlenderLoader.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ public class BlenderLoader implements IScriptingLanguage {
2424
public Object inlineScriptRun(CSGDatabaseInstance db,File code, ArrayList<Object> args) throws Exception {
2525
File stl = File.createTempFile(code.getName(), ".stl");
2626
stl.deleteOnExit();
27-
toSTLFile(code,stl);
28-
CSG back = Vitamins.get(stl,true);
27+
toSTLFile(db,code,stl);
28+
CSG back = Vitamins.get(db,stl,true);
2929
back.setColor(Color.ORANGE);
3030
return back;
3131
}
@@ -46,13 +46,13 @@ public ArrayList<String> getFileExtenetion() {
4646
ext.add("blend");
4747
return ext;
4848
}
49-
public static void toBlenderFile(CSG stlIn,File blenderfile) throws IOException {
49+
public static void toBlenderFile(CSGDatabaseInstance db,CSG stlIn,File blenderfile) throws IOException {
5050
File stl = getTmpSTL(stlIn);
51-
toBlenderFile(stl, blenderfile);
51+
toBlenderFile(db,stl, blenderfile);
5252
}
5353

5454

55-
public static void toBlenderFile(File stl,File blenderfile) {
55+
public static void toBlenderFile(CSGDatabaseInstance db,File stl,File blenderfile) {
5656
com.neuronrobotics.sdk.common.Log.error("Converting to Blender file before loading");
5757

5858
File stlIn;
@@ -64,7 +64,7 @@ public static void toBlenderFile(File stl,File blenderfile) {
6464
return;
6565
}
6666
stlIn.deleteOnExit();
67-
scaleStl(stl,stlIn,0.001);
67+
scaleStl(db,stl,stlIn,0.001);
6868
File dir = stlIn.getAbsoluteFile().getParentFile();
6969

7070
try {
@@ -91,8 +91,8 @@ public static void toBlenderFile(File stl,File blenderfile) {
9191
return;
9292
}
9393
}
94-
public static void scaleStl(File incoming, File outgoing, double scale) {
95-
CSG back = Vitamins.get(incoming,true).scale(scale);
94+
public static void scaleStl(CSGDatabaseInstance db,File incoming, File outgoing, double scale) {
95+
CSG back = Vitamins.get(db,incoming,true).scale(scale);
9696
try {
9797
boolean manifold=CSG.isPreventNonManifoldTriangles();
9898
CSG.setPreventNonManifoldTriangles(false);
@@ -104,19 +104,19 @@ public static void scaleStl(File incoming, File outgoing, double scale) {
104104
com.neuronrobotics.sdk.common.Log.error(e);
105105
}
106106
}
107-
public static CSG remesh(CSG incoming, double MMVoxel,CSGDatabaseInstance instance) throws Exception {
107+
public static CSG remesh(CSGDatabaseInstance db,CSG incoming, double MMVoxel,CSGDatabaseInstance instance) throws Exception {
108108
File stl = DownloadManager.getTmpSTL(incoming);
109-
remeshSTLFile(stl, MMVoxel);
110-
CSG back = Vitamins.get(stl,true);
109+
remeshSTLFile(db,stl, MMVoxel);
110+
CSG back = Vitamins.get(db,stl,true);
111111
return back.syncProperties(instance,incoming).setName(incoming.getName());
112112
}
113-
public static void remeshSTLFile(File stlout,double MMVoxel) throws Exception {
113+
public static void remeshSTLFile(CSGDatabaseInstance db,File stlout,double MMVoxel) throws Exception {
114114
File blend = File.createTempFile(stlout.getName(), ".blend");
115115
blend.delete();
116-
toBlenderFile(stlout, blend);
117-
remeshToSTLFile(blend, stlout, MMVoxel);
116+
toBlenderFile(db,stlout, blend);
117+
remeshToSTLFile(db,blend, stlout, MMVoxel);
118118
}
119-
public static void remeshToSTLFile(File blenderfile,File stlout,double MMVoxel) throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException {
119+
public static void remeshToSTLFile(CSGDatabaseInstance db,File blenderfile,File stlout,double MMVoxel) throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException {
120120
File exe = getConfigExecutable("blender", null);
121121
File export = ScriptingEngine.fileFromGit(
122122
"https://github.com/CommonWealthRobotics/blender-bowler-cli.git",
@@ -135,9 +135,9 @@ public static void remeshToSTLFile(File blenderfile,File stlout,double MMVoxel)
135135
args.add(""+(MMVoxel/1000.0));
136136
args.add(stlout.getAbsolutePath());
137137
legacySystemRun(null, stlout.getAbsoluteFile().getParentFile(), System.out, args);
138-
scaleStl(stlout,stlout,1000.0);
138+
scaleStl(db,stlout,stlout,1000.0);
139139
}
140-
public static void toSTLFile(File blenderfile,File stlout) throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException {
140+
public static void toSTLFile(CSGDatabaseInstance db,File blenderfile,File stlout) throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException {
141141
File exe = getConfigExecutable("blender", null);
142142
File export = ScriptingEngine.fileFromGit(
143143
"https://github.com/CommonWealthRobotics/blender-bowler-cli.git",
@@ -155,7 +155,7 @@ public static void toSTLFile(File blenderfile,File stlout) throws InvalidRemoteE
155155
args.add(blenderfile.getAbsolutePath());
156156
args.add(stlout.getAbsolutePath());
157157
legacySystemRun(null, stlout.getAbsoluteFile().getParentFile(), System.out, args);
158-
scaleStl(stlout,stlout,1000.0);
158+
scaleStl(db,stlout,stlout,1000.0);
159159
}
160160
@Override
161161
public void getDefaultContents(File source) {
@@ -200,7 +200,7 @@ public static void main(String[] args) throws InvalidRemoteException, TransportE
200200
File testblend = new File("test.blend");
201201
if(!testblend.exists())
202202
loader.getDefaultContents(testblend);
203-
loader.toSTLFile(testblend, new File("testBlender.stl"));
203+
loader.toSTLFile(null,testblend, new File("testBlender.stl"));
204204
}
205205

206206
}

src/main/java/com/neuronrobotics/bowlerstudio/scripting/Build123dLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public Object inlineScriptRun(CSGDatabaseInstance db,File code, ArrayList<Object
3535
}
3636

3737
toSTLFile(code,stl,params);
38-
CSG back = Vitamins.get(stl,true);
38+
CSG back = Vitamins.get(db,stl,true);
3939
back.setColor(Color.ANTIQUEWHITE);
4040
return back;
4141
}

src/main/java/com/neuronrobotics/bowlerstudio/scripting/FreecadLoader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public Object inlineScriptRun(eu.mihosoft.vrl.v3d.parametrics.CSGDatabaseInstanc
5353
File stl = File.createTempFile(code.getName(), ".stl");
5454
stl.deleteOnExit();
5555
toSTLFile(code,stl);
56-
CSG back = Vitamins.get(stl,true);
56+
CSG back = Vitamins.get(db,stl,true);
5757
back.setColor(Color.BLUE);
5858
return back;
5959
}
@@ -243,7 +243,7 @@ public static void main(String[] args) throws InvalidRemoteException, TransportE
243243
File stlToImport =ScriptingEngine.fileFromGit(
244244
"https://github.com/NeuronRobotics/NASACurisoity.git"
245245
, "STL/upper-arm.STL");
246-
CSG toSlice = Vitamins.get(stlToImport,true);
246+
CSG toSlice = Vitamins.get(null,stlToImport,true);
247247
// toSlice=toSlice.union(
248248
// new Cube(20).toCSG()
249249
// .toXMin()

src/main/java/com/neuronrobotics/bowlerstudio/scripting/ObjLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class ObjLoader implements IScriptingLanguage {
1212

1313
@Override
1414
public Object inlineScriptRun(eu.mihosoft.vrl.v3d.parametrics.CSGDatabaseInstance db,File code, ArrayList<Object> args) throws Exception {
15-
CSG sllLoaded = Vitamins.get(code);
15+
CSG sllLoaded = Vitamins.get(db,code);
1616
return sllLoaded;
1717
}
1818

src/main/java/com/neuronrobotics/bowlerstudio/scripting/OpenSCADLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public Object inlineScriptRun(eu.mihosoft.vrl.v3d.parametrics.CSGDatabaseInstanc
3333
}
3434

3535
toSTLFile(code,stl,params);
36-
CSG back = Vitamins.get(stl,true);
36+
CSG back = Vitamins.get(db,stl,true);
3737
back.setColor(Color.YELLOW);
3838
return back;
3939
}

0 commit comments

Comments
 (0)