Frame properties

flipObject

flipObject(H,V,["name"])

Toggle the object "name" horizontal and/or vertical flip. If "name" is not given the currently selected item is used.

getCornerRadius

getCornerRadius(["name"]) -> integer

Returns the corner radius of the object "name". The radius is expressed in points. If "name" is not given the currently selected item is used.

getFillBlendmode

getFillBlendmode(["name"]) -> integer

Returns the fill blendmode of the object "name". If "name" is not given the currently selected Item is used.

getFillColor

getFillColor(["name"]) -> string

Returns the name of the fill color of the object "name". If "name" is not given the currently selected item is used.

getFillShade

getFillShade(["name"]) -> integer

Returns the shading value of the fill color of the object "name". If "name" is not given the currently selected item is used.

getFillTransparency

getFillTransparency(["name"]) -> float

Returns the fill transparency of the object "name". If "name" is not given the currently selected Item is used.

getLineBlendmode

getLineBlendmode(["name"]) -> integer

Returns the line blendmode of the object "name". If "name" is not given the currently selected Item is used.

getLineCap

getLineCap(["name"]) -> integer (see constants)

Returns the line cap style of the object "name". If "name" is not given the currently selected item is used. The cap types are: CAP_FLAT, CAP_ROUND, CAP_SQUARE

getLineColor

getLineColor(["name"]) -> string

Returns the name of the line color of the object "name". If "name" is not given the currently selected item is used.

getLineJoin

getLineJoin(["name"]) -> integer (see constants)

Returns the line join style of the object "name". If "name" is not given the currently selected item is used. The join types are: JOIN_BEVEL, JOIN_MITTER, JOIN_ROUND

getLineShade

getLineShade(["name"]) -> integer

Returns the shading value of the line color of the object "name". If "name" is not given the currently selected item is used.

getLineTransparency

getLineTransparency(["name"]) -> float

Returns the line transparency of the object "name". If "name" is not given the currently selected Item is used.

getLineWidth

getLineWidth(["name"]) -> integer

Returns the line width of the object "name". If "name" is not given the currently selected Item is used.

getObjectAttributes

getObjectAttributes(["name"]) -> list

Returns a list containing all attributes of object "name".

getObjectType

getObjectType(["name"]) -> string

Get type of object "name" as a string.

getPosition

getPosition(["name"]) -> (x,y)

Returns a (x, y) tuple with the position of the object "name". If "name" is not given the currently selected item is used. The position is expressed in the actual measurement unit of the document - see UNIT_ for reference.

getRotation

getRotation(["name"]) -> integer

Returns the rotation of the object "name". The value is expressed in degrees, and clockwise is positive. If "name" is not given the currently selected item is used.

getSize

getSize(["name"]) -> (width,height)

Returns a (width, height) tuple with the size of the object "name". If "name" is not given the currently selected item is used. The size is expressed in the current measurement unit of the document - see UNIT_ for reference.

getTextFlowMode

getTextFlowMode(["name"]) -> integer

Return the current text flow mode used by item "name" as an integer. If "name" is not given, the currently selected object is used.

The function will return one of the following value: - 0 : text flow around frame is disabled - 1 : text flow around frame shape - 2 : text flow around frame bounding box - 3 : text flow around frame contour line - 4 : text flow around image clip path

isLocked

isLocked(["name"]) -> bool

Returns true if is the object "name" locked. If "name" is not given the currently selected item is used.

lockObject

lockObject(["name"]) -> bool

Locks the object "name" if it's unlocked or unlock it if it's locked. If "name" is not given the currently selected item is used. Returns true if locked.

moveObject

moveObject(dx, dy [, "name"])

Moves the object "name" by dx and dy relative to its current position. The distances are expressed in the current measurement unit of the document (see UNIT constants). If "name" is not given the currently selected item is used. If the object "name" belongs to a group, the whole group is moved.

moveObjectAbs

moveObjectAbs(x, y [, "name"])

Moves the object "name" to a new location. The coordinates are expressed in the current measurement unit of the document (see UNIT constants). If "name" is not given the currently selected item is used. If the object "name" belongs to a group, the whole group is moved.

rotateObject

rotateObject(rot [, "name"])

Rotates the object "name" by "rot" degrees relatively. The object is rotated by the vertex that is currently selected as the rotation point - by default, the top left vertex at zero rotation. Positive values mean counter clockwise rotation when the default rotation point is used. If "name" is not given the currently selected item is used.

rotateObjectAbs

rotateObjectAbs(rot [, "name"])

Sets the rotation of the object "name" to "rot". Positive values mean counter clockwise rotation. If "name" is not given the currently selected item is used.

setCornerRadius

setCornerRadius(radius, ["name"])

Sets the corner radius of the object "name". The radius is expressed in points. If "name" is not given the currently selected item is used.

