Skip to content

editorGlobalsManualNestingComponent

Class: ManualNestingComponent

Component encapsulating functionality for creating a manual nesting within the editor scene. When created with a list of sheets it will display the specified sheets together with laying out all the plates of all assemblies within the composite model next to each other as parts. These parts can be moved and rotated in order to position them on top of the sheets. Finally, the internal state of the component can be retrieved as compound nesting making it compatible with the export pipeline.

Hierarchy

  • ManualNestingComponent

Index

Constructors

Properties

Methods

Constructors

constructor

+ new ManualNestingComponent(compositeModel: CompositeModel, sheets: Polygon[]): ManualNestingComponent

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:126

Parameters:

Name Type Default Description
compositeModel CompositeModel null The composite model a nesting should be created for.
sheets Polygon[] null A polygon representation of sheets available to the user in manual nesting.

Returns: ManualNestingComponent

Properties

Private clipboard

clipboard: NestingAttachmentData = null

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:126

The clipboard is used as temporary storage between cut and paste operations.


Private compositeModel

compositeModel: CompositeModel = null

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:85


Private enabled

enabled: boolean = false

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:90

Whether the manual nesting mode is enabled and this component is active.


Readonly globalNestingForward

globalNestingForward: ReadonlyVector3 = new Vector3(0, -1, 0)

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:56


Readonly globalNestingOrigin

globalNestingOrigin: ReadonlyVector3 = new Vector3(0, 0, 0)

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:53


Readonly globalNestingRight

globalNestingRight: ReadonlyVector3 = new Vector3(1, 0, 0)

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:55


Readonly globalNestingUp

globalNestingUp: ReadonlyVector3 = new Vector3(0, 0, 1)

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:54


Private isInitialized

isInitialized: boolean

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:95

Whether this component is fully initialized.


Private maxWidth

maxWidth: number = 1000

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:83


Private nestingBounds

nestingBounds: AABB‹› = new AABB()

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:120

In World space.


Private nestingTransforms

nestingTransforms: Map‹Nesting, Matrix4› = null

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:103

Internally the positioned parts will be stored as nestings. Specifically a nesting could either be an Unfolding consisting of a layout of multiple PlateGroups or a SimpleNesting, representing a wrapper for single PlateGroups.

Assumptions: Nesting AABB center is in origin so you need to move it into the origin and keep track of the offset.


Private partPadding

partPadding: number = 5

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:71

Distance between parts in initial layout.


Private sheetPadding

sheetPadding: number = 20

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:66

Distance between sheets when they're layed out.


Private sheetTransforms

sheetTransforms: Map‹Polygon, Matrix4› = new Map()

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:108

Stores the position of each sheet in manual nesting space.


Private sheetYOffset

sheetYOffset: number = 50

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:76

Distance between parts and sheets.


Private sheets

sheets: Polygon[] = []

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:104


Private surfaceIdToTransform

surfaceIdToTransform: Map‹string, Matrix4› = null

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:114

Allows recreation of a manual nesting configuration across de/serialization cycles by storing for each MeshSurface its corresponding position and rotation.


Private unfoldingMaterials

unfoldingMaterials: string[] = ["foamcore"]

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:61

Plates with these material types will be considered as Unfoldings.


Private viewMargin

viewMargin: number = 20

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:81

Margin around the nesting area which will be respected by the view manager.

Methods

Private _createInitialLayout

_createInitialLayout(): Promise‹void›

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:972

Returns: Promise‹void›


Private _createNestingRepresentations

_createNestingRepresentations(plates: Plate[]): Map‹PlateGroup, IPlateGroup2DRepresentations

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:1134

Calculates the nesting 2d representations for a list of plates by running PlateGrouper and getting enlarged rasterized outlines.

Parameters:

Name Type
plates Plate[]

Returns: Map‹PlateGroup, IPlateGroup2DRepresentations


Private _createNestings

_createNestings(): PromiseNesting[]›

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:1067

