Instance Settings
Below we will consider the settings which need to be passed to the function c3dviewer.createC3DViewer(..)
.
Basic type of instance settings (TypeScript):
export type ViewerSettings = {
c3dService:{
host:string,
port:string,
path?:string
},
resources?:{
fonts?:string[]
},
defines?: ViewerDefines
logger?: Logger
}
There is only one required parameter. It’s c3dService
which configures a
connection to the C3D Service. It includes:
host: a hostname of the C3D Service;
port: a port of the C3D Service;
path: a URL path of a C3D Service RPC connection. The default value is
/wrpc
.
The resources
parameter is additional resources which can be available in a scene.
At the moment, there’re only fonts available. They are a list of strings containing font URLs.
Further, these fonts can be used by font families in parameters of commands
or processes to display a text.
The defines
parameter is a set of constants used in various subsystems.
The detailed information is in the section Viewer defines.
The final setting is a ‘logging’ one which is used only for debugging. In the general
case, you can simply set a web page console
object as this parameter to view all messages.
Also it can be used in the advanced mode, as this parameter accepts any object which has
functions of the corresponding logging level (e.g.log(..)
, warn(..)
, debug(..)
and etc.).
New in version 1.6.0: Added the ViewerSettings.defines
.
Viewer defines
This is a set of constants used by the reviewer and divided into the purpose groups.
Basic type of viewer defines (TypeScript):
export type ViewerDefines = {
comment?: {
text?: string
}
click?: {
delay?: number
tolerance?: number
}
hint?: {
delay?: number
tolerance?: number
}
snap?: {
delay?: number,
tolerance?: number,
},
}
Property comment.text
indicates the default label value for a comment.
Groups click
, hint
and snap
have the same type, but different purposes. Each of them defines:
delay: a time in milliseconds before activation;
tolerance: an acceptable deviation of the mouse cursor in pixels.
The click
group is to interpret mouse double-clicking. It’s used in the
default process for onEdit
and onEditText
callbacks.
The delay
defines a delay between single clicks to distinguish them from double clicks, and the
tolerance
is an acceptable cursor deviation while waiting for a second click.
The hint
group is used for tool tooltip in the default process for onHint
callback.
The delay
defines a delay to interpret a mouse movement stop as a hint request, and the
tolerance
is an acceptable cursor deviation while waiting for a timeout.
The snap
group is used for snapping to geometry boundary points in the set point,
add angle dimension and
add linear dimension processes.
The delay
defines a delay before activation of the snapping mechanism, and the tolerance
is an
acceptable cursor deviation while waiting for a timeout.
All the defined constants have the default values provided in the next table.
The default values of viewer defines:
Group |
Property |
Default |
---|---|---|
|
|
|
|
|
300 |
|
5 |
|
|
|
1000 |
|
5 |
|
|
|
500 |
|
5 |