Edge

Edge object can be used to construct few common shapes, like arcs & circle quickly. A few methods on the cadlib object provide a wrapper around Edge object.

Methods
line()

Creates a line

Syntax

edge.line(p1, p2);

Parameters

Name Type descri[tion
p1 Point First Point
p2 Point Second Point

Returns

Edge

Example

let edge = new Edge();
let p1 = new Point(0, 0, 0);
let p2 = new Point(20, 20, 20)
let line = edge.line(p1, p2);

circle

Creates a Circle

Syntax

edge.circle(center, normal, radius);

Parameters

Name Type descri[tion
center Point Center
normal Vector Normal to the circle’s plane
radius Number Circle’s radius
Returns

Edge

Example

let edge = new Edge();

let circle = edge.circle(p1, p2);

arc3p

Creates an arc from 3 points

Syntax

edge.arc3p(start, end, aPoint);

Parameters

Name Type descri[tion
start Point Start point of the arc
end Point End point of the arc
aPoint Point A point on the arc

Returns

Edge

Example

let edge = new Edge();

let circle = edge.arc3p(start, end, aPoint);

wire

Creates a wire from edges

Syntax

edge.wire(lines);

Parameters

Name Type descri[tion
lines Array Array of Edges

Edge

Example

let edge = new Edge();

let circle = edge.arc3p(start, end, aPoint);