Create separate nestings for all plate in the composite model by putting every plate group in a separate nesting or – if the material allows for unfolding – into the unfolding subassemblies as annotated on the model.

Returns: PromiseNesting[]›


Private _doesOutlineOverlap

_doesOutlineOverlap(outline: Polygon | MultiPolygon): Promise‹boolean›

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:1242

Parameters:

Name Type
outline Polygon | MultiPolygon

Returns: Promise‹boolean›


Private _ensureInitialized

_ensureInitialized(): Promise‹void›

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:898

Checks whether initialization is complete or, otherwise, finishes it by initializing nesting transforms with values from surface to transform map.

Returns: Promise‹void›


Private _getAllAttachmentSuggestions

_getAllAttachmentSuggestions(candidateNesting: Nesting): PromiseNestingSuggestion[]›

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:720

Creates attachment suggestions for all possible combinations the given candidate nesting could be attached to another nesting within this manual nesting. Filters out attachments with a) plate-local and b) subassembly-local overlaps.

Parameters:

Name Type Description
candidateNesting Nesting The candidate nesting to create attachment suggestions for.

Returns: PromiseNestingSuggestion[]›

an array of all possible attachment suggestions.


Private _getExportMatrixForPart

_getExportMatrixForPart(sheetMatrix: Matrix4, partNesting: Nesting): Matrix4

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:1202

Calculates a matrix positioning a given part within a given sheet.

Parameters:

Name Type Description
sheetMatrix Matrix4 The matrix of the sheet the part should be positioned on
partNesting Nesting The nesting representing the part.

Returns: Matrix4


Private _getMatrixForNesting

_getMatrixForNesting(nesting: Nesting): Matrix4

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:1234

Calculates the nesting matrix for a given part nesting representing its position and rotation within the manual nesting.

Parameters:

Name Type Description
nesting Nesting The part represented as nesting.

Returns: Matrix4


Private _getNestingForPlate

_getNestingForPlate(plate: Plate): Nesting

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:953

Parameters:

Name Type
plate Plate

Returns: Nesting


Private _getNestingForPlateGroup

_getNestingForPlateGroup(plateGroup: PlateGroup): Nesting

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:957

Parameters:

Name Type
plateGroup PlateGroup

Returns: Nesting


Private _getPlateGroupForPlate

_getPlateGroupForPlate(plate: Plate): PlateGroup

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:961

Parameters:

Name Type
plate Plate

Returns: PlateGroup


Private _getPositionAndRotationForNesting

_getPositionAndRotationForNesting(nesting: Nesting): object

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:968

Parameters:

Name Type
nesting Nesting

Returns: object

  • rotationAngle: number

  • translation2D: Vector2


Private _isInSyncWithModel

_isInSyncWithModel(): boolean

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:879

Checks whether the component is in sync with the composite model by checking if every surface which is part of the nesting has a counterpart within the composite model i.e. the model has not changed.

Returns: boolean


Private _joinAtPlates

_joinAtPlates(plateToAdd: any, plateToAddTo: any): void

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:668

Merge two unfoldings specified by two plates.

Parameters:

Name Type Description
plateToAdd any The plate whose unfolding will be added to the other unfolding.
plateToAddTo any This plate's unfolding will be extended by plates from the other unfolding.

Returns: void


Private _layoutParts

_layoutParts(): Promise‹void›

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:1023

Creates an initial layout for all parts by laying them out in a row.

Returns: Promise‹void›


Private _layoutSheets

_layoutSheets(): void

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:994

Positions the sheets next to each other by creating translation transforms for each sheet.

Returns: void


Private _mapPlateGroupsToMeshSurfaces

_mapPlateGroupsToMeshSurfaces(): Map‹PlateGroup, MeshSurface

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:1183

Creates a mapping from each plate within this manual nesting to its corresponding MeshSurface element.

Returns: Map‹PlateGroup, MeshSurface


Private _mapSheetsToNestings

_mapSheetsToNestings(): Promise‹Map‹Polygon, Nesting[]››

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:930

