_Design Woodworking Projects_
_Usage_
Start by declaring the dimensions of the wood that you will be using.
`
@Custom
var decking = Wood( "decking", 120, 24 )
@Custom
var boxSize = Vector3( 1000, 400 )
`
Then for each piece in the final product :
1. Cut the wood to length
2. Add joints
Each joint is cut from one side of the wood. One of either :
FACE-SIDE, FACE-EDGE, OPPOSITE-SIDE or OPPOSITE-EDGE
3. Label it (so that later you can use Build->Open Parts)
4. Orient, and move it to its final position.
e.g.
`
override fun build() : Shape3d {
val leftAndRight = decking.cut( boxSize.x ) // 1. Cut
.mitre( FACE-EDGE ).bothEnds() // 2. Add joints
.lap( FACE-EDGE ).ratioAlong( 0.5 )
.label( "leftAndRight" ) // 3. Label it
.alongYb() // 4. Orient
.centerY().leftTo( -boxSize.left / 2 ) // and move
.mirrorX().also() // Duplicate to create the right piece too.
val frontAndBack = ...
return leftAndRight + frontAndBack
}
`
_Introducing the Classes_
The only `type` in the example above is [Wood], but there are others used along the way.
[Wood].#cut( length )# returns a [CutPieceOfWood].
_[CutPieceOfWood]_
It is a simple extrusion along the Z axis. Usually of a rectangle, but [Wood] can have any
[Shape2d] cross sectional profile.
The next step is to add joints, such as #.mitre( side )# and #.lap( side )#.
These return a [JointedPieceOfWood]. It represents the [CutPieceOfWood] with a chunk cut out of it.
We can add more joints, and we get another [JointedPieceOfWood]
This time, the piece is cut from the previous [JointedPieceOfWood], instead of directly from the [CutPieceOfWood].
_[JointedPieceOfWood]_
All joints work in the same way, using the same class.
When we cut a `Mitre` joint, we draw a triangle on the face or side of the wood, and then cut all the way through.
When we cut a `Lap` joint, we draw a rectangle, and then cut half way through.
Here are the properties of a [Jointed] :
#side# : The side of the wood we start cutting from. (FACE-SIDE, FACE-EDGE, OPPOSITE-SIDE, OPPOSITE-EDGE)
#shape# : The shape we are going to cut out (e.g. a Square or Triangle)
#depth# : How far through we are going to cut (the full width/thickness for a mitre joint, or half of that for a lap joint)
#offset# : We can create a `mortice` joint by making #depth# 1/3 of the width, and then setting #offset# to 1/3 too.
i.e. we can `chisel` out the middle, rather than cutting from the side/edge.
#along# : The position of the joint along the piece of wood.
We can adjust this using [Jointed].#along( distance )# or [Jointed].#alongRatio( ratio )#
_[PieceOfWood]_
This is the abstract base class for [CutPieceOfWood] and [JointedPieceOfWood].
It has all the methods for adding joints, such as #lap( side )# and #mitre( side )#.