ILayer

class ILayer

Bases: ImpactCOMWrapperBase

Summary:

Represents a drawing layer.

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

property active_block

Gets active_block.

Summary:

Returns an IActiveBlock object that represents the active block in this layer.

Remarks:

This is a read-only property. If you wish to change the current block, you should use ILayer.set_active_block. This property may be either the root block of the layer itself or a sub-block (one of the blocks found in the Blocks collection). There is always one block in a layer so this property will never be null.

Returns:

The value of active_block.

Return type:

active_block (IActiveBlock)

property active_palette

Gets active_palette.

Summary:

Returns an IPalette object representing the active palette.

Remarks:

This property will never be NULL since there is always a default palette.

Returns:

The value of active_palette.

Return type:

active_palette (IPalette)

property back_edge

Gets back_edge.

Summary:

Gets and sets the ‘back edge’ distance.

Remarks:

If the layer is a ‘ONE_UP’ layer setting this property has no effect and getting this property always returns 0.

Returns:

The value of back_edge.

Return type:

back_edge (float)

property blank_x

Gets blank_x.

Summary:

The horizontal extents of cut entities in this layer.

Remarks:

If the layer is a ‘MULTI_UP’ layer setting this property has no effect and getting this property always returns 0.

Returns:

The value of blank_x.

Return type:

blank_x (float)

property blank_y

Gets blank_y.

Summary:

The vertical extents of cut entities in this layer.

Remarks:

If the layer is a ‘MULTI_UP’ layer setting this property has no effect and getting this property always returns 0.

Returns:

The value of blank_y.

Return type:

blank_y (float)

property blocks

Gets Blocks.

Summary:

Returns an IBlocks collection that represents all the used blocks in this layer.

Remarks:

Currently this property only returns “normal” sub-blocks (IBlock.block_type equal to btSub), not others such as hatch blocks, common knife block, and so on. This behaviour might change in the future.

Returns:

The value of Blocks.

Return type:

blocks (IBlocks)

property copied_layer

Gets copied_layer.

Summary:

Determines if the layer was copied from another.

Remarks:

This property is only available until the project is next saved. introduced in Impact 11.0.0.32

Returns:

The value of copied_layer.

Return type:

copied_layer (bool)

Examples:

property copied_source_layer

Gets copied_source_layer.

Summary:

Returns an ILayer interface for the source layer.

Remarks:

This property is only available until the project is next saved or the source layer is deleted, or source drawing is closed. introduced in Impact 11.0.0.32

Returns:

The value of copied_source_layer.

Return type:

copied_source_layer (ILayer)

Examples:

property database_values

Gets database_values.

Summary:

An IDatabaseValues object used to read and write data to and from the database.

Remarks:

Use database_values to access the database values for an open drawing. By accessing database_values you are not reading/writing directly to/from the database, you are reading/writing values into the working drawing. Values are stored in the working drawing until the item is released back into the database. To access fields from the LAYERS table for a particular layer you must always qualify them using the notation LAYERS.field_name. Note that for scripts that work from within database windows, you should use Impact.gui.active_database_window.values instead. For example, for scripts assigned to DBW buttons to read/write values into the database.

Returns:

The value of database_values.

Return type:

database_values (IDatabaseValues)

Examples:

property description

Gets Description.

Summary:

Gets and sets the description of this layer.

Returns:

The value of Description.

Return type:

description (str)

property drawing

Gets Drawing.

Summary:

Returns an IDrawing object representing the drawing that this layer is in.

Returns:

The value of Drawing.

Return type:

drawing (IDrawing)

property editable

Gets Editable.

Summary:

Indicates if the layer may be modified, or is locked.

Remarks:

Locked layers are indicated with a key icon in the user interface (for example on the layer tabs). Introduced in Impact 10.2.0.1 and 11.0.0.9

Returns:

The value of Editable.

Return type:

editable (bool)

property enquire_area

