← The window · Contents · Shape the tank →

3. The first block

Every model starts from a simple shape. Ours is a block, and by the end of this page it has the rounded corners of the tank, the part of the planter that holds the water.

A new model

  1. Click the New button, the first at the top left, or press Ctrl+N. A new model appears, a few lines that make Carlo: a start to replace with your own.

  2. Select all its code (Ctrl+A) and type, or paste, these lines in its place:

    module planter;
    
    import std;
    
    @part("sienna")
    Solid tank() => box(62.mm, 62.mm, 66.mm);
    
  3. Save it (Ctrl+S) as planter.hcad, in a folder of your own.

The view shows a block at once. What the lines say:

The block

Round the corners with the mouse

The tank should have round corners. You do not need to know how to write that: select the corners and ask.

  1. In the view bar, click the button that picks edges, the third of the four (or press Alt+3): a click now picks an edge, not a face. Click one of the upright edges of the block. It turns orange, and the line of code that made it is highlighted in the editor.

  2. Click the other upright edges you can see: each click adds to what is selected (click one again to take it away; a click on nothing, Esc or Space empties the selection).

  3. The fourth edge is at the back. Drag with the right mouse button to turn the view until you see it, click it, then click Iso in the bar over the view to come back. The note at the bottom right counts what you selected: 4 edges selected.

    Four edges selected

  4. Right-click one of the selected edges. The menu lists what can be done with them.

    The menu of the edges

  5. Choose Fillet 4 edges…. A line appears in the code, and the size of the rounding, 1.mm, is already selected for you to change.

    The fillet added

  6. Type 10.mm. The corners round off as you type.

Press Esc to empty the selection. If something went wrong, Ctrl+Z undoes it.

What the mouse wrote

@part("sienna")
Solid tank()
{
    return box(62.mm, 62.mm, 66.mm)
        .fillet(edges.parallel(Z), r: 10.mm);
}

A part made in several steps reads better as a list, one step per line: hackerscad rewrote the one line you typed that way. The part now returns a box, then rounds it:

The edges are named by what they are, not by where you clicked: if you change the size of the box later, the same edges are rounded.

Check

Your window should look like this. If it does not, open planter-03.hcad, the model as it is at the end of this page, and go on from there.

The block with round corners

← The window · Contents · Shape the tank →