class.CoreModule
API > CoreModule
Class: CoreModule
Standard measure module for standard measure functions
Extends
BaseModule
Constructors
constructor
new CoreModule(
worker
,parent
):CoreModule
Parameters
Parameter | Type |
---|---|
worker | MeasureWorker |
parent | MeasureView |
Returns
Inherited from
BaseModule.constructor
Source
@novorender/measure/modules/base.ts:4
Properties
parent
readonly
parent:MeasureView
Inherited from
BaseModule.parent
Source
@novorender/measure/modules/base.ts:4
worker
readonly
worker:MeasureWorker
Inherited from
BaseModule.worker
Source
@novorender/measure/modules/base.ts:4
Methods
areaFromPolygon
areaFromPolygon(
vertices
):object
Calculates the area from polygon. Treat polygon as closed, Z is treated as height and is ignored.
Parameters
Parameter | Type | Description |
---|---|---|
vertices | ReadonlyVec3 [] | Vertices defining the polygon, last and first vertex will be connected to create a closed polygon |
Returns
The area of the selected polygon, do note this is 2d calulation and height is ignored
area
area: undefined
| number
polygon
polygon: ReadonlyVec3
[]
Source
@novorender/measure/modules/core/module.ts:152
isParametricDataGenerated
isParametricDataGenerated(
id
):Promise
\<boolean
>
Novorender attempts to generate parametric data from tesselated objects if it is not provided in the file.
Parameters
Parameter | Type | Description |
---|---|---|
id | number | The object id of selected object |
Returns
Promise
\< boolean
>
true if the parametric data is generated from novorender and not directly from parametric file
Source
@novorender/measure/modules/core/module.ts:85
measure
measure(
a
,b
?,settingA
?,settingB
?):Promise
\<undefined
|MeasurementValues
>
Measure object, if b is undefined then single measure values are returned else the measurement between 2 objects Standard measuring function for measure single or between 2 parametric objects.
Parameters
Parameter | Type | Description |
---|---|---|
a | MeasureEntity | The entity that is being measured, this can either be a parametric object or a single point |
b ? | MeasureEntity | If this is defined then the measure function will return the measurement between a and b. |
settingA ? | MeasureSettings | settings for object a |
settingB ? | MeasureSettings | settings for object b |
Returns
Promise
\< undefined
| MeasurementValues
>
Measurement values either for a single object or between the objects
Source
@novorender/measure/modules/core/module.ts:23
measureLineStrip
measureLineStrip(
vertices
):LineStripMeasureValues
Measure between multiple points. Will return the angles, segment length and total length
Parameters
Parameter | Type | Description |
---|---|---|
vertices | ReadonlyVec3 [] | Vertices defining the line strip to be measured |
Returns
Angles, segment length and total length of the input linestrip
Source
@novorender/measure/modules/core/module.ts:217
pickCurveSegment
pickCurveSegment(
id
):Promise
\<undefined
|ParametricEntity
|PointEntity
>
Parameters
Parameter | Type | Description |
---|---|---|
id | number | The object id of selected object |
Returns
Promise
\< undefined
| ParametricEntity
| PointEntity
>
the measure entity for given object if it is a single curveSegment
Source
@novorender/measure/modules/core/module.ts:58
pickMeasureEntity
pickMeasureEntity(
id
,selectionPosition
,tolerance
?,allowGenerated
?):Promise
\< {connectionPoint
:vec3
;entity
:MeasureEntity
;status
:LoadStatus
; } >
Returns the measure entity for given object and location, measure entity is a single part of a parametric object, such as surface, edge or vertex. If the object and position does not contain parametric data a single vertex will be returned
Parameters
Parameter | Type | Description |
---|---|---|
id | number | The object id of selected object |
selectionPosition | ReadonlyVec3 | selected position, this is required to select the individual part of the parametric object |
tolerance ? | SnapTolerance | Tolerance for picking, the distance used is in meters |
allowGenerated ? | boolean | - |
Returns
Promise
\< {
connectionPoint
: vec3
;
entity
: MeasureEntity
;
status
: LoadStatus
;
} >
Selected measure entity, this will be a vertex if nothing can be selected at the location status if the object is loaded, and connection point where the parametric object has been selected.
Source
@novorender/measure/modules/core/module.ts:43
pickMeasureEntityOnCurrentObject
pickMeasureEntityOnCurrentObject(
id
,selectionPosition
,tolerance
,allowGenerated
?):Promise
\< {connectionPoint
:vec3
;entity
:undefined
|MeasureEntity
;status
:LoadStatus
; } >
Returns the measure entity for given object and location if the current object is selected This is much faster than pickMeasureEntity and can be used for hover
Parameters
Parameter | Type | Description |
---|---|---|
id | number | The object id of selected object |
selectionPosition | ReadonlyVec3 | selected position, this is required to select the individual part of the parametric object |
tolerance | SnapTolerance | Tolerance for picking, the distance used is in meters |
allowGenerated ? | boolean | - |
Returns
Promise
\< {
connectionPoint
: vec3
;
entity
: undefined
| MeasureEntity
;
status
: LoadStatus
;
} >
Selected measure entity, this will be undefined if nothing is selectable at current position
Source
@novorender/measure/modules/core/module.ts:70
swapCylinder
swapCylinder(
entity
,to
):Promise
\<undefined
|MeasureEntity
>
Swaps between inner and outer cylinder, returns undefined if there is only one
Parameters
Parameter | Type | Description |
---|---|---|
entity | MeasureEntity | Entity to be swapped |
to | "inner" | "outer" | Force cylinder to either be inner or outer |
Returns
Promise
\< undefined
| MeasureEntity
>
Returns a new entity of the selected cylinder, if there is only one cylinder undefined is returned.