Skip to main content

Drawing

The Drawing manages all necessary data that belong to a model.

On the one hand these are the structure and graphic data by which the CAD model is defined, on the other hand it administers additional data for the support with the client-sided development.

image

DrawingID#

DrawingAPI#

structure#

selection#

interaction#

plugin#

geometry#

graphic#

cad#

reset#

Declaration

() => void

Returns void

DrawingState#

Members

NameTypeDescription
apiDrawingAPI

createDrawingState#

StructureData#

Members

NameTypeDescription
productsObjectID[]
visibleContainersGraphicID[]

StructureApi#

get#

Declaration

(): StructureData

Returns StructureData

set#

Declaration

(structure: IStructureProtocol): void

Params

NameTypeDefaultDescription
structureIStructureProtocol

Returns void

applyPatches#

Declaration

(patches: IStructurePatch[]): void

Params

NameTypeDefaultDescription
patchesIStructurePatch[]

Returns void

filterTree#

Declaration

(tree: IStructureTree, filter: (obj: IStructureObject) => boolean): IStructureObject[]

Params

NameTypeDefaultDescription
treeIStructureTree
filter(obj: IStructureObject) => boolean

Returns IStructureObject[]

findTree#

Declaration

(tree: IStructureTree, filter: (obj: IStructureObject) => boolean): IStructureObject | undefined

Params

NameTypeDefaultDescription
treeIStructureTree
filter(obj: IStructureObject) => boolean

Returns IStructureObject | undefined

collectUsedSolidIds#

Declaration

(): ObjectID[]

Returns ObjectID[]

collectProducts#

Declaration

(root: ObjectID): IStructureObject[]

Params

NameTypeDefaultDescription
rootObjectID

Returns IStructureObject[]

getProductSolidIds#

Declaration

(productId: ObjectID): any[]

Params

NameTypeDefaultDescription
productIdObjectID

Returns any[]

postProcessStructureUpdate#

Declaration

(): void

Returns void

calculateGlobalTransformation#

Calculates the global transformation matrix for the given objectId.

Declaration

(objectId: ObjectID, matrix: THREE.Matrix4 = new THREE.Matrix4().identity()): THREE.Matrix4

Params

NameTypeDefaultDescription
objectIdObjectIDThe object to calculate the global transformation for.
matrix?THREE.Matrix4new THREE.Matrix4().identity()The initial matrix (mainly used for recursion). It is an out parameter and in the end, it will contain the same matrix as the return value of this function.

Returns THREE.Matrix4
The global transformation matrix for the given objectId.

calculateProductBounds#

Declaration

(productId: ObjectID, base?: {
min: THREE.Vector3;
max: THREE.Vector3;
}): { center: THREE.Vector3; radius: number; max: THREE.Vector3; min: THREE.Vector3; }

Params

NameTypeDefaultDescription
productIdObjectID
base.minTHREE.Vector3
base.maxTHREE.Vector3

Returns { center: THREE.Vector3; radius: number; max: THREE.Vector3; min: THREE.Vector3; }

getDrawingId#

This is a workaround to get the corresponding drawing id via API.

!!! Should not be used in user code !!!

Declaration

(): DrawingID

Returns DrawingID
The drawing id.

structureData#

structureApi#

GraphicData#

Members

NameTypeDescription
containersRecord<number, IGraphicContainer>

GraphicApi#

addPackages#

Declaration

(packages: IGraphicPackage[]): void

Params

NameTypeDefaultDescription
packagesIGraphicPackage[]

Returns void

cleanupGraphicRecords#

Declaration

(): void

Returns void

filter#

Declaration

(cb: (elem: IGraphicElement) => boolean, options?: {
onlyOne?: boolean;
containerId?: ObjectID;
}): { elem: IGraphicElement; containerId: ObjectID; solidId: ObjectID; }[]

Params

NameTypeDefaultDescription
cb(elem: IGraphicElement) => boolean
options.onlyOne?boolean
options.containerId?ObjectID

Returns { elem: IGraphicElement; containerId: ObjectID; solidId: ObjectID; }[]

graphicData#

containers#

graphicApi#

GeometryBounds#

Members

NameTypeDescription
centerTHREE.Vector3
radiusnumber
maxTHREE.Vector3
minTHREE.Vector3

GeometryConfig#

disabled#

meshes#

Members

NameTypeDescription
meshes.wireframeboolean
meshes.depthWriteboolean

edges#

points#

GeometryData#

cache#

Members

NameTypeDescription
cache.dirtyStampnumberThe dirty stamp will be updated, as soon as a client side modification of the geometry will happen! Examples: 'setColor' or 'setOpacity' Can for example be used to trigger the render process for this container.

stamp#

bounds#

config#

Members

NameTypeDescription
config.productRecord<ObjectID, GeometryConfig>

GeometryApi#

updateBounds#

Updates the @see geometry.bounds depending on all products of the model. The update will only happen, if at least one solid of one product is available.

Declaration

(): void

Returns void

createGeometryIfNotCached#

Declaration

(containerId: ObjectID, color?: number[]): ContainerGeometryT | undefined

Params

NameTypeDefaultDescription
containerIdObjectID
color?number[]

Returns ContainerGeometryT | undefined

setGraphicColor#

Declaration

(containerId: ObjectID, graphicId: GraphicID, r: number, g: number, b: number): void

Params

NameTypeDefaultDescription
containerIdObjectID
graphicIdGraphicID
rnumber
gnumber
bnumber

Returns void

setContainerColor#

Declaration

(containerId: ObjectID, r: number, g: number, b: number): void

Params

NameTypeDefaultDescription
containerIdObjectID
rnumber
gnumber
bnumber

Returns void