Gets enquire_area.

Summary:

Returns an IEnquireArea object that can be used to determine the area and perimiter values of the layer.

Remarks:

Introduced in Impact 5.1.3.37.

Returns:

The value of enquire_area.

Return type:

enquire_area (IEnquireArea)

property entities

Gets Entities.

Summary:

Returns an IEntities collection representing all the entities in this layer.

Returns:

The value of Entities.

Return type:

entities (IEntities)

property first_way

Gets first_way.

Summary:

The extents of cut entities along the corrugated flute direction.

Returns:

The value of first_way.

Return type:

first_way (float)

property flute_direction

Gets flute_direction.

Summary:

Gets and sets the direction of the corrugated fluting.

Returns:

The value of flute_direction.

Return type:

flute_direction (ipFluteDirection)

property from_master

Gets from_master.

Summary:

Determines if the layer is linked to a master layer

Remarks:

introduced in Impact 11.0.0.32

Returns:

The value of from_master.

Return type:

from_master (bool)

Examples:

property full_name

Gets full_name.

Summary:

Gets and sets the name of the layer.

Returns:

The value of full_name.

Return type:

full_name (str)

property grip_edge

Gets grip_edge.

Summary:

Gets and sets the ‘grip edge’ distance.

Remarks:

If the layer is a ‘ONE_UP’ layer setting this property has no effect and getting this property always returns 0.

Returns:

The value of grip_edge.

Return type:

grip_edge (float)

property guid

Gets GUID.

Summary:

The GUID of the layer.

Returns:

The value of GUID.

Return type:

guid (str)

property layer_type

Gets layer_type.

Summary:

Indicates the type of layer.

Returns:

The value of layer_type.

Return type:

layer_type (str)

Examples:

property locked

Gets Locked.

Summary:

This property is no longer supported.

Remarks:

This property is deprecated. Please use ILayer.editable instead.

Returns:

The value of Locked.

Return type:

locked (bool)

property machine_direction

Gets machine_direction.

Summary:

Gets and sets the machine direction.

Returns:

The value of machine_direction.

Return type:

machine_direction (ipMachineDirection)

property master_layer

Gets master_layer.

Summary:

Returns an IDatabaseLayer object for the linked master layer

Remarks:

introduced in Impact 11.0.0.32

Returns:

The value of master_layer.

Return type:

master_layer (IDatabaseLayer)

Examples:

property material_name

Gets material_name.

Summary:

Gets and sets the material name.

Remarks:

Setting a layers material will load all the associated material variables. To clear a material assign an empty string to the material_name property. To clear all associated material variables you should also call clear_material_variables().

Returns:

The value of material_name.

Return type:

material_name (str)

property off_lay

Gets off_lay.

Summary:

Gets and sets the ‘off lay’ distance.

Remarks:

If the layer is a ‘ONE_UP’ layer setting this property has no effect and getting this property always returns 0.

Returns:

The value of off_lay.

Return type:

off_lay (float)

property one_up_area

Gets one_up_area.

Summary:

The internal area of the perimeter of cut entities in this layer.

Remarks:

This method will return zero if the layer is not a one-up. You can also use the IEnquireArea object to gain more information about areas in a layer. For a one-up layer, this one_up_area method returns the same value as IEnquireArea.result_area.

Returns:

The value of one_up_area.

Return type:

one_up_area (float)

Examples:

property preferred_face

Gets preferred_face.

Summary:

Gets or sets the Preferred Face of the layer. If a preferred face is specified, the project’s visible face will automatically change when the layer is made current.

Remarks:

Introduced in Impact 13.0.0.58

Returns:

The value of preferred_face.

Return type:

preferred_face (ipFaceOrientation)

property root_block

Gets root_block.

Summary:

Returns an IBlock representing the default block that always exists in a layer.

Returns:

The value of root_block.

Return type:

root_block (IBlock)

property saved

Gets Saved.

