IPalettes

class IPalettes

Bases: ImpactCOMWrapperBase, Iterable

Description:

A collection of IPalette objects.

Wraps a COM object or another wrapper instance. Accepts: - A valid impact_object - An existing impact_com_wrapper_base-derived instance

property count

Gets Count.

Description:

The number of items in this collection.

Returns:

The value of Count.

Return type:

count (int)

add(name, palette)
Description:

Adds a palette to the collection of palettes (and ultimately the drawing the collection belongs to).

Remarks:

If the specified palette is not from the drawing that this collection belongs to an error will occur.

Parameters:
  • name (str) – The name for the new palette.

  • palette (IPalette) – An existing palette upon which to base the new one.

add_database(name)
Description:

Adds the named palette into the drawing, from the palettes database table.

Remarks:

To use this method, you must have a PALETTE databsase table, containing palette definitions. This method may only be called from an IDrawing.palettes object, not any other palettes collection such as ILayer.used_palettes. Introduced in Impact 11.0.0.81

Returns:

Returns the palette, if any only if it has been added to the drawing (but not if it already existed).

Parameters:

name (str) – The exact palette name

Examples:

add_database_defaults()
Description:

Adds all of the default palettes into the drawing, from the palettes database table.

Returns:

Returns an array of IPalette objects representing the matching palettes (even paletttes that already existed in the drawing).

Examples:

add_database_group(group)
Description:

Adds the palettes from the named group into the drawing, from the palettes database table.

Returns:

Returns an array of IPalette objects representing the matching palettes (even paletttes that already existed in the drawing).

Parameters:

group (str) – The name of the palettes group.

Examples:

add_database_matching(expression)
Description:

Adds the palettes with names that match the expression into the drawing, from the palettes database table.

Returns:

Returns an array of IPalette objects representing the matching palettes (even paletttes that already existed in the drawing).

Parameters:

expression (str) – A regular expression for the palette names.

Examples:

delete(palette_to_delete, palette_to_become)
Description:

Deletes a palette from the collection (and the drawing the collection ultimately belongs to).

Parameters:
  • palette_to_delete (IPalette) – Specifies the palette to delete.

  • palette_to_become (IPalette) – Specifies the palette that any entities should use if they are using the palette that should be deleted.

find_palettes(reg_exp)
Description:

Finds palettes whose name matches the given expression, from this collection of palettes.

Remarks:

Note that the matching is case-sensitive - to match palette names containing either “Score” or “score”, you could use “[Ss]core”. Remember arrays are zero based and collections are one based.

Returns:

Returns an array of IPalette objects, or returns null (Empty in VBS) if there were no matching palettes.

Parameters:

reg_exp (str) – The regular expression to use to match the palette names. For example “^Perf” will match any names starting with Perf, while “2pt$” will match any names ending with 2pt.

Examples:

find_palettes_by_type(palette_types)
Description:

Finds palettes in this collection with the specified types.

Remarks:

Remember arrays are zero based and collections are one based.

Parameters:

palette_types (any) – Specifies the types of palettes to find.

Examples:

item(variant)
Description:

Gets an IPalette object with the specified name or index.

Parameters:

variant (any) – Specifies the name or index of the object to retrieve.