Class: FaceSketcher
Defined in: Sketcher2d.ts:585
The FaceSketcher allows you to sketch on a face that is not planar, for instance the sides of a cylinder.
The coordinates passed to the methods corresponds to normalised distances on this surface, between 0 and 1 in both direction.
Note that if you are drawing on a closed surface (typically a revolution surface or a cylinder), the first parameters represents the angle and can be smaller than 0 or bigger than 1.
Extends
Implements
Constructors
Constructor
new FaceSketcher(face, origin): FaceSketcher;
Defined in: Sketcher2d.ts:592
Parameters
face
origin
Point2D = ...
Returns
FaceSketcher
Overrides
Arc Segment
bulgeArc()
bulgeArc(
xDist,
yDist,
bulge): this;
Defined in: Sketcher2d.ts:273
Draws an arc of circle by defining its end point and the bulge - the maximum distance between the arc and the straight line going from start to end point in units of half the chord. The end point is defined by its horizontal and vertical distances from the start point.
Parameters
xDist
number
yDist
number
bulge
number
Returns
this
Implementation of
Inherited from
bulgeArcTo()
bulgeArcTo(end, bulge): this;
Defined in: Sketcher2d.ts:265
Draws an arc of circle by defining its end point and the bulge - the maximum distance between the arc and the straight line going from start to end point.
Parameters
end
bulge
number
Returns
this
Implementation of
Inherited from
hBulgeArc()
hBulgeArc(distance, bulge): this;
Defined in: Sketcher2d.ts:284
Draws an horizontal arc of circle by defining its end point and the bulge
- the maximum distance between the arc and the straight line going from start to end point in units of half the chord. The end point is defined by its horizontal distance from the start point.
Parameters
distance
number
bulge
number
Returns
this
Implementation of
Inherited from
hSagittaArc()
hSagittaArc(distance, sagitta): this;
Defined in: Sketcher2d.ts:261
Draws an horizontal arc of circle by defining its end point and the sagitta - the maximum distance between the arc and the straight line going from start to end point.The end point is defined by its horizontal distance from the start point.
Parameters
distance
number
sagitta
number
Returns
this
Implementation of
Inherited from
sagittaArc()
sagittaArc(
xDist,
yDist,
sagitta): this;
Defined in: Sketcher2d.ts:250
Draws an arc of circle by defining its end point and the sagitta - the maximum distance between the arc and the straight line going from start to end point.The end point is defined by its horizontal and vertical distances from the start point.
Parameters
xDist
number
yDist
number
sagitta
number
Returns
this
Implementation of
Inherited from
sagittaArcTo()
sagittaArcTo(end, sagitta): this;
Defined in: Sketcher2d.ts:223
Draws an arc of circle by defining its end point and the sagitta - the maximum distance between the arc and the straight line going from start to end point.
Parameters
end
sagitta
number
Returns
this
Implementation of
Inherited from
tangentArc()
tangentArc(xDist, yDist): this;
Defined in: Sketcher2d.ts:308
Draws an arc of circle from the current point as a tangent to the previous part of curve drawn.The end point is defined by its horizontal and vertical distances from the start point.
Parameters
xDist
number
yDist
number
Returns
this
Implementation of
Inherited from
tangentArcTo()
tangentArcTo(end): this;
Defined in: Sketcher2d.ts:288
Draws an arc of circle from the current point as a tangent to the previous part of curve drawn.
Parameters
end
Returns
this
Implementation of
Inherited from
threePointsArc()
threePointsArc(
xDist,
yDist,
viaXDist,
viaYDist): this;
Defined in: Sketcher2d.ts:210
Draws an arc of circle by defining its end point and a third point through which the arc will pass. Both poinats are defined in horizontal (x) and vertical (y) distances from the start point.
Parameters
xDist
number
yDist
number
viaXDist
number
viaYDist
number
Returns
this
Implementation of
GenericSketcher.threePointsArc
Inherited from
threePointsArcTo()
threePointsArcTo(end, midPoint): this;
Defined in: Sketcher2d.ts:198
Draws an arc of circle by defining its end point and a third point through which the arc will pass.
Parameters
end
midPoint
Returns
this
Implementation of
GenericSketcher.threePointsArcTo
Inherited from
BaseSketcher2d.threePointsArcTo
vBulgeArc()
vBulgeArc(distance, bulge): this;
Defined in: Sketcher2d.ts:280
Draws a vertical arc of circle by defining its end point and the bulge
- the maximum distance between the arc and the straight line going from start to end point in units of half the chord. The end point is defined by its vertical distance from the start point.
Parameters
distance
number
bulge
number
Returns
this
Implementation of
Inherited from
vSagittaArc()
vSagittaArc(distance, sagitta): this;
Defined in: Sketcher2d.ts:257
Draws a vertical arc of circle by defining its end point and the sagitta
- the maximum distance between the arc and the straight line going from start to end point.The end point is defined by its vertical distance from the start point.
Parameters
distance
number
sagitta
number
Returns
this
Implementation of
Inherited from
Bezier Curve
bezierCurveTo()
bezierCurveTo(end, controlPoints): this;
Defined in: Sketcher2d.ts:425
Draws a generic bezier curve to the end point, going using a set of control points.
This is the generic definition of a bézier curve, you might want to use either the quadratic or cubic (most common) version, unless you know exactly what you are aiming at.
Parameters
end
controlPoints
Returns
this
Implementation of
Inherited from
cubicBezierCurveTo()
cubicBezierCurveTo(
end,
startControlPoint,
endControlPoint): this;
Defined in: Sketcher2d.ts:449
Draws a cubic bezier curve to the end point, using the start and end control point to define its shape. This corresponds to the most commonly used bezier curve.
If you are struggling setting your control points, the smoothSpline might be better for your needs.
Parameters
end
startControlPoint
endControlPoint
Returns
this
Implementation of
GenericSketcher.cubicBezierCurveTo
Inherited from
BaseSketcher2d.cubicBezierCurveTo
quadraticBezierCurveTo()
quadraticBezierCurveTo(end, controlPoint): this;
Defined in: Sketcher2d.ts:445
Draws a quadratic bezier curve to the end point, using the single control point.
Parameters
end
controlPoint
Returns
this
Implementation of
GenericSketcher.quadraticBezierCurveTo
Inherited from
BaseSketcher2d.quadraticBezierCurveTo
smoothSpline()
smoothSpline(
xDist,
yDist,
splineConfig?): this;
Defined in: Sketcher2d.ts:498
Draws a cubic bezier curve to the end point, attempting to make the line smooth with the previous segment. The end point is defined by its distance to the first point.
It will base its first control point so that its tangent is the same than
the previous segment. You can force another tangent by defining
startTangent.
You can configure the tangent of the end point by configuring the
endTangent, either as "symmetric" to reproduce the start angle, as an
angle from the X axis (in the coordinate system) or a 2d direction (still
in the coordinate system.
The start- and end- factors decide on how far the control point is from the start and end point. At a factor of 1, the distance corresponds to a quarter of the straight line distance.
Parameters
xDist
number
yDist
number
splineConfig?
Returns
this
Implementation of
Inherited from
smoothSplineTo()
smoothSplineTo(end, config?): this;
Defined in: Sketcher2d.ts:457
Draws a cubic bezier curve to the end point, attempting to make the line smooth with the previous segment.
It will base its first control point so that its tangent is the same than the previous segment.
The control point relative to the end is by default set to be in the
direction of the straight line between start and end. You can specifiy the
endSkew either as an angle (in degrees) to this direction, or as an
absolute direction in the coordinate system (a Point).
The start- and end- factors decide on how far the control point is from the start and end point. At a factor of 1, the distance corresponds to a quarter of the straight line distance.
Parameters
end
config?
Returns
this
Implementation of
GenericSketcher.smoothSplineTo
Inherited from
Drawing State
penPosition
Get Signature
get penPosition(): Point2D;
Defined in: Sketcher2d.ts:92
Returns the current pen position as [x, y] coordinates
Added By Ben Harper 5/12/2025
Returns
Inherited from
Drawing State
Added By Ben Harper 5/12/2025 to solve issue with being unable to draw a line perpendicular to the tangent extension at the end of a .tangentArc() that did not finish at a known angle.
penAngle
Get Signature
get penAngle(): number;
Defined in: Sketcher2d.ts:108
Returns the current pen angle in degrees
The angle represents the tangent direction at the current pen position, based on the last drawing operation (line, arc, bezier, etc.). Returns 0 if nothing has been drawn yet.
Returns
number
Inherited from
Ellipse Arc Segment
ellipse()
ellipse(
xDist,
yDist,
horizontalRadius,
verticalRadius,
rotation,
longAxis,
sweep): this;
Defined in: Sketcher2d.ts:381
Draws an arc of ellipse by defining its end point and an ellipse. The end point is defined by distances from he start point.
The shape of the ellipse is defined by both its radiuses, its angle relative to the current coordinat system, as well as the long and sweep flags (as defined for SVG paths)
Parameters
xDist
number
yDist
number
horizontalRadius
number
verticalRadius
number
rotation
number = 0
longAxis
boolean = false
sweep
boolean = false
Returns
this
Implementation of
Inherited from
ellipseTo()
ellipseTo(
end,
horizontalRadius,
verticalRadius,
rotation,
longAxis,
sweep): this;
Defined in: Sketcher2d.ts:313
Draws an arc of ellipse by defining its end point and an ellipse.
The shape of the ellipse is defined by both its radiuses, its angle relative to the current coordinat system, as well as the long and sweep flags (as defined for SVG paths)
Parameters
end
horizontalRadius
number
verticalRadius
number
rotation
number = 0
longAxis
boolean = false
sweep
boolean = false
Returns
this
Implementation of
Inherited from
halfEllipse()
halfEllipse(
xDist,
yDist,
minorRadius,
sweep): this;
Defined in: Sketcher2d.ts:415
Draws an arc as half an ellipse, defined by the sagitta of the ellipse (which corresponds to the radius in the axe orthogonal to the straight line).The end point is defined by distances from he start point.
The sweep flag is to be understood as defined for SVG paths.
Parameters
xDist
number
yDist
number
minorRadius
number
sweep
boolean = false
Returns
this
Implementation of
Inherited from
halfEllipseTo()
halfEllipseTo(
end,
minorRadius,
sweep): this;
Defined in: Sketcher2d.ts:401
Draws an arc as half an ellipse, defined by the sagitta of the ellipse (which corresponds to the radius in the axe orthogonal to the straight line).
The sweep flag is to be understood as defined for SVG paths.
Parameters
end
minorRadius
number
sweep
boolean = false
Returns
this
Implementation of
Inherited from
Line Segment
hLine()
hLine(distance): this;
Defined in: Sketcher2d.ts:160
Draws an horizontal line of length distance from the current point
Parameters
distance
number
Returns
this
Implementation of
Inherited from
hLineTo()
hLineTo(xPos): this;
Defined in: Sketcher2d.ts:168
Draws an horizontal line to the x coordinate
Parameters
xPos
number
Returns
this
Implementation of
Inherited from
line()
line(xDist, yDist): this;
Defined in: Sketcher2d.ts:152
Draws a line at the horizontal distance xDist and the vertical distance yDist of the current point
Parameters
xDist
number
yDist
number
Returns
this
Implementation of
Inherited from
lineTo()
lineTo(point): this;
Defined in: Sketcher2d.ts:142
Draws a line from the current point to the point given in argument
Parameters
point
Returns
this
Implementation of
Inherited from
polarLine()
polarLine(distance, angle): this;
Defined in: Sketcher2d.ts:178
Draws a line from the current point to the point defined in polar coordiates, of radius r and angle theta (in degrees) from the current point
Parameters
distance
number
angle
number
Returns
this
Implementation of
Inherited from
polarLineTo()
polarLineTo(__namedParameters): this;
Defined in: Sketcher2d.ts:172
Draws a line from the current point to the point defined in polar coordiates, of radius r and angle theta (in degrees) from the origin
Parameters
__namedParameters
Returns
this
Implementation of
Inherited from
tangentLine()
tangentLine(distance): this;
Defined in: Sketcher2d.ts:184
Draws a line from the current point as a tangent to the previous part of curve drawn. The distance defines how long the line will be.
Parameters
distance
number
Returns
this
Implementation of
Inherited from
vLine()
vLine(distance): this;
Defined in: Sketcher2d.ts:156
Draws a vertical line of length distance from the current point
Parameters
distance
number
Returns
this
Implementation of
Inherited from
vLineTo()
vLineTo(yPos): this;
Defined in: Sketcher2d.ts:164
Draws a vertical line to the y coordinate
Parameters
yPos
number
Returns
this
Implementation of
Inherited from
Other
_adaptSurface()
_adaptSurface(): Handle_Geom_Surface;
Defined in: Sketcher2d.ts:608
Returns
Handle_Geom_Surface
close()
close(): Sketch;
Defined in: Sketcher2d.ts:656
Stop drawing, make sure the sketch is closed (by adding a straight line to from the last point to the first) and returns the sketch.
Returns
Implementation of
closeWithCustomCorner()
closeWithCustomCorner(radius, mode): Sketch;
Defined in: Sketcher2d.ts:671
Stop drawing, make sure the sketch is closed (by adding a straight line to from the last point to the first), add a fillet between the last and the first segments and returns the sketch.
Parameters
radius
number | (f, s) => Curve2D[]
mode
"chamfer" | "fillet" | "dogbone"
Returns
closeWithMirror()
closeWithMirror(): Sketch;
Defined in: Sketcher2d.ts:661
Stop drawing, make sure the sketch is closed (by mirroring the lines between the first and last points drawn) and returns the sketch.
Returns
Implementation of
GenericSketcher.closeWithMirror
customCorner()
customCorner(radius, mode): FaceSketcher;
Defined in: Sketcher2d.ts:512
Changes the corner between the previous and next segments.
Parameters
radius
number | (first, second) => Curve2D[]
mode
"chamfer" | "fillet"
Returns
FaceSketcher
Inherited from
done()
done(): Sketch;
Defined in: Sketcher2d.ts:637
Stop drawing and returns the sketch.
Returns
Implementation of
movePointerTo()
movePointerTo(point): this;
Defined in: Sketcher2d.ts:118
Changes the point to start your drawing from
Parameters
point
Returns
this