Summary:

Indicates if the layer requires saving.

Returns:

The value of Saved.

Return type:

saved (bool)

property scene

Gets Scene.

Summary:

Gets the scene object for a 3D layer.

Remarks:

Returns null (Nothing) if the layer is not 3D (in other words, if the layer type is not “THREE_D”).

Returns:

The value of Scene.

Return type:

scene (i3_d_scene)

property second_way

Gets second_way.

Summary:

The extents of cut entities against the corrugated flute direction.

Returns:

The value of second_way.

Return type:

second_way (float)

property side_lay

Gets side_lay.

Summary:

Gets and sets the ‘side lay’ distance.

Remarks:

If the layer is a ‘ONE_UP’ layer setting this property has no effect and getting this property always returns 0.

Returns:

The value of side_lay.

Return type:

side_lay (float)

property standard_board_type

Gets standard_board_type.

Summary:

Gets the material name for the layer, if created from a standard.

Remarks:

Introduced in Impact 12.0.0.157

Returns:

The value of standard_board_type.

Return type:

standard_board_type (str)

property standard_construction

Gets standard_construction.

Summary:

Gets the construction description for the design, if created from a standard.

Remarks:

Introduced in Impact 12.0.0.157

Returns:

The value of standard_construction.

Return type:

standard_construction (str)

property standard_is_parametric

Gets standard_is_parametric.

Summary:

Gets whether the layer was created from a parametric standard.

Remarks:

Introduced in Impact 12.0.0.157

Returns:

The value of standard_is_parametric.

Return type:

standard_is_parametric (bool)

property standard_name

Gets standard_name.

Summary:

Gets the standard name for the design, if created from a standard.

Remarks:

Introduced in Impact 12.0.0.157

Returns:

The value of standard_name.

Return type:

standard_name (str)

property stock_height

Gets stock_height.

Summary:

Gets and sets the sheet height.

Remarks:

stock_height and stock_width refer to the sizes displayed on the Sheet page of the layer properties for a MULTI_UP layer. If the layer is a ONE_UP, setting this property has no effect and getting this property always returns zero.

Returns:

The value of stock_height.

Return type:

stock_height (float)

property stock_sheet

Gets stock_sheet.

Summary:

Gets and sets the stock sheet for the layer.

Remarks:

This property is only applicable to MULTI_UP layers.

Returns:

The value of stock_sheet.

Return type:

stock_sheet (IMasterSetting)

Examples:

property stock_width

Gets stock_width.

Summary:

Gets and sets the sheet width.

Remarks:

stock_height and stock_width refer to the sizes displayed on the Sheet page of the layer properties for a MULTI_UP layer. If the layer is a ONE_UP, setting this property has no effect and getting this property always returns zero.

Returns:

The value of stock_width.

Return type:

stock_width (float)

Examples:

property used_palettes

Gets used_palettes.

Summary:

Returns an IPalettes collection representing all the used palettes in the layer.

Returns:

The value of used_palettes.

Return type:

used_palettes (IPalettes)

property variable_expressions_comma_decimal_separator

Gets variable_expressions_comma_decimal_separator.

Summary:

Gets and sets whether a comma is used as the decimal separator

Remarks:

Introduced in Impact 13.0.0.56

Returns:

The value of variable_expressions_comma_decimal_separator.

Return type:

variable_expressions_comma_decimal_separator (bool)

property variable_expressions_metric

Gets variable_expressions_metric.

Summary:

Gets and sets whether expressions are using metric units

Remarks:

Introduced in Impact 13.0.0.56

Returns:

The value of variable_expressions_metric.

Return type:

variable_expressions_metric (bool)

property variable_groups

Gets variable_groups.

Summary:

Returns an IVariableGroups collection representing all the variable groups in the layer.

Returns:

The value of variable_groups.

Return type:

variable_groups (IVariableGroups)

property variables

Gets Variables.

