solid.Shape

Methods

Method Reference: solid.Shape.subtract

solid.Shape: C = subtract (A, B, …)

The difference of shapes, the material of the first in none of the others.

C = subtract (A, B, …) removes from A the material of every later shape, all in one operation. This is how a hole, a pocket or a slot is cut: model the material to remove and subtract it. Drilling a plate with a hundred holes in one call is an order of magnitude faster than a hundred calls of one hole each.

Removing empty shapes, or nothing, leaves A, and removing anything from the empty shape leaves the empty shape.

The result takes its colours from A; the shapes taken away give none, as solid.Shape.Colour describes.

 
 ## A plate drilled with twelve holes in one call
 plate = solid.box (100, 60, 8);
 [x, y] = meshgrid (10:16:90, [15, 45]);
 P = [x(:), y(:), zeros(numel (x), 1)];
 S = subtract (plate, copy (solid.cylinder (3, 8), P));
 numfaces (S)
 ⇒ 18

See also: solid.Shape.union, solid.Shape.intersect

Source Code: solid.Shape