Skip to main content

Class: Drawing

Defined in: packages/replicad/src/draw.ts:52

Implements​

Constructors​

Constructor​

new Drawing(innerShape?): Drawing;

Defined in: packages/replicad/src/draw.ts:55

Parameters​

innerShape?​

Shape2D = null

Returns​

Drawing

Drawing Modifications​

chamfer()​

chamfer(radius, filter?): Drawing;

Defined in: packages/replicad/src/draw.ts:176

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

Parameters​

radius​

number

filter?​

FinderFunction<CornerFinder, Shape2D>

Returns​

Drawing


cut()​

cut(other): Drawing;

Defined in: packages/replicad/src/draw.ts:134

Builds a new drawing by cuting another drawing into this one

Parameters​

other​

Drawing

Returns​

Drawing


fillet()​

fillet(radius, filter?): Drawing;

Defined in: packages/replicad/src/draw.ts:162

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

Parameters​

radius​

number

filter?​

FinderFunction<CornerFinder, Shape2D>

Returns​

Drawing


fuse()​

fuse(other): Drawing;

Defined in: packages/replicad/src/draw.ts:143

Builds a new drawing by merging another drawing into this one

Parameters​

other​

Drawing

Returns​

Drawing


intersect()​

intersect(other): Drawing;

Defined in: packages/replicad/src/draw.ts:152

Builds a new drawing by intersection this drawing with another

Parameters​

other​

Drawing

Returns​

Drawing

Other​

blueprint​

Get Signature​

get blueprint(): Blueprint;

Defined in: packages/replicad/src/draw.ts:241

Returns​

Blueprint


boundingBox​

Get Signature​

get boundingBox(): BoundingBox2d;

Defined in: packages/replicad/src/draw.ts:89

Returns​

BoundingBox2d

Implementation of​

DrawingInterface.boundingBox


repr​

Get Signature​

get repr(): string;

Defined in: packages/replicad/src/draw.ts:98

Returns​

string


approximate()​

approximate(target, options?): Drawing;

Defined in: packages/replicad/src/draw.ts:231

Parameters​

target​

"svg" | "arcs"

options?​

ApproximationOptions = {}

Returns​

Drawing


clone()​

clone(): Drawing;

Defined in: packages/replicad/src/draw.ts:59

Returns​

Drawing

Implementation of​

DrawingInterface.clone


mirror()​

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

Defined in: packages/replicad/src/draw.ts:120

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​

centerOrDirection​

Point2D

origin?​

Point2D

mode?​

"center" | "plane"

Returns​

Drawing

Implementation of​

DrawingInterface.mirror


offset()​

offset(distance, offsetConfig?): Drawing;

Defined in: packages/replicad/src/draw.ts:227

Parameters​

distance​

number

offsetConfig?​

Offset2DConfig = {}

Returns​

Drawing


punchHole()​

punchHole(
shape,
faceFinder,
options?): AnyShape;

Defined in: packages/replicad/src/draw.ts:202

Parameters​

shape​

AnyShape

faceFinder​

SingleFace

options?​
draftAngle?​

number

height?​

number

origin?​

Point

Returns​

AnyShape


rotate()​

rotate(angle, center?): Drawing;

Defined in: packages/replicad/src/draw.ts:103

Parameters​

angle​

number

center?​

Point2D

Returns​

Drawing

Implementation of​

DrawingInterface.rotate


scale()​

scale(scaleFactor, center?): Drawing;

Defined in: packages/replicad/src/draw.ts:115

Parameters​

scaleFactor​

number

center?​

Point2D

Returns​

Drawing


serialize()​

serialize(): string;

Defined in: packages/replicad/src/draw.ts:63

Returns​

string


sketchOnFace()​

sketchOnFace(face, scaleMode): 
| SketchInterface
| Sketches;

Defined in: packages/replicad/src/draw.ts:197

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​

face​

Face

scaleMode​

ScaleMode

Returns​

| SketchInterface | Sketches

Implementation of​

DrawingInterface.sketchOnFace


sketchOnPlane()​

Call Signature​

sketchOnPlane(inputPlane): 
| SketchInterface
| Sketches;

Defined in: packages/replicad/src/draw.ts:184

Returns the sketched version of the drawing, on a plane

Parameters​
inputPlane​

Plane

Returns​

| SketchInterface | Sketches

Implementation of​

DrawingInterface.sketchOnPlane

Call Signature​

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

Defined in: packages/replicad/src/draw.ts:185

Parameters​
inputPlane?​

PlaneName

origin?​

number | Point

Returns​

| SketchInterface | Sketches

Implementation of​

DrawingInterface.sketchOnPlane


stretch()​

stretch(
ratio,
direction,
origin): Drawing;

Defined in: packages/replicad/src/draw.ts:93

Parameters​

ratio​

number

direction​

Point2D

origin​

Point2D

Returns​

Drawing

Implementation of​

DrawingInterface.stretch


toSVG()​

toSVG(margin?): string;

Defined in: packages/replicad/src/draw.ts:215

Formats the drawing as an SVG image

Parameters​

margin?​

number

Returns​

string

Implementation of​

DrawingInterface.toSVG


toSVGPaths()​

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

Defined in: packages/replicad/src/draw.ts:223

Formats the drawing as a list of SVG paths

Returns​

string[] | string[][]

Implementation of​

DrawingInterface.toSVGPaths


toSVGViewBox()​

toSVGViewBox(margin?): string;

Defined in: packages/replicad/src/draw.ts:219

Returns the SVG viewbox that corresponds to this drawing

Parameters​

margin?​

number = 1

Returns​

string

Implementation of​

DrawingInterface.toSVGViewBox


translate()​

Call Signature​

translate(xDist, yDist): Drawing;

Defined in: packages/replicad/src/draw.ts:108

Parameters​
xDist​

number

yDist​

number

Returns​

Drawing

Implementation of​

DrawingInterface.translate

Call Signature​

translate(translationVector): Drawing;

Defined in: packages/replicad/src/draw.ts:109

Parameters​
translationVector​

Point2D

Returns​

Drawing

Implementation of​

DrawingInterface.translate