Summary:

Returns an IVariables collection representing all the variables in the layer.

Returns:

The value of Variables.

Return type:

variables (IVariables)

property visible

Gets Visible.

Summary:

Determines if the ILayer is visible in the currently active canvas.

Remarks:

Introduced in Impact 5.1.3.50.

Returns:

The value of Visible.

Return type:

visible (bool)

Examples:

box_contains_entities(box, only_visible)
Summary:

Determines if any entities are enclosed by a specified box.

Parameters:
  • box (IRect) – The box to test.

  • only_visible (bool) – If “only_visible” is TRUE then only visible entities will be considered.

Examples:

convert_block_insert_to_layer(block_insert)
Summary:

Creates a new layer from a block insertion entity.

Remarks:

The block is converted to a layer (with type ONE_UP). Every block insertion entity which referenced the block will then become a layer insertion entity. Introduced in Impact 8.0.0.55

Parameters:

block_insert (IBlockInsert) – An insertion of the block to be converted.

Examples:

convert_layer_insert_to_block(layer_insert)
Summary:

Creates a new block from a layer insertion entity.

Remarks:

The layer is copied and converted to a block. Every layer insertion entity which referenced the layer will then become a block insertion entity. The original layer remains in the drawing. Introduced in Impact 8.0.0.55

Parameters:

layer_insert (ILayerInsert) – An insertion of the layer to be converted.

Examples:

copy_to_drawing(destination_drawing, new_name)
Summary:

Copies the layer to a drawing.

Remarks:

The new_name method parameter can be empty string, if this is the case then the name of the new layer will be generated based upon the name of the layer that is being copied. If a layer already exists in the destination drawing with the specified new_name paramter the actual name of the new layer will be based upon this parameter.

Parameters:
  • destination_drawing (IDrawing) – Specifies the drawing to copy to.

  • new_name (str) – Specifies the name of the new layer.

Examples:

display_select_material()
Summary:

Display the Select Material dialog for this ILayer.

Remarks:

Use this method to display the Select Material dialog to the user so they can select material for the layer. This method is not supported when using the IServer.

Examples:

export(file_name, settings, file_format)
Summary:

Exports the layer to a file.

Remarks:

This method can be used to export both 2D and 3D layers. If exporting a 2D layer and the file format is not ffImpact then settings with type mstImportExport must be provided. If exporting a 3D layer then settings with type mst3DImportExport must be provided. Since a specific layer is being exported, the option ‘export all layers’, defined in the specified master tool settings, may lead to unexpected results.

Parameters:
  • file_name (str) – The full path of the file to create.

  • settings (IMasterSetting) – The settings to use when exporting the layer.

  • file_format (ipFileFormat) – The file format of the new file.

Examples:

export_to_stream(settings, file_format)
Summary:

Exports the layer to a stream.

Remarks:

This method can be used to export both 2D and 3D layers. If exporting a 2D layer and the file format is not ffImpact then settings with type mstImportExport must be provided. If exporting a 3D layer then settings with type mst3DImportExport must be provided. Since a specific layer is being exported, the option ‘export all layers’, defined in the specified master tool settings, may lead to unexpected results. Note that VBScript does not support streaming.

Returns:

This method returns an IUnknown interface but the interface also supports the IStream interface.

Parameters:
  • settings (IMasterSetting) – The settings to use when exporting the layer.

  • file_format (ipFileFormat) – The file format of the stream.

get_fitted_extents()
Summary:

Enquire on the fitted extents of this layer.

Remarks:

Returns an IRect object representing the knife to knife extents of the current layer taking into consideration the sidelay, offlay, gripedge and backedge values for this layer. If the layer is a ‘ONE_UP’ layer the sidelay, offlay, gridedge and backedge values are not considered and calling this method is equivalent to calling the get_knife_to_knife_extents method. The method only takes account of cut palettes; it recurses into sub-blocks and symbols. See also IEnquireLengths, which calculates the extents of the specified entities and allows you to configure which entity types and palette types to use in the calculation.

