Skip to main content

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

Face

origin

Point2D = ...

Returns

FaceSketcher

Overrides

BaseSketcher2d.constructor

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

GenericSketcher.bulgeArc

Inherited from

BaseSketcher2d.bulgeArc


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

Point2D

bulge

number

Returns

this

Implementation of

GenericSketcher.bulgeArcTo

Inherited from

BaseSketcher2d.bulgeArcTo


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

GenericSketcher.hBulgeArc

Inherited from

BaseSketcher2d.hBulgeArc


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

GenericSketcher.hSagittaArc

Inherited from

BaseSketcher2d.hSagittaArc


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

GenericSketcher.sagittaArc

Inherited from

BaseSketcher2d.sagittaArc


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

Point2D

sagitta

number

Returns

this

Implementation of

GenericSketcher.sagittaArcTo

Inherited from

BaseSketcher2d.sagittaArcTo


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

GenericSketcher.tangentArc

Inherited from

BaseSketcher2d.tangentArc


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

Point2D

Returns

this

Implementation of

GenericSketcher.tangentArcTo

Inherited from

BaseSketcher2d.tangentArcTo


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

BaseSketcher2d.threePointsArc


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

Point2D

midPoint

Point2D

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

GenericSketcher.vBulgeArc

Inherited from

BaseSketcher2d.vBulgeArc


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

GenericSketcher.vSagittaArc

Inherited from

BaseSketcher2d.vSagittaArc

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

Point2D

controlPoints

Point2D | Point2D[]

Returns

this

Implementation of

GenericSketcher.bezierCurveTo

Inherited from

BaseSketcher2d.bezierCurveTo


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

Point2D

startControlPoint

Point2D

endControlPoint

Point2D

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

Point2D

controlPoint

Point2D

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?

SplineConfig

Returns

this

Implementation of

GenericSketcher.smoothSpline

Inherited from

BaseSketcher2d.smoothSpline


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

Point2D

config?

SplineConfig

Returns

this

Implementation of

GenericSketcher.smoothSplineTo

Inherited from

BaseSketcher2d.smoothSplineTo

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

Point2D

Inherited from

BaseSketcher2d.penPosition

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

BaseSketcher2d.penAngle

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

GenericSketcher.ellipse

Inherited from

BaseSketcher2d.ellipse


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

Point2D

horizontalRadius

number

verticalRadius

number

rotation

number = 0

longAxis

boolean = false

sweep

boolean = false

Returns

this

Implementation of

GenericSketcher.ellipseTo

Inherited from

BaseSketcher2d.ellipseTo


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

GenericSketcher.halfEllipse

Inherited from

BaseSketcher2d.halfEllipse


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

Point2D

minorRadius

number

sweep

boolean = false

Returns

this

Implementation of

GenericSketcher.halfEllipseTo

Inherited from

BaseSketcher2d.halfEllipseTo

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

GenericSketcher.hLine

Inherited from

BaseSketcher2d.hLine


hLineTo()

hLineTo(xPos): this;

Defined in: Sketcher2d.ts:168

Draws an horizontal line to the x coordinate

Parameters

xPos

number

Returns

this

Implementation of

GenericSketcher.hLineTo

Inherited from

BaseSketcher2d.hLineTo


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

GenericSketcher.line

Inherited from

BaseSketcher2d.line


lineTo()

lineTo(point): this;

Defined in: Sketcher2d.ts:142

Draws a line from the current point to the point given in argument

Parameters

point

Point2D

Returns

this

Implementation of

GenericSketcher.lineTo

Inherited from

BaseSketcher2d.lineTo


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

GenericSketcher.polarLine

Inherited from

BaseSketcher2d.polarLine


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

Point2D

Returns

this

Implementation of

GenericSketcher.polarLineTo

Inherited from

BaseSketcher2d.polarLineTo


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

GenericSketcher.tangentLine

Inherited from

BaseSketcher2d.tangentLine


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

GenericSketcher.vLine

Inherited from

BaseSketcher2d.vLine


vLineTo()

vLineTo(yPos): this;

Defined in: Sketcher2d.ts:164

Draws a vertical line to the y coordinate

Parameters

yPos

number

Returns

this

Implementation of

GenericSketcher.vLineTo

Inherited from

BaseSketcher2d.vLineTo

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

Sketch

Implementation of

GenericSketcher.close


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

Sketch


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

Sketch

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

BaseSketcher2d.customCorner


done()

done(): Sketch;

Defined in: Sketcher2d.ts:637

Stop drawing and returns the sketch.

Returns

Sketch

Implementation of

GenericSketcher.done


movePointerTo()

movePointerTo(point): this;

Defined in: Sketcher2d.ts:118

Changes the point to start your drawing from

Parameters

point

Point2D

Returns

this

Implementation of

GenericSketcher.movePointerTo

Inherited from

BaseSketcher2d.movePointerTo