Skip to content

Commit 2cae087

Browse files
committed
cut top
1 parent bf90ca5 commit 2cae087

3 files changed

Lines changed: 130 additions & 18 deletions

File tree

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,6 @@ replay_pid*
2828
/.classpath
2929
/.cproject
3030
/cache/
31-
/*.class
31+
/*.class
32+
/CaseTop.stl
33+
/CaseBottom.stl

BaseBot.groovy

Lines changed: 95 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1+
import java.nio.file.Paths
2+
3+
import com.neuronrobotics.bowlerstudio.scripting.ScriptingEngine
14
import com.neuronrobotics.bowlerstudio.vitamins.Vitamins
25

36
import eu.mihosoft.vrl.v3d.CSG
47
import eu.mihosoft.vrl.v3d.Cube
58
import eu.mihosoft.vrl.v3d.Cylinder
9+
import eu.mihosoft.vrl.v3d.FileUtil
610
import eu.mihosoft.vrl.v3d.RoundedCube
11+
import eu.mihosoft.vrl.v3d.Transform
712
import eu.mihosoft.vrl.v3d.parametrics.LengthParameter
813

9-
// code here
14+
double caseRounding = 4
1015

1116
class BoardMaker{
1217
static double radius = 1
@@ -339,25 +344,25 @@ class BoardMaker{
339344
.difference(fullBoardMink)
340345
.difference(backBottomMink)
341346
CSG bottom = backBottom
342-
bottom.setManufacturing({ toMfg ->
343-
return toMfg
344-
.toXMin()
345-
.toYMin()
346-
.toZMin()
347-
})
348-
topPlate.setManufacturing({ toMfg ->
349-
return toMfg
350-
.toXMin()
351-
.toYMin()
352-
.rotx(-180)
353-
.toZMin()
354-
})
347+
// bottom.setManufacturing({ toMfg ->
348+
// return toMfg
349+
// .toXMin()
350+
// .toYMin()
351+
// .toZMin()
352+
// })
353+
// topPlate.setManufacturing({ toMfg ->
354+
// return toMfg
355+
// .toXMin()
356+
// .toYMin()
357+
// .rotx(-180)
358+
// .toZMin()
359+
// })
355360
bottom.setName("CaseBottom")
356361
topPlate.setName("CaseTop")
357362
def caseParts = [bottom,topPlate]
358363
return caseParts
359-
board.addAll(caseParts)
360-
return board
364+
//board.addAll(caseParts)
365+
//return board
361366
}
362367
def makeRoundedCyl(def rad,def height, def corner,def resolution){
363368
def minHeight = height-corner*2
@@ -378,7 +383,80 @@ class BoardMaker{
378383
return CSG.unionAll(cylParts).hull().toZMin()
379384
}
380385
}
381-
return new BoardMaker().makeCase()
386+
File dir = ScriptingEngine.getRepositoryCloneDirectory("https://github.com/BancroftSchoolOpenSource/ArduinoClassRobot.git")
387+
388+
File topSTL = new File(dir.getAbsolutePath()+"/CaseTop.stl")
389+
File botSTL = new File(dir.getAbsolutePath()+"/CaseBottom.stl")
390+
391+
if(!topSTL.exists()||!botSTL.exists()) {
392+
println "Producing Case STL part"
393+
def parts = new BoardMaker().makeCase()
394+
for(CSG part:parts) {
395+
FileUtil.write(Paths.get(dir.getAbsolutePath()+"/"+part.getName()+".stl"),
396+
part.toStlString());
397+
}
398+
}else {
399+
println "Loading Cas parts from STL"
400+
}
401+
402+
CSG top = Vitamins.get(topSTL);
403+
CSG bot = Vitamins.get(botSTL);
404+
top.setName("CaseTop")
405+
bot.setName("CaseBottom")
406+
bot.setManufacturing({ toMfg ->
407+
return toMfg
408+
.toXMin()
409+
.toYMin()
410+
.toZMin()
411+
})
412+
top.setManufacturing({ toMfg ->
413+
return toMfg
414+
.toXMin()
415+
.toYMin()
416+
.rotx(-180)
417+
.toZMin()
418+
})
419+
LengthParameter tailLength = new LengthParameter("Cable Cut Out Length",30,[500, 0.01])
420+
tailLength.setMM(100)
421+
CSG motor = Vitamins.get("hobbyServo", "tproSG90")
422+
CSG horn = Vitamins.get("hobbyServoHorn", "tproSG90_1")
423+
.movez(motor.getMaxZ())
424+
Transform leftSide = new Transform()
425+
Transform rightSide = new Transform()
426+
427+
CSG asmOfDrive = motor.union(horn).rotz(180)
428+
.movez(-8)
429+
.movey(10)
430+
431+
CSG leftDrive = asmOfDrive.transformed(leftSide)
432+
.roty(90)
433+
.movex(bot.getMinX())
434+
435+
CSG rightDrive = asmOfDrive.transformed(rightSide)
436+
.roty(-90)
437+
.movex(bot.getMaxX())
438+
439+
CSG bothDrive = leftDrive.union(rightDrive)
440+
.toZMax()
441+
.movez(bot.getMinZ())
442+
.movey(5)
443+
444+
CSG servoBlock = new Cube(bot.getTotalX()-caseRounding*2,bot.getTotalY()-caseRounding*2, bothDrive.getTotalZ())
445+
.toCSG()
446+
.toZMax()
447+
.movez(bot.getMinZ())
448+
.toYMax()
449+
.movey(bot.getMaxY()-caseRounding)
450+
.toXMax()
451+
.movex(bot.getMaxX()-caseRounding)
452+
CSG blockCordCut = servoBlock.toYMax()
453+
.movey(servoBlock.getMinY()+12)
454+
.movez(-5)
455+
bot=bot.union(servoBlock)
456+
.difference(bothDrive)
457+
.union(blockCordCut)
458+
459+
return [top,bot]
382460

383461

384462

printbed.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"locations": {
3+
"CaseBottom": {
4+
"x": 0.0,
5+
"y": 0.0,
6+
"z": 0.0,
7+
"rotation": {
8+
"storage": {
9+
"q0": 1.0,
10+
"q1": 0.0,
11+
"q2": 0.0,
12+
"q3": 0.0
13+
}
14+
}
15+
},
16+
"CaseTop": {
17+
"x": 73.18341010787285,
18+
"y": 90.98000445653607,
19+
"z": 0.0,
20+
"rotation": {
21+
"storage": {
22+
"q0": 1.0,
23+
"q1": 0.0,
24+
"q2": 0.0,
25+
"q3": 0.0
26+
}
27+
}
28+
}
29+
},
30+
"bedX": 240.0,
31+
"bedY": 200.0
32+
}

0 commit comments

Comments
 (0)