Determines which sheet a nesting is on by checking overlap of the bounding boxes.

Returns: Promise‹Map‹Polygon, Nesting[]››


Private _resetNestingState

_resetNestingState(): void

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:921

Returns: void


Private _setConnectionProperty

_setConnectionProperty(plate: any, joint: any, isConnected: any): void

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:1288

Parameters:

Name Type
plate any
joint any
isConnected any

Returns: void


Private _split

_split(joint: EdgeJoint): void

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:782

Splits an unfolding at the given joint by creating a new unfolding containing all PlateGroups being split off.

Parameters:

Name Type Description
joint EdgeJoint The joint to split at.

Returns: void


Private _translatePart

_translatePart(partNesting: Nesting, direction: Vector3, length: any): void

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:856

Translates a nesting representing a part by the given length in the given direction.

Parameters:

Name Type Description
partNesting Nesting The nesting that is translated.
direction Vector3 The direction of the translation within the partNesting's space.
length any The length of the translation.

Returns: void


Private _updateNestingBounds

_updateNestingBounds(): void

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:977

Returns: void


applySuggestion

applySuggestion(suggestion: NestingSuggestion): void

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:405

Applies the action assigned to the given suggestion to the manual nesting changing its internal state.

Parameters:

Name Type Description
suggestion NestingSuggestion

Returns: void


createFrom

createFrom(existingSurfaceIdToTransforms: Map‹string, Matrix4›, sheetTransforms: Map‹Polygon, Matrix4›, compositeModel: CompositeModel, enabled: boolean): void

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:150

Creates a ManualNestingComponent from an existing manual nesting specified by a surface to transform mapping (encoding the position and translation of parts) and a sheet to transform mapping.

Parameters:

Name Type Description
existingSurfaceIdToTransforms Map‹string, Matrix4› specifying position and rotation for each MeshSurface part of the nesting
sheetTransforms Map‹Polygon, Matrix4› specifying position and rotation
compositeModel CompositeModel -
enabled boolean -

Returns: void


disable

disable(): void

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:220

Returns: void


enable

enable(): Promise‹void›

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:168

Enables the manual nesting mode. If the component hasn't been enabled for this composite model before, the parts will be positioned side by side.

Returns: Promise‹void›


getBasePlate

getBasePlate(): Plate

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:258

Returns the plate that will be used to create visualizations of the sheets.

TODO: This is just a temporary workaround until sheets have their own independent visualizations.

Returns: Plate

  • The base plate object.

getCompositeModel

getCompositeModel(): CompositeModel

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:225

Returns: CompositeModel


getCutSplitSuggestions

getCutSplitSuggestions(): NestingSuggestion[]

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:300

Creates suggestions for all possible split actions for the current nesting state.

Returns: NestingSuggestion[]

an array of split suggestions.


getFilteredAttachmentSuggestions

getFilteredAttachmentSuggestions(): PromiseNestingSuggestion[]›

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:342

Gets attachment suggestions for display taking the current clipboard into account. Filters out attachments with a) plate-local, b) subassembly-local and c) manual-nesting wide (parts and sheet holes) overlaps.

Returns: PromiseNestingSuggestion[]›

an array of attachment suggestions.


getLocalAABBForPlate

getLocalAABBForPlate(plate: Plate): AABB

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:229

Parameters:

Name Type
plate Plate

Returns: AABB


getMatrixForSheet

getMatrixForSheet(sheet: Polygon): Matrix4

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:208

Parameters:

Name Type
sheet Polygon

Returns: Matrix4


getNestingBounds

getNestingBounds(): AABB

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:234

Returns: AABB


getNestingSuggestions

getNestingSuggestions(): PromiseNestingSuggestion[] | undefined›

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:364

Gets nesting suggestions indicating where the part currently stored in the clipboard could be positioned.

Returns: PromiseNestingSuggestion[] | undefined›

an array of placement suggestions or undefined if the clipboard is not set.


