Adding Angle Dimension Process
The process is interactive one which allows to add a new 3D angle dimension to a model by selecting three points.
Common type of the process (TypeScript):
export type AddAngleDimensionProcess = {
name: "AddAngleDimension"
surfaceInterpretation?: boolean
snap?: SnapOptions
options: {
text?: string
underlineText?: boolean
font?: {
family?: string,
size?: number,
}
colors?: {
text?: C3DViewRGB
textBkg?: C3DViewRGB
lines?: C3DViewRGB
}
}
events:{
onNew?: () => string
onCreate?: (uuid: string) => C3DUserData
onValue?: (value: number) => string
}
}
The mode is available if set surfaceInterpretation
property is set to true
.
The option snap
allows to move the points indicated by the user’s mouse cursor to the
nearest vertices of the triangle. More details in the section
Snap option. This option is disabled by default.
The dimensions are constructed by 2 points specified by the user in this mode. Every point detects a geometry placement surface on which a point is placed. If placements are not parallel to each other, then a new angle dimension is added, otherwise the adding is canceled.
Options
Options are common for all dimensions processes (including linear dimension).
Name |
Description |
---|---|
|
The default label text of a dimension. The default is |
|
The flag for underlined label text. The default is |
|
The font name used for a label. The default is |
|
The font size used for a label. The default is |
|
The label text color. The default is |
|
The label text background color. The default is |
|
The dimension line color. The default is |
Callbacks
Available events:
onNew(): emitted before creating a new dimension. Returns a string which is used as a dimension label text instead of the default value.
onCreate(uuid): emitted after creating a new dimension. It receives a UUID of a new object and allows to set custom dimension properties by returning them as an object.
onValue(value): emitted when calculating an angle in degrees between two vectors, receives a calculated value and returns a string of a dimension label text.
Note
The default label text in the absence of options.text
, events.New
and events.onValue
is just a digest of a calculated angle in degrees between two vectors.
Running the Process
To run the process, you should call the command RunProcessCommand
with the AddAngleDimension name of a process.
Example of running the process (TypeScript):
view.runCommand({
name: "RunProcessCommand",
process: {
name: "AddAngleDimension",
options: {},
events: {
onValue: (value: number) => `${value.toFixed(2)}°`
}
}
})
Updating the Process
Updating allows to change any options which are set when process is run.
Common type of the updating command (TypeScript):
type UpdateProcess = {
name: "UpdateProcessCommand"
options: {
name: "AddDimension"
text?: string
underlineText?: boolean
font?: {
family?: string,
size?: number,
}
colors?: {
text?: C3DViewRGB
textBkg?: C3DViewRGB
lines?: C3DViewRGB
}
}
}
Example of a command to update comment font size (TypeScript):
view.runCommand({
name: "UpdateProcessCommand",
options: {
name: "AddDimension",
font: {
size: 20
}
}
})