Shape interface

The shape interface represents a single shape in the document.

Properties

Id

This property returns the unique Identifier of the shape.

Type

  • String

Name

This property returns the name of the shape.

Type

  • String

Methods

Highlight()

This method highlights the shape.

Arguments

  • None.

Returns

  • None.

Example

import {document} from 'lib';

let myShape = document.GetShapeByName("shape1");
myShape.Highlight();

SetContent(content:string)

This method sets the content of the shape.

Arguments

  • string content : The content to set for the shape.

Returns

  • None.

Example

import {document} from 'lib';

let myShape = document.GetShapeByName("shape1");
myShape.SetContent("hello world");

SetData(metadata:string, value:string)

This method sets the value of the property.

Arguments

  • string metadata : The unique identifier of the property. You can find this information in the Manage article types dialog.
  • string value : The value to set for the property.

Returns

  • None.

Remarks

  • This method will update the diagram in real time. For better performance, avoid using this method in loops.

Example

import { document, console } from 'lib';

var sh = document.GetShapeByName("shape55");

// prop.f2dd90f2 is the unique identifier of the property
sh.SetData("prop.f2dd90f2", "195");

SetFillColor(hexColor:string)

This method sets the fill color of the shape.

Arguments

  • string hexColor : The hex color to set for the shape.

Returns

  • None.

Example

import {document} from 'lib';

let myShape = document.GetShapeByName("shape1");
myShape.SetFillColor("#336699");