Skip to main content

class.CoreModule

API > CoreModule

Class: CoreModule

Standard measure module for standard measure functions

Extends

  • BaseModule

Constructors

constructor

new CoreModule(worker, parent): CoreModule

Parameters

ParameterType
workerMeasureWorker
parentMeasureView

Returns

CoreModule

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

ParameterTypeDescription
verticesReadonlyVec3[]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

ParameterTypeDescription
idnumberThe 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

ParameterTypeDescription
aMeasureEntityThe entity that is being measured, this can either be a parametric object or a single point
b?MeasureEntityIf this is defined then the measure function will return the measurement between a and b.
settingA?MeasureSettingssettings for object a
settingB?MeasureSettingssettings 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

ParameterTypeDescription
verticesReadonlyVec3[]Vertices defining the line strip to be measured

Returns

LineStripMeasureValues

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

ParameterTypeDescription
idnumberThe 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

ParameterTypeDescription
idnumberThe object id of selected object
selectionPositionReadonlyVec3selected position, this is required to select the individual part of the parametric object
tolerance?SnapToleranceTolerance 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

ParameterTypeDescription
idnumberThe object id of selected object
selectionPositionReadonlyVec3selected position, this is required to select the individual part of the parametric object
toleranceSnapToleranceTolerance 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

ParameterTypeDescription
entityMeasureEntityEntity 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.

Source

@novorender/measure/modules/core/module.ts:124