jscad-object-api
v3.0.6
Published
Object wrappers of the JSCAD geometries
Downloads
59
Readme
Modules
geom2
- geom2
- .Geom2
- new exports.Geom2([geometry])
- instance
- .toSides() ⇒ Array
- .measureArea() ⇒ Float
- static
- .fromPoints() ⇒ Geom2
- .circle() ⇒ Geom2
- .Geom2
geom2.Geom2
Class Geom2
Holds a JSCAD 2D geometry (geom2) that represents a 2D geometry consisting of outlines, where each outline is an ordered list of points.
Kind: static class of geom2
- .Geom2
- new exports.Geom2([geometry])
- instance
- .toSides() ⇒ Array
- .measureArea() ⇒ Float
- static
- .fromPoints() ⇒ Geom2
- .circle() ⇒ Geom2
new exports.Geom2([geometry])
Create a new Geom2 from the given geometry
| Param | Type | Description | | --- | --- | --- | | [geometry] | geom2 | a JSCAD geom2 geometry |
Example
import { Geom2 } from "jscad-object-api"
const ashape = Geom2.square()
const bshape = Geom2.square({size: 10})
const cshape = ashape.translateY(5).extrudeLinear({height: 250})geom2.toSides() ⇒ Array
Return the sides
Kind: instance method of Geom2
Returns: Array - list of sides
geom2.measureArea() ⇒ Float
Kind: instance method of Geom2
Geom2.fromPoints() ⇒ Geom2
Kind: static method of Geom2
Returns: Geom2 - new geometry
Geom2.circle() ⇒ Geom2
Create a circle using the given options.
Kind: static method of Geom2
Returns: Geom2 - new geometry
geom3
- geom3
- .Geom3
- new exports.Geom3([geometry])
- instance
- .toPolygons() ⇒ Array
- static
- .fromVertices() ⇒ Geom3
- .cube() ⇒ Geom3
- .cuboid() ⇒ Geom3
- .cylinder() ⇒ Geom3
- .cylinderElliptic() ⇒ Geom3
- .ellipsoid() ⇒ Geom3
- .geodesicSphere() ⇒ Geom3
- .polyhedron() ⇒ Geom3
- .roundedCuboid() ⇒ Geom3
- .roundedCylinder() ⇒ Geom3
- .sphere() ⇒ Geom3
- .torus() ⇒ Geom3
- .Geom3
geom3.Geom3
Class Geom3
Holds a JSCAD 3D geometry consisting of a set of polygons.
Kind: static class of geom3
- .Geom3
- new exports.Geom3([geometry])
- instance
- .toPolygons() ⇒ Array
- static
- .fromVertices() ⇒ Geom3
- .cube() ⇒ Geom3
- .cuboid() ⇒ Geom3
- .cylinder() ⇒ Geom3
- .cylinderElliptic() ⇒ Geom3
- .ellipsoid() ⇒ Geom3
- .geodesicSphere() ⇒ Geom3
- .polyhedron() ⇒ Geom3
- .roundedCuboid() ⇒ Geom3
- .roundedCylinder() ⇒ Geom3
- .sphere() ⇒ Geom3
- .torus() ⇒ Geom3
new exports.Geom3([geometry])
| Param | Type | Description | | --- | --- | --- | | [geometry] | geom3 | a provided geometry |
Example
import { Geom3 } from "jscad-object-api"
const ashape = Geom3.cylinder()
const bshape = Geom3.cylinder({height: 2, radius: 10})
const cshare = bshape.translate([3, 2, 1])geom3.toPolygons() ⇒ Array
Kind: instance method of Geom3
Returns: Array - list of polygons
Geom3.fromVertices() ⇒ Geom3
Kind: static method of Geom3
Returns: Geom3 - new geometry
Geom3.cube() ⇒ Geom3
Kind: static method of Geom3
Returns: Geom3 - new geometry
Geom3.cuboid() ⇒ Geom3
Kind: static method of Geom3
Returns: Geom3 - new geometry
Geom3.cylinder() ⇒ Geom3
Kind: static method of Geom3
Returns: Geom3 - new geometry
Geom3.cylinderElliptic() ⇒ Geom3
Kind: static method of Geom3
Returns: Geom3 - new geometry
Geom3.ellipsoid() ⇒ Geom3
Kind: static method of Geom3
Returns: Geom3 - new geometry
Geom3.geodesicSphere() ⇒ Geom3
Kind: static method of Geom3
Returns: Geom3 - new geometry
Geom3.polyhedron() ⇒ Geom3
Kind: static method of Geom3
Returns: Geom3 - new geometry
Geom3.roundedCuboid() ⇒ Geom3
Kind: static method of Geom3
Returns: Geom3 - new geometry
Geom3.roundedCylinder() ⇒ Geom3
Kind: static method of Geom3
Returns: Geom3 - new geometry
Geom3.sphere() ⇒ Geom3
Kind: static method of Geom3
Returns: Geom3 - new geometry
Geom3.torus() ⇒ Geom3
Kind: static method of Geom3
Returns: Geom3 - new geometry
path2
- path2
- .Path2
- new exports.Path2([geometry])
- instance
- .toPoints() ⇒ Array
- static
- .fromPoints() ⇒ Path2
- .arc() ⇒ Path2
- .line() ⇒ Path2
- .Path2
path2.Path2
Class Path2
Holds a JSCAD path2 geometry consisting of an ordered set of points. A path can be open or closed, i.e. the start and end are the same.
Kind: static class of path2
- .Path2
- new exports.Path2([geometry])
- instance
- .toPoints() ⇒ Array
- static
- .fromPoints() ⇒ Path2
- .arc() ⇒ Path2
- .line() ⇒ Path2
new exports.Path2([geometry])
| Param | Type | Description | | --- | --- | --- | | [geometry] | path2 | a provided geometry |
Example
import { Path2 } from "jscad-object-api"
let path1 = Path2.fromPoints([[10,10], [-10,10], [-10,-10], [10,-10]], true) // closed
let path2 = Part2.arc({
center: [5, 5],
radius: 10,
startangle: 90,
endangle: 180,
resolution: 36,
})
let path3 = path1.concat(path2)path2.toPoints() ⇒ Array
Kind: instance method of Path2
Returns: Array - list of points
Path2.fromPoints() ⇒ Path2
Kind: static method of Path2
Returns: Path2 - new geometry
Path2.arc() ⇒ Path2
Kind: static method of Path2
Returns: Path2 - new geometry
Path2.line() ⇒ Path2
Kind: static method of Path2
Returns: Path2 - new geometry
