Comment
Below we will consider the PMI object containing leader arrow and line with a text on it.
Object
Common type of the comment object (TypeScript):
export type C3DViewComment = {
type: C3DViewObjectTypes.Comment // "Comment"
uuid?: string
targetUuid?: string
points: {
target: C3DViewPoint
shelf: C3DViewPoint
}
options: C3DViewCommentOptions
userData: C3DUserData
}
The properties type, uuid, and userData are described here. Additionally for this PMI object:
type can be
C3DViewObjectTypes.Comment
or a string"Comment"
;userData object is created in the process when returned in the
onCreate
event callback.
targetUuid is an unique identifier of a target object.
points is a group of points to build an object:
target is a target point on geometry;
shelf is a point of leader line position.
options is additional options.
Additional options
The same as for creating process.
Type of comment options (TypeScript):
export type C3DViewCommentOptions = {
group?: number
text:string,
font?:{
family?:string,
size?:number,
}
colors?:{
text?:C3DViewRGB
textBkg?:C3DViewRGB
}
tipType?: C3DTipType
textFrame?: C3DFrame[]
textOrigin?: {
vertical?: C3DVerticalPosition
horizontal?: C3DHorizontalPosition
}
}
group field defines to which group a comment belongs.
text is a text value of object.
font is a group of values to set up a text font:
family is a font family;
size is a
{r, g, b}
value of text color (the default isblack
).
colors is a group of values to set up colors of a graphics object:
text is a
{r, g, b}
value of text color (the default isblack
);textBkg is a
{r, g, b}
value of text background color (if undefined, background istransparent
);lines is a
{r, g, b}
value of line color (the default isblack
).
tipType is a leader tip type. Available values (the default is
'Arrow'
).textFrame is a list of available frames for a comment text (the default is
["All"]
).textOrigin is a group of values to change an anchor point of leader line to text:
vertical is a vertical alignment. Available values (the default is
"Auto"
);horizontal is a horizontal alignment. Available values (the default is
"Auto"
).
New in version 1.7.0: Removed the option underlineText
.
Added the tipType
, textFrame
and textOrigin
options.
Text frame
export enum C3DFrame {
Bottom = 'Bottom',
Right = 'Right',
Top = 'Top',
Left = 'Left',
All = 'All',
}
Text origin
export enum C3DHorizontalPosition {
Left = 'Left',
Right = 'Right',
Center = 'Center',
Auto = 'Auto',
}
export enum C3DVerticalPosition {
Center = 'Center',
Above = 'Above',
Below = 'Below',
Auto = 'Auto',
}
Tip type
export enum C3DTipType {
None = 'None',
Arrow = 'Arrow',
Circle = 'Circle',
Hatch = 'Hatch'
}