Smith.Path (Smith v0.1.0)

Copy Markdown View Source

An ordered, open chain of world-coordinate edge recipes.

Use Smith.line/2, Smith.arc/6, and Smith.spline/2 to describe the edges. Their directed endpoints must meet in the supplied order within 1.0e-7 mm. Smith does not reorder or reverse them to make a connection. Geometry is created only when the path or a consuming sweep is evaluated.

iex> path = Smith.Path.new([Smith.line({0, 0, 0}, {0, 0, 10})])
iex> {:ok, wire} = Smith.evaluate(path)
iex> OCEx.length(wire.shape)
{:ok, 10.0}

A path evaluates to a wire, not a printable solid. Pass it to Smith.sweep/3 with a placed sketch to create one. Paths do not currently support closed loops or automatic profile placement. A connected path can still self-intersect; connection checks are not a collision test.

Summary

Functions

Returns a new path with one edge recipe appended to its end.

Records an ordered nonempty list of edge recipes.

Types

t()

@type t() :: %Smith.Path{edges: [Smith.Model.t()]}

Functions

append(path, edge)

@spec append(t(), Smith.Model.t()) :: t()

Returns a new path with one edge recipe appended to its end.

new(edges)

@spec new([Smith.Model.t()]) :: t()

Records an ordered nonempty list of edge recipes.

Validation is deferred. Empty lists, non-edge results, disconnected edges, and closed paths fail when evaluated. Each edge keeps its own world placement.