May raise ValueError if the corner radius is negative.

setFillBlendmode

setFillBlendmode(blendmode, ["name"])

Sets the fill blendmode of the object "name" to blendmode If "name" is not given the currently selected item is used.

setFillColor

setFillColor("color", ["name"])

Sets the fill color of the object "name" to the color "color". "color" is the name of one of the defined colors. If "name" is not given the currently selected item is used.

setFillShade

setFillShade(shade, ["name"])

Sets the shading of the fill color of the object "name" to "shade". "shade" must be an integer value in the range from 0 (lightest) to 100 (full Color intensity). If "name" is not given the currently selected Item is used.

May raise ValueError if the fill shade is out of bounds.

setFillTransparency

setFillTransparency(transparency, ["name"])

Sets the fill transparency of the object "name" to transparency If "name" is not given the currently selected item is used.

setGradientFill

setGradientFill(type, "color1", shade1, "color2", shade2, ["name"])

Sets the gradient fill of the object "name" to type. Color descriptions are the same as for setFillColor() and setFillShade(). See the constants for available types (FILL_).

setGradientStop

setGradientStop("color", shade, opacity, ramppoint, ["name"])

Set or add a gradient stop to the gradient fill of the object "name" at position ramppoint. Color descriptions are the same as for setFillColor() and setFillShade(). setGradientFill() must have been called previously for the gradient fill to be visible.

setitemname

setitemname(newName, ["name"])

Sets the name of object "name" to newName and returns the name applied. If "name" is not given the currently selected item is used.

May raise NotFoundError if the object doesn't exist.

setLineBlendmode

setLineBlendmode(blendmode, ["name"])

Sets the line blendmode of the object "name" to blendmode If "name" is not given the currently selected item is used.

setLineCap

setLineCap(endtype, ["name"])

Sets the line cap style of the object "name" to the style "cap". If "name" is not given the currently selected item is used. There are predefined constants for "cap" - CAP_.

setLineColor

setLineColor("color", ["name"])

Sets the line color of the object "name" to the color "color". If "name" is not given the currently selected item is used.

setLineJoin

setLineJoin(join, ["name"])

Sets the line join style of the object "name" to the style "join". If "name" is not given the currently selected item is used. There are predefined constants for join - JOIN_.

setLineShade

setLineShade(shade, ["name"])

Sets the shading of the line color of the object "name" to "shade". "shade" must be an integer value in the range from 0 (lightest) to 100 (full color intensity). If "name" is not given the currently selected item is used.

May raise ValueError if the line shade is out of bounds.

setLineTransparency

setLineTransparency(transparency, ["name"])

Sets the line transparency of the object "name" to transparency If "name" is not given the currently selected item is used.

setLineWidth

setLineWidth(width, ["name"])

Sets line width of the object "name" to "width". "width" must be in the range from 0.0 to 12.0 inclusive, and is measured in points. If "name" is not given the currently selected item is used.

May raise ValueError if the line width is out of bounds.

setMultiLine

setMultiLine("namedStyle", ["name"])

Sets the line style of the object "name" to the named style "namedStyle". If "name" is not given the currently selected item is used.

May raise NotFoundError if the line style doesn't exist.

setObjectAttributes

setObjectAttributes(attributes, ["name"])

Sets attributes of the object "name". If "name" is not given the currently selected item is used.

attributes is a list of dictionary. Each dictionary must have those keys: Name, Type, Value, Parameter, Relationship, RelationshipTo, AutoAddTo All values must be strings.

May raise NotFoundError if the object doesn't exist.

setTextFlowMode

setTextFlowMode("name" [, state])

Enables/disables "Text Flows Around Frame" feature for object "name". Called with parameters string name and optional int "state" (0 <= state <= 3). Setting "state" to 0 will disable text flow. Setting "state" to 1 will make text flow around object frame. Setting "state" to 2 will make text flow around bounding box. Setting "state" to 3 will make text flow around contour line. If "state" is not passed, text flow is toggled.

sizeObject

sizeObject(width, height [, "name"])

Resizes the object "name" to the given width and height. If "name" is not given the currently selected item is used.

textFlowMode

textFlowMode("name" [, state])

Deprecated. Use setTextFlowMode() instead.

Constants

Lines and stroke properties

  • LINE_DASH
  • LINE_DASHDOT
  • LINE_DASHDOTDOT
  • LINE_DOT
  • LINE_SOLID

Lines and stroke properties

  • JOIN_BEVEL
  • JOIN_MITTER
  • JOIN_ROUND

Lines and stroke properties

  • CAP_FLAT
  • CAP_ROUND
  • CAP_SQUARE

Fill modes

  • FILL_CROSSDIAGONALG
  • FILL_DIAGONALG
  • FILL_HORIZONTALG
  • FILL_NOG
  • FILL_RADIALG
  • FILL_VERTICALG