Skip to main content

Drawing

Implements

Constructors

constructor

new Drawing(innerShape?)

Parameters

NameTypeDefault value
innerShapeShape2Dnull

Defined in

draw.ts:42

Properties

innerShape

Private innerShape: Shape2D

Defined in

draw.ts:40

Accessors

blueprint

get blueprint(): Blueprint

Returns

Blueprint

Defined in

draw.ts:183


boundingBox

get boundingBox(): BoundingBox2d

Returns

BoundingBox2d

Implementation of

DrawingInterface.boundingBox

Defined in

draw.ts:50


repr

get repr(): string

Returns

string

Defined in

draw.ts:59

Drawing Modifications Methods

chamfer

chamfer(radius, filter?): Drawing

Creates a new drawing with some corners filletted, as specified by the radius and the corner finder function

Parameters

NameType
radiusnumber
filter?(c: CornerFinder) => CornerFinder

Returns

Drawing

Defined in

draw.ts:134


cut

cut(other): Drawing

Builds a new drawing by cuting another drawing into this one

Parameters

NameType
otherDrawing

Returns

Drawing

Defined in

draw.ts:95


fillet

fillet(radius, filter?): Drawing

Creates a new drawing with some corners filletted, as specified by the radius and the corner finder function

Parameters

NameType
radiusnumber
filter?(c: CornerFinder) => CornerFinder

Returns

Drawing

Defined in

draw.ts:123


fuse

fuse(other): Drawing

Builds a new drawing by merging another drawing into this one

Parameters

NameType
otherDrawing

Returns

Drawing

Defined in

draw.ts:104


intersect

intersect(other): Drawing

Builds a new drawing by intersection this drawing with another

Parameters

NameType
otherDrawing

Returns

Drawing

Defined in

draw.ts:113


Other Methods

approximate

approximate(target, options?): Drawing

Parameters

NameType
target"svg" | "arcs"
optionsApproximationOptions

Returns

Drawing

Defined in

draw.ts:173


clone

clone(): Drawing

Returns

Drawing

Implementation of

DrawingInterface.clone

Defined in

draw.ts:46


mirror

mirror(centerOrDirection, origin?, mode?): Drawing

Returns the mirror image of this drawing made with a single point (in center mode, the default, or a plane, (plane mode, with both direction and origin of the plane).

Parameters

NameType
centerOrDirectionPoint2D
origin?Point2D
mode?"center" | "plane"

Returns

Drawing

Implementation of

DrawingInterface.mirror

Defined in

draw.ts:81


offset

offset(distance): Drawing

Parameters

NameType
distancenumber

Returns

Drawing

Defined in

draw.ts:169


rotate

rotate(angle, center?): Drawing

Parameters

NameType
anglenumber
center?Point2D

Returns

Drawing

Implementation of

DrawingInterface.rotate

Defined in

draw.ts:64


scale

scale(scaleFactor, center?): Drawing

Parameters

NameType
scaleFactornumber
center?Point2D

Returns

Drawing

Defined in

draw.ts:76


sketchOnFace

sketchOnFace(face, scaleMode): SketchInterface | Sketches

Returns the sketched version of the drawing, on a face.

The scale mode corresponds to the way the coordinates of the drawing are interpreted match with the face:

  • original uses global coordinates (1mm in the drawing is 1mm on the face). This is the default, but currently supported only for planar and circular faces
  • bounds normalises the UV parameters on the face to [0,1] intervals.
  • native uses the default UV parameters of opencascade

Parameters

NameType
faceFace
scaleModeScaleMode

Returns

SketchInterface | Sketches

Implementation of

DrawingInterface.sketchOnFace

Defined in

draw.ts:152


sketchOnPlane

sketchOnPlane(inputPlane): SketchInterface | Sketches

Returns the sketched version of the drawing, on a plane

Parameters

NameType
inputPlanePlane

Returns

SketchInterface | Sketches

Implementation of

DrawingInterface.sketchOnPlane

Defined in

draw.ts:139

sketchOnPlane(inputPlane?, origin?): SketchInterface | Sketches

Parameters

NameType
inputPlane?PlaneName
origin?number | Point

Returns

SketchInterface | Sketches

Implementation of

DrawingInterface.sketchOnPlane

Defined in

draw.ts:140


stretch

stretch(ratio, direction, origin): Drawing

Parameters

NameType
rationumber
directionPoint2D
originPoint2D

Returns

Drawing

Implementation of

DrawingInterface.stretch

Defined in

draw.ts:54


toSVG

toSVG(margin?): string

Formats the drawing as an SVG image

Parameters

NameType
margin?number

Returns

string

Implementation of

DrawingInterface.toSVG

Defined in

draw.ts:157


toSVGPaths

toSVGPaths(): string[] | string[][]

Formats the drawing as a list of SVG paths

Returns

string[] | string[][]

Implementation of

DrawingInterface.toSVGPaths

Defined in

draw.ts:165


toSVGViewBox

toSVGViewBox(margin?): string

Returns the SVG viewbox that corresponds to this drawing

Parameters

NameTypeDefault value
marginnumber1

Returns

string

Implementation of

DrawingInterface.toSVGViewBox

Defined in

draw.ts:161


translate

translate(xDist, yDist): Drawing

Parameters

NameType
xDistnumber
yDistnumber

Returns

Drawing

Implementation of

DrawingInterface.translate

Defined in

draw.ts:69

translate(translationVector): Drawing

Parameters

NameType
translationVectorPoint2D

Returns

Drawing

Implementation of

DrawingInterface.translate

Defined in

draw.ts:70