Working with Paths
- Path is used to construct complex wires and faces by creating series of edges. Most of the methods return instance of this path for quick chaining.
- Edges can be linear or curved.
- A wire can be created from an open path.
- For a face, path needs to be closed.
Note
Every path must start with start() method. Close the path if you need to create a face. Not closing path lets you use the edges for further operations, like, revolve.
Refer to the methods in the Path object for following operations.
Note, Path is just a helper object that lets you deal with edges and wires easily.
- A generic wire object: use wire() method
- To create Line: use line() method
- To Add a path segment in the X direction: xlineTo
- To Add a path segment in the Y direction: ylineTo
- To Add a path segment in the Z direction: zlineTo
- To create a two point point Arc: use arc2p() method
- To create 3 point Arc: use arc3p() method
- To create elliptical arc: use arcEllipse() method
- To create circular edge: use circle() method
- To create Hyperbolic edge: use hyperbola() method
Example
Following code creates a rectanglare face in X-Z plane.
var path = new cadlib.Path(true);
var width = 5, depth = 5;
path.start(0, 0, 0).zlineTo(depth).xlineTo(width).zlineTo(-depth).xlineTo(-width).close();
var face = path.face();