Skip to content

Instantly share code, notes, and snippets.

@madhephaestus
Last active February 23, 2016 17:56
Show Gist options
  • Select an option

  • Save madhephaestus/8293fd82108b2b9ec635 to your computer and use it in GitHub Desktop.

Select an option

Save madhephaestus/8293fd82108b2b9ec635 to your computer and use it in GitHub Desktop.
Pen Holder - Holds Pens
import eu.mihosoft.vrl.v3d.parametrics.*;
[hexSideLength = 15, hexWidth = 3]
[rowRadius = 46.1549, numberOfHexPerRow = 30]
//Returns a single side for a hex
CSG getSide()
{
return new Cube(hexWidth, hexWidth, hexSideLength).noCenter()
.toCSG()
.roty(90)
.movex(7.5)
.movey(-1.5)
.movez(-1.5);
}
//Returns a single hex
CSG getHex()
{
//Final hex
//Starts as top side
CSG hex = getSide().movez(23);
//Bottom side
CSG bottomSide = getSide();
hex = hex.union(bottomSide);
//Bottom left side
CSG bottomLeftSide = getSide().roty(-60)
.movez(5.75)
.movex(-10);
hex = hex.union(bottomLeftSide);
//Top left side
CSG topLeftSide = getSide().roty(60)
.movez(17.25)
.movex(-10);
hex = hex.union(topLeftSide);
//Bottom right side
CSG bottomRightSide = getSide().roty(60)
.movez(5.75)
.movex(10);
hex = hex.union(bottomRightSide);
//Top right side
CSG topRightSide = getSide().roty(-60)
.movez(17.25)
.movex(10);
hex = hex.union(topRightSide);
return hex;
}
CSG getRow()
{
//Final row
CSG row = getHex();
//Add hex to form complete row
for (i = 1; i < numberOfHexPerRow; i++)
{
row = row.union(row.rotz(-360 / numberOfHexPerRow)//.rotz(-12.4138)
.movex(29)
.movey(3.15));
}
return row;
}
CSG getTube()
{
//Final tube
CSG tube = getRow().movey(-143);
BowlerStudioController.setCsg(tube,null)
//Add rows to form complete tube
for (i = 1; i < 10; i++)
{
CSG newRow = tube.rotz(0)
//.movex(-92.3099)
//.movey(35)
.movez(25)
BowlerStudioController.addCsg(newRow)
tube = tube.union(newRow);
}
return tube;
}
return getTube()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment