Adding Radial Dimension Process
The process is an interactive one which allows adding a new 3D radial dimension to a model by selecting three points.
Common type of the process (TypeScript):
export type AddRadialDimensionProcess = {
name: "AddRadialDimension"
surfaceInterpretation?: boolean
snap?: SnapOptions
options: C3DViewDimensionOptions
events: {
onNew?: () => string
onCreate?: (uuid: string) => C3DUserData
onValue?: (value: number) => string
}
}
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.
Surface mode
The mode is available if the surfaceInterpretation
property is set to true
.
The dimensions are constructed by 3 points specified by a user. Every point
detects a geometry placement surface on which a point is placed and a circle. If points
aren’t at one line, then a new radial dimension is added, otherwise the adding is canceled.
Options
The process uses the same options as the corresponding PMI object does. They are described here.
Callbacks
Available events.
onNew() is emitted before creating a new dimension. Returns a string which is used as a dimension label text instead of the default value.
onCreate(uuid) is 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) is emitted when calculating a circle radius, 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 digit of a calculated circle radius between the first point and a circle center.
Running
To run the process, you should call the command RunProcessCommand
with the AddRadialDimension name of a process.
Example of running the process (TypeScript):
view.runCommand({
name: "RunProcessCommand",
process: {
name: "AddRadialDimension",
options: {},
events: {
onValue: (value: number) => `${value.toFixed(2)} m`
}
}
})
Updating
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: "AddRadialDimension"
text?: string
underlineText?: boolean
font?: {
family?: string,
size?: number,
}
colors?: {
text?: C3DViewRGB
textBkg?: C3DViewRGB
lines?: C3DViewRGB
}
}
}
Example of the command to update comment font size (TypeScript):
view.runCommand({
name: "UpdateProcessCommand",
options: {
name: "AddRadialDimension",
font: {
size: 20
}
}
})