Class: Nesting
A Nesting specifies a position for objects (primarily PlateGroups) in a 2d space. This class contains the complete accessing interface for the Nesting Classes. It also contains a few utility methods, that nesting child classes might use.
The child classes can be either composites or leaves and offer specific interfaces for construction.
Hierarchy
- Nesting
Index
Constructors
Properties
Methods
- _getCenterOfPlateGroup
- _getMatrixConsideringMirroring
- _getTransformationMatrix
- _mirrorRasterizedOutlines
- _printCompareNestingWith
- _transformDirectionWithInverse
- addLabelOnEdge
- addOutlineAsNestingElement
- cloneWithNewPlateGroups
- createMirroredCopy
- createMirroredCopyInDirection
- debugPrint
- getAABB
- getJointCenterAndNormalInPlateGroupCoordinates
- getJointHintPosition
- getMatrixFor
- getOutline
- getPlateGroups
- getPositionAndRotationFor
- getRasterizedOutlinesForPlateGroup
- getSimpleNestingElementsWithPositions
- hasPlateGroup
- isAtomic
- isPlateGroupMirrored
- render
Constructors
Protected constructor
+ new Nesting(allPlateGroups: PlateGroup[]): Nesting
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:29
Parameters:
| Name | Type | Description |
|---|---|---|
allPlateGroups |
PlateGroup[] | All PlateGroups that are relevant to the model, they are used for the Facade |
Returns: Nesting
Properties
Protected Readonly plateGroupFacade
• plateGroupFacade: PlateGroupGraphFacade
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:28
Protected Readonly simpleNestingElements
• simpleNestingElements: Map‹SimpleNestingElement‹›, Matrix4‹›› = new Map
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:29
Static Private Readonly defaultDebugLevel
▪ defaultDebugLevel: DebugLevel‹› = DebugLevel.getDebugLevel("nesting")
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:27
Methods
Protected _getCenterOfPlateGroup
▸ _getCenterOfPlateGroup(plateGroup: PlateGroup): Vector3
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:277
Parameters:
| Name | Type |
|---|---|
plateGroup |
PlateGroup |
Returns: Vector3
Protected _getMatrixConsideringMirroring
▸ _getMatrixConsideringMirroring(originalMatrix: Matrix4, originalCenter: Vector3, mirroringCenter: Vector3, mirroringDirection: Vector3, targetYAxis: Vector3): Matrix4
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:222
Creates a new positional matrix for an element within a Nesting when that Nesting should be mirrored in place.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
originalMatrix |
Matrix4 | - | is the original matrix of the element within the nesting |
originalCenter |
Vector3 | - | is the original center of the element (with the matrix applied) |
mirroringCenter |
Vector3 | - | is the point on which the mirroring should be oriented on |
mirroringDirection |
Vector3 | - | is the direction that should be used to mirror on, mirroring in y-dir means flipping the y coordinates |
targetYAxis |
Vector3 | new Vector3(0, 1, 0) | can be used to correct the rotation offset of a RO that was mirrored y-wise |
Returns: Matrix4
Protected _getTransformationMatrix
▸ _getTransformationMatrix(currentPosition: Vector3, currentNormal: Vector3, targetPosition: Vector3, targetNormal: Vector3): Matrix4
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:191
Constructs a matrix transforming current position and normal to the target
Parameters:
| Name | Type |
|---|---|
currentPosition |
Vector3 |
currentNormal |
Vector3 |
targetPosition |
Vector3 |
targetNormal |
Vector3 |
Returns: Matrix4
Protected _mirrorRasterizedOutlines
▸ _mirrorRasterizedOutlines(plateGroup: PlateGroup): Map‹Plate, RasterizedOutlineWithHoles›
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:255
Mirror the rasterized outlines of the plateGroup in place, typically in y-wise direction (i.e. on x axis)
Parameters:
| Name | Type |
|---|---|
plateGroup |
PlateGroup |
Returns: Map‹Plate, RasterizedOutlineWithHoles›
Protected _printCompareNestingWith
▸ _printCompareNestingWith(otherNesting: Nesting): Promise‹void›
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:287
Print both this nesting an the other nesting separately and combined
Parameters:
| Name | Type |
|---|---|
otherNesting |
Nesting |
Returns: Promise‹void›
Protected _transformDirectionWithInverse
▸ _transformDirectionWithInverse(direction: Vector3, matrix: Matrix4): Vector3
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:272
Parameters:
| Name | Type |
|---|---|
direction |
Vector3 |
matrix |
Matrix4 |
Returns: Vector3
addLabelOnEdge
▸ addLabelOnEdge(plateGroup: PlateGroup, edgeJoint: EdgeJoint, labelText: string, isReceiving: boolean): SymbolicLinkNestingElement
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:93
Parameters:
| Name | Type | Default |
|---|---|---|
plateGroup |
PlateGroup | - |
edgeJoint |
EdgeJoint | - |
labelText |
string | - |
isReceiving |
boolean | false |
Returns: SymbolicLinkNestingElement
addOutlineAsNestingElement
▸ addOutlineAsNestingElement(applyKerf: boolean): Promise‹void›
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:87
Parameters:
| Name | Type | Default |
|---|---|---|
applyKerf |
boolean | true |
Returns: Promise‹void›
Abstract cloneWithNewPlateGroups
▸ cloneWithNewPlateGroups(plateGroupMap: Map‹PlateGroup, PlateGroup›): Nesting
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:79
Creates a copy of this nesting while replacing the plate groups according to the given map. Corresponding pairs (old and new plate group and their respective plates) need to be realized from the same model elements.
Note: RasterizedOutlines are not cloned, but the same instances are used for the new nesting.
Parameters:
| Name | Type | Description |
|---|---|---|
plateGroupMap |
Map‹PlateGroup, PlateGroup› | Mapping from old to new PlateGroup, specifying the replacement. |
Returns: Nesting
createMirroredCopy
▸ createMirroredCopy(): Promise‹this›
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:108
Creates a deep clone mirrored on AABB center y-wise (i.e. on x-axis)
Returns: Promise‹this›
Abstract createMirroredCopyInDirection
▸ createMirroredCopyInDirection(direction: Vector3): Promise‹this›
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:45
Creates a copy mirrored within the given direction. Mirror matrix has to be set on the rasterized outlines accordingly.
Parameters:
| Name | Type | Description |
|---|---|---|
direction |
Vector3 | The direction in which the nesting should be mirrored. |
Returns: Promise‹this›
debugPrint
▸ debugPrint(polygonToAdd: Polygon, debugLevel: DebugLevel‹›): void
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:156
Prints the current layout into the console
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
polygonToAdd |
Polygon | null | an additional polygon that will be added to the current print |
debugLevel |
DebugLevel‹› | Nesting.defaultDebugLevel | determines the visibility, to show the print with debugLevel nesting use flag #debug.nesting=0 |
Returns: void
Abstract getAABB
▸ getAABB(): AABB
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:55
Gets the axis aligned bounding box of this nesting.
Returns: AABB
Abstract getJointCenterAndNormalInPlateGroupCoordinates
▸ getJointCenterAndNormalInPlateGroupCoordinates(plateGroup: PlateGroup, edgeJoint: EdgeJoint): [Vector3, Vector3]
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:62
Parameters:
| Name | Type |
|---|---|
plateGroup |
PlateGroup |
edgeJoint |
EdgeJoint |
Returns: [Vector3, Vector3]
getJointHintPosition
▸ getJointHintPosition(plateGroup: PlateGroup, edgeJoint: EdgeJoint): [Vector3, number]
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:181
Returns the center of the edgeJoint and the outward-facing direction as an angle in degrees.
Parameters:
| Name | Type |
|---|---|
plateGroup |
PlateGroup |
edgeJoint |
EdgeJoint |
Returns: [Vector3, number]
Abstract getMatrixFor
▸ getMatrixFor(plateGroup: PlateGroup): Matrix4
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:61
Parameters:
| Name | Type |
|---|---|
plateGroup |
PlateGroup |
Returns: Matrix4
Abstract getOutline
▸ getOutline(): Promise‹Polygon›
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:50
Gets the outline of this nesting, implementation is subclass specific.
Returns: Promise‹Polygon›
Abstract getPlateGroups
▸ getPlateGroups(): PlateGroup[]
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:58
Returns: PlateGroup[]
getPositionAndRotationFor
▸ getPositionAndRotationFor(plateGroup: PlateGroup): [Vector2, number]
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:139
Creates position + rotation from the transformation matrix that is used for internal representation
Parameters:
| Name | Type |
|---|---|
plateGroup |
PlateGroup |
Returns: [Vector2, number]
Abstract getRasterizedOutlinesForPlateGroup
▸ getRasterizedOutlinesForPlateGroup(plateGroup: PlateGroup): Map‹Plate, RasterizedOutlineWithHoles›
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:67
Parameters:
| Name | Type |
|---|---|
plateGroup |
PlateGroup |
Returns: Map‹Plate, RasterizedOutlineWithHoles›
Abstract getSimpleNestingElementsWithPositions
▸ getSimpleNestingElementsWithPositions(): Array‹[SimpleNestingElement, Matrix4]›
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:69
Returns: Array‹[SimpleNestingElement, Matrix4]›
Abstract hasPlateGroup
▸ hasPlateGroup(plateGroup: PlateGroup): boolean
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:59
Parameters:
| Name | Type |
|---|---|
plateGroup |
PlateGroup |
Returns: boolean
Abstract isAtomic
▸ isAtomic(): boolean
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:56
Returns: boolean
isPlateGroupMirrored
▸ isPlateGroupMirrored(plateGroup: PlateGroup): boolean
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:118
If this returns false, then the plateGroup outline and the plateGroup RasterizedOutline are in the same coordinate system. Otherwise, the RasterizedOutline was flipped once y-wise. (see RasterizedOutline)
Parameters:
| Name | Type |
|---|---|
plateGroup |
PlateGroup |
Returns: boolean
Abstract render
▸ render(): Promise‹void›
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/Nesting.ts:85
Creates and prepares all nesting elements for export. Those additional elements will be placed and rendered afterwards (during SvgCreator._renderSvg).
Returns: Promise‹void›