Adding Comment Process
The process is an interactive one which allows adding 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
font?: {
family?: string
size?: number
}
colors?: {
text?: C3DViewRGB
textBkg?: C3DViewRGB
}
textFrame?: C3DFrame[]
textOrigin?: {
vertical?: C3DVerticalPosition
horizontal?: C3DHorizontalPosition
}
}
events:{
onNew?: () => string
onCreate?: (uuid:string) => C3DUserData
}
}
Options
Name |
Description |
---|---|
|
The default label text of a new comment. 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 |
|
A list of available frames for comment text. The default is |
|
The vertical align of the anchor point. Available values. The default is |
|
The horizontal align of the anchor point. Available values. The default is |
New in version 1.7.0: Removed the option underlineText. Added the textFrame, textOrigin.vertical and textOrigin.horizontal options.
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
}
}
})