Adding Comment Process
The process is interactive one which allows to add a new 3D comment to a model by selecting two points (a target for leader arrow and an origin of leader line).
Common type of the process (TypeScript):
export type AddCommentProcess = {
name: "AddComment"
options: {
text: string
underlineText?: boolean
font?: {
family?: string
size?: number
}
colors?: {
text?: C3DViewRGB
textBkg?: C3DViewRGB
}
}
events:{
onNew?: () => string
onCreate?: (uuid:string) => C3DUserData
}
}
Options
Name |
Description |
---|---|
|
The default label text of a new comment. The default is |
|
The flag for an 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 |
Callbacks
Available events:
onNew(): emitted before creating a new comment. Returns a string which is used as a comment label text instead of the default one.
onCreate(uuid): emitted after creating a new comment. It receives a UUID of a new object and allows to set custom comment properties by returning them as an object.
Running the Process
To run the process, you should call the command RunProcessCommand
with the AddComment name of a process:
Example of starting the process (TypeScript):
view.runCommand({
name: "RunProcessCommand",
process: {
name: "AddComment",
options: {
text: "Comment"
},
events: {}
}
})
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: "AddComment"
text: string
underlineText?: boolean
font?: {
family?: string
size?: number
}
colors?: {
text?: C3DViewRGB
textBkg?: C3DViewRGB
}
}
}
Example of a command to update comment font size (TypeScript):
view.runCommand({
name: "UpdateProcessCommand",
options: {
name: "AddComment",
text: 'Comment',
font: {
size: 21
}
}
})