editor › Globals › PlateMerger
Class: PlateMerger
Creates Plate instances by merging existing plates while re-creating (or optionally replacing) existing joints
Hierarchy
- PlateMerger
Index
Constructors
Properties
- edgeJointsToCopy
- jointsToConvert
- surfaceJointsToCopy
- defaultEdgeJointsToCopy
- defaultJointsToConvert
- defaultSurfaceJointsToCopy
Methods
- _2dPointArrayFromOutline
- _copyEdgeJoints
- _copySurfaceJoints
- _createFlippedClone
- _destroyObsoleteJoints
- _getMaterial
- _getOverlappingOutlineSections
- _getUnmergedOutlineSections
- _groupMergeablePlates
- _insertCoplanarPointsWhereNeeded
- _localPolygonFromPlate
- _mergePlateOutlines
- _mergePlates
- _plateFromPolygon
- _removePlates
- _restoreOutlineSplines
- mergeMergeablePlates
Constructors
constructor
+ new PlateMerger(edgeJointsToCopy: Array‹typeof Joint›, surfaceJointsToCopy: Array‹typeof Joint›, jointsToConvert: Map‹typeof Joint, typeof Joint›): PlateMerger
Defined in src/model/data/PhysicalObject/PlateMerger.ts:38
Parameters:
| Name | Type | Default |
|---|---|---|
edgeJointsToCopy |
Array‹typeof Joint› | PlateMerger.defaultEdgeJointsToCopy |
surfaceJointsToCopy |
Array‹typeof Joint› | PlateMerger.defaultSurfaceJointsToCopy |
jointsToConvert |
Map‹typeof Joint, typeof Joint› | PlateMerger.defaultJointsToConvert |
Returns: PlateMerger
Properties
Private Readonly edgeJointsToCopy
• edgeJointsToCopy: Array‹typeof Joint›
Defined in src/model/data/PhysicalObject/PlateMerger.ts:36
Private Readonly jointsToConvert
• jointsToConvert: Map‹typeof Joint, typeof Joint›
Defined in src/model/data/PhysicalObject/PlateMerger.ts:38
Private Readonly surfaceJointsToCopy
• surfaceJointsToCopy: Array‹typeof Joint›
Defined in src/model/data/PhysicalObject/PlateMerger.ts:37
Static Private defaultEdgeJointsToCopy
▪ defaultEdgeJointsToCopy: Array‹typeof Joint› = [FingerJoint, TeeJoint, CoplanarJoint]
Defined in src/model/data/PhysicalObject/PlateMerger.ts:33
Static Private defaultJointsToConvert
▪ defaultJointsToConvert: Map‹FingerJoint, TeeJoint› = new Map([[FingerJoint, TeeJoint]])
Defined in src/model/data/PhysicalObject/PlateMerger.ts:35
Static Private defaultSurfaceJointsToCopy
▪ defaultSurfaceJointsToCopy: Array‹typeof Joint› = [AssetJoint]
Defined in src/model/data/PhysicalObject/PlateMerger.ts:34
Methods
Private _2dPointArrayFromOutline
▸ _2dPointArrayFromOutline(outline: Outline, referenceTransforms: Transforms): Array‹[number, number]›
Defined in src/model/data/PhysicalObject/PlateMerger.ts:254
Parameters:
| Name | Type |
|---|---|
outline |
Outline |
referenceTransforms |
Transforms |
Returns: Array‹[number, number]›
Private _copyEdgeJoints
▸ _copyEdgeJoints(plates: Plate[], newPlate: Plate): void
Defined in src/model/data/PhysicalObject/PlateMerger.ts:292
Parameters:
| Name | Type |
|---|---|
plates |
Plate[] |
newPlate |
Plate |
Returns: void
Private _copySurfaceJoints
▸ _copySurfaceJoints(plates: Plate[], newPlate: Plate): void
Defined in src/model/data/PhysicalObject/PlateMerger.ts:317
Parameters:
| Name | Type |
|---|---|
plates |
Plate[] |
newPlate |
Plate |
Returns: void
Private _createFlippedClone
▸ _createFlippedClone(plate: Plate): Plate
Defined in src/model/data/PhysicalObject/PlateMerger.ts:496
Creates a flipped clone of the plate and adds it to the assembly. Should only be done with un-joined plates, as the joints will not be transferred.
Parameters:
| Name | Type |
|---|---|
plate |
Plate |
Returns: Plate
Private _destroyObsoleteJoints
▸ _destroyObsoleteJoints(plates: Plate[]): void
Defined in src/model/data/PhysicalObject/PlateMerger.ts:349
Destroys all joints included in this.jointsToConvert that include a connection with a plate given by plates
Parameters:
| Name | Type | Description |
|---|---|---|
plates |
Plate[] | list of plates which joints should get removed |
Returns: void
Private _getMaterial
▸ _getMaterial(plates: Plate[]): IPlateMaterial
Defined in src/model/data/PhysicalObject/PlateMerger.ts:513
Get material settings for the merged plate. Currently just uses settings from the first plate.
Parameters:
| Name | Type |
|---|---|
plates |
Plate[] |
Returns: IPlateMaterial
Private _getOverlappingOutlineSections
▸ _getOverlappingOutlineSections(plates: Plate[]): OutlineSection[]
Defined in src/model/data/PhysicalObject/PlateMerger.ts:407
Parameters:
| Name | Type |
|---|---|
plates |
Plate[] |
Returns: OutlineSection[]
Private _getUnmergedOutlineSections
▸ _getUnmergedOutlineSections(plates: Plate[]): OutlineSection[]
Defined in src/model/data/PhysicalObject/PlateMerger.ts:398
Parameters:
| Name | Type |
|---|---|
plates |
Plate[] |
Returns: OutlineSection[]
array of outline sections that will still exist after plates have been merged
Private _groupMergeablePlates
▸ _groupMergeablePlates(plates: Plate[]): Plate[][]
Defined in src/model/data/PhysicalObject/PlateMerger.ts:426
Parameters:
| Name | Type |
|---|---|
plates |
Plate[] |
Returns: Plate[][]
Private _insertCoplanarPointsWhereNeeded
▸ _insertCoplanarPointsWhereNeeded(platesToCheck: Plate[], newPlate: Plate, epsilon: number): void
Defined in src/model/data/PhysicalObject/PlateMerger.ts:218
Checks if points of the new Plate lie in platesToCheck. If that is the case, an OutlinePoint is inserted, to ensure that they can be connected with joints correctly
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
platesToCheck |
Plate[] | - | - |
newPlate |
Plate | - | - |
epsilon |
number | positionEpsilon | maximum distance a point can have to the outlineSection to be still detected as on it |
Returns: void
Private _localPolygonFromPlate
▸ _localPolygonFromPlate(transformedPlate: Plate, referenceTransforms: Transforms): Polygon
Defined in src/model/data/PhysicalObject/PlateMerger.ts:241
Transform the outline and cutouts of transformedPlate to a polygon in the local coordinates of localPlate
Parameters:
| Name | Type | Description |
|---|---|---|
transformedPlate |
Plate | used to extract outline and cutout points |
referenceTransforms |
Transforms | used to do local coordinate transformation (result coordinate system) |
Returns: Polygon
contains the points from transformedPlate in the coordinate system of localPlate
Private _mergePlateOutlines
▸ _mergePlateOutlines(plates: Plate[], cancelToken: CancelToken): Promise‹Plate›
Defined in src/model/data/PhysicalObject/PlateMerger.ts:155
Merge all given plates into a new plate
Parameters:
| Name | Type | Description |
|---|---|---|
plates |
Plate[] | List of Plates that will be joined |
cancelToken |
CancelToken | - |
promise resolving in final plate created based on the specified plates. the plate will be in assembly coordinates, thus no mapping must be performed when adding it to the assembly again
Private _mergePlates
▸ _mergePlates(plates: Plate[], cancelToken: CancelToken): Promise‹Plate›
Defined in src/model/data/PhysicalObject/PlateMerger.ts:97
Merges the outlines of coplanar touching plates. Adds plate to assembly. Recreates existing joints and transforms joints if necessary. Does not remove the old plates from the assembly yet.
Parameters:
| Name | Type | Description |
|---|---|---|
plates |
Plate[] | plates array of coplanar touching plates |
cancelToken |
CancelToken | - |
the new merged plate
Private _plateFromPolygon
▸ _plateFromPolygon(polygon: Polygon, referenceTransforms: Transforms): Plate
Defined in src/model/data/PhysicalObject/PlateMerger.ts:274
Transform a Polygon into a Plate in the referenceObjects' coordinate system
Parameters:
| Name | Type | Description |
|---|---|---|
polygon |
Polygon | will be transformed into a Plate |
referenceTransforms |
Transforms | used to transform the local to world coordinates |
Returns: Plate
Transformed Plate containing the polygon's outline and holes
Private _removePlates
▸ _removePlates(plates: Plate[]): void
Defined in src/model/data/PhysicalObject/PlateMerger.ts:384
Parameters:
| Name | Type |
|---|---|
plates |
Plate[] |
Returns: void
Private _restoreOutlineSplines
▸ _restoreOutlineSplines(resultPlate: Plate, plates: Plate[]): void
Defined in src/model/data/PhysicalObject/PlateMerger.ts:190
Parameters:
| Name | Type |
|---|---|
resultPlate |
Plate |
plates |
Plate[] |
Returns: void
mergeMergeablePlates
▸ mergeMergeablePlates(plates: Plate[], cancelToken: CancelToken): Promise‹Plate[]›
Defined in src/model/data/PhysicalObject/PlateMerger.ts:66
Finds and merges coplanar touching (= mergeable) plates in the given plates. For each group of mergeable plates, one merged plate is created. All given plates are expected to belong to the same assembly. Plates that have no coplanar touching plates are returned as-is; they are neither altered nor removed from the assembly. All groups of coplanar touching plates are merged into one resulting plate each, while respecting the PlateMerger's jointsToCopy and jointsToConvert. In the assembly, the mergeable plates are replaced with the newly created merged plates.
Parameters:
| Name | Type | Description |
|---|---|---|
plates |
Plate[] | the plates that should be grouped and merged |
cancelToken |
CancelToken | - |
new Plates that have been merged