ScriptImagePoolObject

class ScriptImagePoolObject.ImageLinkType(value)

Bases: Enum

This enumeration represents the way an image is embedded or linked into a project.

Version added:

3.5.9.0

Linked = 1

This value means that the image is linked from the project only.

EmbeddedAndLinked = 2

This value means that the image is embedded within the project while still linked to the according file in the filesystem and thus allowing automatic updates if changed on disk.

Embedded = 3

This value means that the image is embedded within the project.

class ScriptImagePoolObject.ScriptImagePoolMarker

Bases: object

Marker object to check whether an ScriptObject is an imagepool object.

Version added:

3.5.9.0

property is_imagepool

Gets a value indicating whether this ScriptApplicationMarker is an imagepool.

Return type:

bool

Returns:

True if it is an imagepool; otherwise, False

class ScriptImagePoolObject.ScriptImagePoolObject

Bases: ScriptImagePoolMarker

ScriptObjects which are an imagepool object are extended with this interface.

Version added:

3.5.9.0

property images

Gets the collection of the items currently configured within this imagepool.

Return type:

ScriptImagePoolItems

property download_only_used_images

Gets or sets a value whether all images or only the explicitly referenced ones should be downloaded to PLCs.

Return type:

bool

property imagepool_is_internal

Gets or sets a value whether this image pool is visible for projects embedding the current one as a library.

This is not relevant when working on a project itself.

Return type:

bool

property symboltextlist

Gets and sets the name of the text list for translation of the symbols in this image pool.

Return type:

str

class ScriptImagePoolObject.ScriptImagePoolItems(iterable=(), /)

Bases: list

Gets the current number of items in this image pool.

Version added:

3.5.9.0

add(id, path, linktype, updateMode=None)

Adds a new image to the current image pool.

Parameters:
  • id (str) – The id to assign to the newly inserted image. Must not yet be existing.

  • path (str) – The file path to reference by the new image item.

  • linktype (ImageLinkType) – The way the new image item references the according file.

  • updateMode (AutoUpdateMode) – The way the image item is updated automatically, relevant only if linktype is ImageLinkType.EmbeddedAndLinked

Raises:

ArgumentException – Thrown when an item with the according id already existings.

Return type:

ScriptImagePoolItem

Returns:

The newly created ScriptImagePoolItem.

remove(id)

Removes the ScriptImagePoolItem with the given id.

Parameters:

id (str) – description

Raises:

KeyNotFoundException – Thrown when no entry with the given id exists.

move(indexSrc, indexDst)

Moves a ScriptImagePoolItem in the list of items.

Parameters:
  • indexSrc (int) – The index of the item that should be moved.

  • indexDst (int) – The index where the item should be located afterwards.

Raises:

ArgumentOutOfRangeException – Thrown when the given indices are out of range.

class ScriptImagePoolObject.ScriptImagePoolItem

Bases: object

An item (in fact like a line) within a ScriptImagePoolObject.

Version added:

3.5.9.0

property id

The identification of the image that can be accessed in the visualization too.

Raises:

ArgumentException – Thrown when the id is being set and the new id is already contained in the imagepool.

Return type:

str

property filepath

The path of the referenced image.

Relevant only if linktype yields ImageLinkType.Linked or ImageLinkType.EmbeddedAndLinked.

Return type:

str

property linktype

The way the image is referenced.

Return type:

ImageLinkType

property updatemode

The way the image is updated automatically while the project is open.

Relevant only if linktype yields ImageLinkType.EmbeddedAndLinked.

Return type:

AutoUpdateMode

class ScriptImagePoolObject.ScriptImagePoolObjectContainer

Bases: object

Projects and Application Objects are extended with this interface since CoDeSys V3.5.9.0.

Version added:

3.5.9.0

create_imagepool(name=None)

Creates a new image pool object in the current context (either application or project global).

Parameters:

name (str) – The name of the new imagepool object. In case of None, a default name will be generated.

Raises:

ArgumentException – Thrown when an image pool with the given name already exists within the current context.

Return type:

ScriptImagePoolObject

Returns:

The newly created imagepool object.

get_global_imagepool()

Returns the global image pool object or creates a new one if not yet existing.

Typically this method can be called on projects only. Only in case of special customizations of the programming system, it is allowed to call this on an application too.

Raises:

InvalidOperationException – Thrown when called on applications when this is not allowed.

Return type:

ScriptImagePoolObject

Returns:

The global imagepool.

property has_global_imagepool

Checks whether there is already a globalimagepool in the current location.

Only in case of special customizations of the programming system, it is allowed to call this on an application too.

Raises:

InvalidOperationException – Thrown when called on applications when this is not allowed.

Return type:

bool