Examples:

get_insertions()
Summary:

Gets an array of the layers in the drawing that contain an insert of this layer.

Remarks:

Remember arrays are zero based and collections are one based.

get_knife_to_knife_extents()
Summary:

Enquire on the knife to knife extents of this layer.

Remarks:

Returns an IRect object representing the knife to knife extents of the current layer without taking into consideration the sidelay, offlay, gripedge and backedge values for this layer. The method only takes account of cut palettes; it recurses into sub-blocks and symbols. Please note that this method always returns the results in world coordinates. See also IEnquireLengths, which calculates the extents of the specified entities and allows you to configure which entity types and palette types to use in the calculation.

Examples:

isNone()

Checks if the COM object is None. This is useful for determining if the wrapper has been initialized with a valid COM object.

layout(options, results)
Summary:

Creates a layout of this layer.

Remarks:

This layer must be a “one up” layer in order to create a layout. IML variables defining “one up” settings will be ignored when calling this method in an nServer context.

Parameters:
  • options (ILayoutOptions) – Specifies the options to use to create the layout.

  • results (ILayoutResults) – The results of creating the layout are returned in this method parameter.

Examples:

layout_report(results)
Summary:

Retreives the layout results for a generated layout.

Parameters:

results (ILayoutResults) – The layout results.

Examples:

make_common_knife_block(options)
Summary:

Removes all ‘common knives’ and places them in a special common knife block.

Remarks:

If a common knife block already exists in the layer no operations are performed and the existing common knife block is returned.

Returns:

An IBlock object representing the created common knife block. The ‘block_type’ property of this block will be btCommonKnife.

Parameters:

options (ICommonKnifeOptions) – Specifies the required options when removing the common knives.

Examples:

purge_blocks()
Summary:

Purges all unused blocks in this layer.

recalculate_text_entities()
Summary:

Updates all Dynamic Text in the layer.

Remarks:

There are several types of dynamic text entities that display values from other parts of Impact. These include database text, system text, variable text, COM text and IML (Impact Macro Language) text. The text displayed by these entities can change depending on the underlying values. To update these text entities you should call the recalculate_text_entities method. This method a single layer within the drawing, to update all text entities within the drawing see IDrawing.recalculate_text_entities. IServer does not support the updating of IML text entities.

Examples:

remove_common_knife_block()
Summary:

Removes a common knife block from the layer if one exists.

Examples:

report_text(value)
Summary:

Generate calculated text values from values such as variables, database fields and system functions.

Remarks:

This method works in an identical way to text entities which contain System, Database, Macro and Variable items. However, do not include the square backets; for example use “Date”, not “[Date]”.

Parameters:

value (str) – The string containing the variable, database field or system function.

Examples:

save_layer_as_image(image_params)
Summary:

Saves the drawing as an image (for example to be displayed as a preview/thumbnail).

Remarks:

introduced in Impact 11.1.0.15 and 12.0.0.80

Parameters:

image_params (ISaveImageParams) – The parameters to be used, such as file location and image format.

Examples:

save_layer_as_image_stream(image_params)
Summary:

Saves the layer as an image to a stream.

Remarks:

Note that VBScript does not support streaming. Introduced in Impact 11.1.0.15 and 12.0.0.80

Returns:

This method returns an IUnknown interface but the interface also supports the IStream interface.

Parameters:

image_params (ISaveImageParams) – The parameters to be used, such as file location and image format.

Examples:

set_active_block(mode)
Summary:

Allows block navigation to either the parent block or the layer block.

Parameters:

mode (ipActiveBlock) – The mode to use when setting the active block.

Examples:

standard_clear_information()
Summary:

Breaks the link between this layer and the standard that was used to create it.

Remarks:

Introduced in Impact 12.0.0.157

Examples:

Examples