setOpacity#

Declaration

(containerId: ObjectID, opacity: number): void

Params

NameTypeDefaultDescription
containerIdObjectID
opacitynumber

Returns void

setConfig#

Declaration

(objId: ObjectID, config: Partial<GeometryConfig> | null): void

Params

NameTypeDefaultDescription
objIdObjectID
configPartial<GeometryConfig> l null

Returns void

findDecorated#

Declaration

(): GeometryElement[]

Returns GeometryElement[]

filter#

Declaration

(cb: (elem: GeometryElement) => boolean, options?: {
onlyOne?: boolean;
containerId?: ObjectID;
}): GeometryElement[]

Params

NameTypeDefaultDescription
cb(elem: GeometryElement) => boolean
options.onlyOne?boolean
options.containerId?ObjectID

Returns GeometryElement[]

geometryData#

cache#

stamp#

bounds#

center#

radius#

min#

max#

config#

product#

geometryApi#

BuerliScope#

SelectorID#

SeletedItemData#

SelectionScope#

SelectedItem#

id#

scope#

data#

label#

removeCondition#

Declaration

(d: DrawingState) => boolean

Params

NameTypeDefaultDescription
dDrawingState

Returns boolean

SelectionFilter#

Members

NameTypeDescription

CustomSelect#

Members

NameTypeDescription

Selector#

Type for selector.

Members

NameTypeDescription
isSelectableSelectionFilter
itemsArray<SelectedItem<T>>
hoveredItemSelectedItem<T> l null
maxLennumber
customSelectCustomSelect
customUnSelectCustomSelect

SelectionData#

Members

NameTypeDescription
refsRecord<SelectorID, Selector>
activeSelectorID l null

SelectionApi#

unselectAll#

unselect#

select#

setHovered#

activateSelector#

createSelector#

areItemsSelected#

Declaration

(items: SelectedItem[], selectorId?: SelectorID): boolean

Params

NameTypeDefaultDescription
itemsSelectedItem[]
selectorId?SelectorID

Returns boolean

isItemSelected#

Declaration

(item: SelectedItem, selectorId?: SelectorID): boolean

Params

NameTypeDefaultDescription
itemSelectedItem
selectorId?SelectorID

Returns boolean

setItems#

selectGraphic#

Declaration

(selectorId: SelectorID, items: {
productId: ObjectID;
containerId: GraphicID;
graphicId?: GraphicID;
}[], options?: {
unselectExisting?: boolean;
}): void

Params

NameTypeDefaultDescription
selectorIdSelectorID
items{ productId: ObjectID; containerId: GraphicID; graphicId?: GraphicID }[]
options.unselectExisting?boolean

Returns void

getGraphicItem#

Declaration

(productId: ObjectID, containerId: GraphicID, graphicId?: GraphicID): SelectedItem<ProductElement> | null

Params

NameTypeDefaultDescription
productIdObjectID
containerIdGraphicID
graphicId?GraphicID

Returns SelectedItem<ProductElement> | null

selectionData#

refs#

active#

selectionApi#

createGraphicItem#

PluginDescription#

name#

version#

author#

persistent#

global#

initialState#

Members

NameTypeDescription

Plugin#

Root#

Members

NameTypeDescription

View#

Members

NameTypeDescription

description#

PluginDef#

PluginImpl#

Members

NameTypeDescription

PluginID#

PluginState#

PluginData#

feature#

Contains ids of feature-plugins

global#

Contains ids of global-plugins

refs#

active#

Members

NameTypeDescription
active.featurePluginID l null
active.globalPluginID[]

visible#

PluginApi#

setActiveFeature#

Declaration

(id: ObjectID | null): void

Params

NameTypeDefaultDescription
idObjectID l null

Returns void

setVisiblePlugin#

Declaration

(id: PluginID, visible: boolean): void

Params

NameTypeDefaultDescription
idPluginID
visibleboolean

Returns void

setActiveGlobal#

Declaration

(id: PluginID, active: boolean): void

Params

NameTypeDefaultDescription
idPluginID
activeboolean

Returns void

createPlugin#

Declaration

(def: PluginDef, defaultId?: ObjectID | string, drawingId?: DrawingID, objectId?: ObjectID): (deactivate?: boolean) => void

Params

NameTypeDefaultDescription
defPluginDef
defaultId?ObjectID l string
drawingId?DrawingID
objectId?ObjectID

Returns (deactivate?: boolean) => void

pluginData#

feature#

global#

refs#

active#

feature#

global#

visible#

pluginApi#

isPromisePlugin#

Declaration

export function isPromisePlugin(def: PluginDef): def is Promise<Plugin>;

Params

NameTypeDefaultDescription
defPluginDef

Returns def is Promise<Plugin>

InteractionData#

Members

NameTypeDescription
hoveredInteractionInfo l null
selectedInteractionInfo[]

InteractionApi#

setHovered#

Sets the hovered item in the store to the given item.

Declaration

(item: InteractionInfo | null): void

Params

NameTypeDefaultDescription
itemInteractionInfo l nullThe item.

Returns void

setSelected#

Reset the 'selected' array to the given items.

Declaration

(items: InteractionInfo[]): void

Params

NameTypeDefaultDescription
itemsInteractionInfo[]The items.

Returns void

select#

Adds the given item to the 'selected' array if it is not yet selected. If the item is already selected, it will be removed from the 'selected' array.

With 'multi' enabled, the already selected items will remain selected.

Declaration

(item: InteractionInfo, multi?: boolean): void

Params

NameTypeDefaultDescription
itemInteractionInfoThe item to select.
multi?booleanDo multi select.

Returns void

interactionData#

hovered#

selected#

interactionApi#