getNestingTransform

getNestingTransform(plate: Plate): Matrix4

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:279

Retrieves the transform (representing position and translation in nesting space) for a specific plate.

Parameters:

Name Type Description
plate Plate The specific plate object.

Returns: Matrix4

a Matrix4 containing position and rotation.


getNestingsForExport

getNestingsForExport(meshSurfaceToPlateGroup?: Map‹MeshSurface, PlateGroup›): PromiseISheetNesting[]›

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:502

Retrieves the current state of the nesting as CompoundNesting data structure containing position and translation for every PlateGroup in the composite model that was positioned on one of the available sheets. Plates that were not placed are ignored.

In case, the returned nesting should contain different PlateGroups than the component was created with, a mapping between MeshSurfaces and the new PlateGroups can be provided.

Parameters:

Name Type Description
meshSurfaceToPlateGroup? Map‹MeshSurface, PlateGroup optional: Specifying the PlateGroups to be used within the returned nesting.

Returns: PromiseISheetNesting[]›

  • A combination of sheet polygon and a nesting (representing the layout for this sheet) for every sheet.

getPartsBounds

getPartsBounds(): AABB

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:604

Get the world space aabb of all parts in this nesting.

Returns: AABB


getRasterizedOutlineForRendering

getRasterizedOutlineForRendering(plate: Plate): RasterizedOutlineWithHoles | null

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:239

Parameters:

Name Type
plate Plate

Returns: RasterizedOutlineWithHoles | null


getSheetTransforms

getSheetTransforms(): Map‹Polygon, Matrix4›

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:212

Returns: Map‹Polygon, Matrix4›


getSheets

getSheets(): Polygon[]

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:204

Returns: Polygon[]


getSurfaceIdTransformMapping

getSurfaceIdTransformMapping(): Map‹string, Matrix4›

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:568

Encodes for every Plate its position and rotation by creating a MeshSurface Id to transform mapping.

Returns: Map‹string, Matrix4›


isClipboardSet

isClipboardSet(): boolean

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:658

Whether the clipboard currently contains a part or not.

Returns: boolean

true if the clipboard contains a part, false otherwise.


isEnabled

isEnabled(): boolean

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:216

Returns: boolean


isPlateInClipboard

isPlateInClipboard(plate: Plate): boolean

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:650

Whether the given plate is currently in the clipboard or not.

Parameters:

Name Type Description
plate Plate The plate to check.

Returns: boolean

true if the plate is in the clipboard, false otherwise.


printNesting

printNesting(): Promise‹void›

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:552

Creates a debug print for the current manual nesting state to the console.

Returns: Promise‹void›


resetClipboard

resetClipboard(): void

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:635

Clears the clipboard and updates the visualization.

Returns: void


rotatePart

rotatePart(plate: Plate, angle: number): Promise‹void›

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:452

Rotates the part containing a plate around the z axis within the manual nesting.

Parameters:

Name Type Description
plate Plate The plate object which should be rotated.
angle number The radians angle specifying the amount of rotation.

Returns: Promise‹void›


setClipboardForPlate

setClipboardForPlate(plate: any): void

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:624

Moves the part containging the given plate into the clipboard.

Parameters:

Name Type Description
plate any The plate identifiying the part which should be moved into the clipboard.

Returns: void


setSheets

setSheets(sheets: Polygon[]): void

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:190

Set sheets used for nesting, will reset the nesting state if new sheets differ from existing ones.

Parameters:

Name Type Description
sheets Polygon[] List of sheets as polygon representation.

Returns: void


translatePart

translatePart(plate: Plate, translation: Vector3): Promise‹void›

Defined in src/modules/kyub.core.svgObjExporter/src/manualNesting/ManualNestingComponent.ts:477

Repositions a part containing a plate within the manual nesting.

Parameters:

Name Type Description
plate Plate The plate object which should be positioned.
translation Vector3 The translation vector (z coordinate is ignored).

Returns: Promise‹void›