editor › Globals › AssemblyHelpers
Class: AssemblyHelpers
This class contains of static helper methods which are used by the AssemblePlateTool. Most of the methods deal with finding, transferring and transforming meshes.
Hierarchy
- AssemblyHelpers
Index
Methods
- _makeAnchor
- _mapTransformsToGlobal
- assembleRemainingMeshesFromOriginAssembly
- centerPointDelta
- computeTransformsInReferenceSystem
- findMeshForSegment
- findSurfaceDescriptorForJoint
- getMeshesForAssembling
- getSvgSurfaceDescriptorsInAssembly
- preloadUnderConstructionTexture
- putMeshesInNewAssembly
- removeAllPlaceholderDescriptors
- showState
- transferSubGraph
Methods
Static Private _makeAnchor
▸ _makeAnchor(__namedParameters: object): ArbitraryTransformsAnchor
Defined in src/modules/kyub.core.plateImport/src/AssemblyHelpers.ts:235
Parameters:
▪ __namedParameters: object
| Name | Type |
|---|---|
position |
any |
rotation |
any |
Returns: ArbitraryTransformsAnchor
Static Private _mapTransformsToGlobal
▸ _mapTransformsToGlobal(referenceMesh: IAssemblingSvgSurface, __namedParameters: object): object
Defined in src/modules/kyub.core.plateImport/src/AssemblyHelpers.ts:222
Parameters:
▪ referenceMesh: IAssemblingSvgSurface
▪ __namedParameters: object
| Name | Type |
|---|---|
position |
any |
rotation |
any |
Returns: object
-
position: Vector3
-
rotation: Quaternion
Static assembleRemainingMeshesFromOriginAssembly
▸ assembleRemainingMeshesFromOriginAssembly(referenceMesh: IAssemblingSvgSurface, meshesAndTransforms: Map‹IAssemblingSvgSurface, IBasicTransforms›): void
Defined in src/modules/kyub.core.plateImport/src/AssemblyHelpers.ts:53
Takes each mesh's position and rotation (that are in the reference mesh's local coordinate system) and apply them with respect to the reference mesh in the current (new) assembly. referenceMesh-local position and rotation ==> new-assembly-global position and rotation
Parameters:
| Name | Type | Description |
|---|---|---|
referenceMesh |
IAssemblingSvgSurface | - |
meshesAndTransforms |
Map‹IAssemblingSvgSurface, IBasicTransforms› | - |
Returns: void
Static centerPointDelta
▸ centerPointDelta(operation: CombineOperation, transforms: object): Vector3
Defined in src/modules/kyub.core.plateImport/src/AssemblyHelpers.ts:151
Calculates the global distance between a CombineOperation's origin and destination joint centerPoints
Parameters:
▪ operation: CombineOperation
-
▪ transforms: object
| Name | Type |
|---|---|
destination |
IReadOnlyTransforms |
origin |
IReadOnlyTransforms |
Returns: Vector3
Static computeTransformsInReferenceSystem
▸ computeTransformsInReferenceSystem(svgSurfaceDescriptors: IAssemblingSvgSurface[], referenceTransforms: IReadOnlyTransforms): Map‹IAssemblingSvgSurface, IBasicTransforms›
Defined in src/modules/kyub.core.plateImport/src/AssemblyHelpers.ts:32
Computes each surface descriptor's position and rotation, in the referenceMesh's local coordinate system.
Parameters:
| Name | Type | Description |
|---|---|---|
svgSurfaceDescriptors |
IAssemblingSvgSurface[] | The elements whose position is to be computed. |
referenceTransforms |
IReadOnlyTransforms | Provides the local coordinate system, e.g. originMesh. |
Returns: Map‹IAssemblingSvgSurface, IBasicTransforms›
Static findMeshForSegment
▸ findMeshForSegment(compositeModel: any, segment: any): SvgSurfaceDescriptor
Defined in src/modules/kyub.core.plateImport/src/AssemblyHelpers.ts:103
Parameters:
| Name | Type |
|---|---|
compositeModel |
any |
segment |
any |
Returns: SvgSurfaceDescriptor
Static findSurfaceDescriptorForJoint
▸ findSurfaceDescriptorForJoint(joint: Joint‹AtomicPattern›, assembly: Assembly, useSecondPlate: boolean): SvgSurfaceDescriptor
Defined in src/modules/kyub.core.plateImport/src/AssemblyHelpers.ts:137
Given a joint and an assembly, this method finds the SvgSurfaceDescriptor in the assembly whose Segment contains the joint.
Parameters:
| Name | Type | Default |
|---|---|---|
joint |
Joint‹AtomicPattern› | - |
assembly |
Assembly | - |
useSecondPlate |
boolean | false |
Returns: SvgSurfaceDescriptor
Static getMeshesForAssembling
▸ getMeshesForAssembling(source: Assembly, destination: Assembly): object
Defined in src/modules/kyub.core.plateImport/src/AssemblyHelpers.ts:121
When the user has selected two assemblies that should be assembled, we need to find the meshes in these assemblies that will be assembled. For a normal assembly, that should be all SvgSurfaceDescriptors in that assembly. However, for a PlateStack, we only want one SvgSurfaceDescriptor.
Parameters:
| Name | Type |
|---|---|
source |
Assembly |
destination |
Assembly |
Returns: object
-
destinationMeshes: SvgSurfaceDescriptor[]
-
originMeshes: SvgSurfaceDescriptor[]
Static getSvgSurfaceDescriptorsInAssembly
▸ getSvgSurfaceDescriptorsInAssembly(assembly: Assembly, skipFirstPlate: boolean): SvgSurfaceDescriptor[]
Defined in src/modules/kyub.core.plateImport/src/AssemblyHelpers.ts:94
This finds all the SvgSurfaceDescriptors in an assembly.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
assembly |
Assembly | - | the assembly to search for assemblable SvgSurfaceDescriptors |
skipFirstPlate |
boolean | false | if the assembly is a PlateStack, whether its top plate should be skipped (and instead, the second one chosen) |
Returns: SvgSurfaceDescriptor[]
Static preloadUnderConstructionTexture
▸ preloadUnderConstructionTexture(): void
Defined in src/modules/kyub.core.plateImport/src/AssemblyHelpers.ts:218
Loads the under construction texture so it is rendered quicker when we need it
Returns: void
Static putMeshesInNewAssembly
▸ putMeshesInNewAssembly(meshes: Mesh[], compositeModel: CompositeModel, transforms?: IReadOnlyTransforms): Assembly
Defined in src/modules/kyub.core.plateImport/src/AssemblyHelpers.ts:68
Removes the meshes from their current assembly, and puts them all together in a new assembly. The assembly is then added to the compositeModel and returned.
Parameters:
| Name | Type |
|---|---|
meshes |
Mesh[] |
compositeModel |
CompositeModel |
transforms? |
IReadOnlyTransforms |
Returns: Assembly
Static removeAllPlaceholderDescriptors
▸ removeAllPlaceholderDescriptors(editorInstance: Editor): void
Defined in src/modules/kyub.core.plateImport/src/AssemblyHelpers.ts:203
Parameters:
| Name | Type |
|---|---|
editorInstance |
Editor |
Returns: void
Static showState
▸ showState(generatedState: IAssemblingSvgSurface[], editorInstance: Editor, transforms?: IReadOnlyTransforms): Promise‹Assembly›
Defined in src/modules/kyub.core.plateImport/src/AssemblyHelpers.ts:182
Adds the provided plates to a new assembly, makes sure to de-virtualize, if necessary places the assembly and takes a snapshot
Parameters:
| Name | Type | Description |
|---|---|---|
generatedState |
IAssemblingSvgSurface[] | the plates |
editorInstance |
Editor | - |
transforms? |
IReadOnlyTransforms | where to put the finished assembly |
Static transferSubGraph
▸ transferSubGraph(originMesh: Mesh, destinationMesh: Mesh): void
Defined in src/modules/kyub.core.plateImport/src/AssemblyHelpers.ts:166
This method transfers the originMesh to the assembly of the destinationMesh.
Parameters:
| Name | Type |
|---|---|
originMesh |
Mesh |
destinationMesh |
Mesh |
Returns: void