Appearance
Geometry Create
Curve creation — construct new geometric curves from point handles (all-handle model). Each method takes point handles (Vec3Handle) and returns an opaque curve handle (LineHandle or ArcHandle) that you pass to query, update, or entity-creation methods. Read geometry back as plain values via the snaptrude.core.geom.query.* methods. Accessed via snaptrude.core.geom.create.
Functions
line(startPoint, endPoint)
Create a straight line segment between two point handles. Host API call — returns a handle.
- Parameters:
startPoint:Vec3Handle— Start point of the line segmentendPoint:Vec3Handle— End point of the line segment
- Returns:
LineHandle— The new line
ts
const line = await snaptrude.core.geom.create.line(startPoint, endPoint);arc(startPoint, endPoint, centrePoint, axis)
Create a circular arc from its start, end, centre, and axis point handles. Host API call — returns a handle.
- Parameters:
startPoint:Vec3Handle— Start point of the arcendPoint:Vec3Handle— End point of the arccentrePoint:Vec3Handle— Centre point of the arcaxis:Vec3Handle— Axis direction of the arc
- Returns:
ArcHandle— The new arc
ts
const arc = await snaptrude.core.geom.create.arc(startPoint, endPoint, centrePoint, axis);circle(centrePoint, axis, radius)
Create a circle from a centre point, an axis (plane normal), and a radius. Host API call — returns a handle. A circle is a closed curve; read it back via snaptrude.core.geom.query.circle.*.
- Parameters:
centrePoint:Vec3Handle— Centre point of the circleaxis:Vec3Handle— Axis direction (plane normal) of the circleradius:number— Radius of the circle
- Returns:
CircleHandle— The new circle
ts
const circle = await snaptrude.core.geom.create.circle(centrePoint, axis, 2);profileFromLinePoints(points)
Create a closed profile from an ordered list of point handles connected by line segments (last auto-connected to first). Host API call — returns a handle.
- Parameters:
points:Vec3Handle[]— Ordered vertex handles of the profile
- Returns:
ProfileHandle— The new profile
ts
const profile = await snaptrude.core.geom.create.profileFromLinePoints(points);profileFromCurves(curves)
Create a profile from an ordered list of curve handles forming a closed loop. Host API call — returns a handle.
- Parameters:
curves:CurveHandle[]— Ordered curve handles forming a closed loop
- Returns:
ProfileHandle— The new profile
ts
const profile = await snaptrude.core.geom.create.profileFromCurves([line, arc]);profileRect(width, depth, center?)
Create an axis-aligned rectangle profile (XZ plane) of width × depth, centred at center (default origin). Pair with design.create.space / design.create.spaces to author a rectangular (box) space.
- Parameters:
width:number— Extent along Xdepth:number— Extent along Zcenter:Vec3Handle(optional, default origin) — Rectangle centre
- Returns:
ProfileHandle— The new rectangle profile
ts
const rect = await snaptrude.core.geom.create.profileRect(4, 3);
const contour = await snaptrude.core.geom.create.contourFromProfile(rect);
const space = await snaptrude.design.create.space(contour, 3);contourFromProfile(outer)
Create a contour (an outer profile loop, no holes). Host API call — returns a handle.
- Parameters:
outer:ProfileHandle— The outer boundary loop
- Returns:
ContourHandle— The new contour
ts
const contour = await snaptrude.core.geom.create.contourFromProfile(outer);contourFromProfiles(outer, holes?)
Create a contour from an outer profile plus zero or more inner profiles (holes). Host API call — returns a handle.
- Parameters:
outer:ProfileHandle— The outer boundary loopholes:ProfileHandle[](optional) — Optional inner hole loops
- Returns:
ContourHandle— The new contour
ts
const contour = await snaptrude.core.geom.create.contourFromProfiles(outer, [hole]);Errors
Failed calls reject with a typed PluginError — see Error Handling. Conditions specific to this namespace:
| Code | Thrown by | When | details |
|---|---|---|---|
VALIDATION | profileRect | width or depth is not positive | width, depth |
HANDLE_INVALID | all methods | A point, curve, or profile handle cannot be resolved | — |