IEntity

class IEntity

Bases: ImpactCOMWrapperBase

Description:

Represents a generic entity.

Remarks:

Query the entity_type property in order to determine which kind of entity this object represents. Depending on the entity type, you can then access additional properties (if it is etLine then use the ILine properties, if etArc then IArc properties, and so on).

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

property block

Gets Block.

Description:

Returns an IBlock object representing the block that this entity is in.

Returns:

The value of Block.

Return type:

block (IBlock)

property drawing

Gets Drawing.

Description:

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

Returns:

The value of Drawing.

Return type:

drawing (IDrawing)

property entity_type

Gets entity_type.

Description:

Indicates the type of entity.

Remarks:

Once you know the type of the entity, you can access additional properties. See IAngleDimension, IAnnotationDimension, IArc, IBezier, IBlockInsert, IBorderPlotArea, ICentreDimension, IDimension, IGraphic, IInsertEntity, ILayerInsert, ILeaderDimension, ILine, ILinearDimension, IMasterLayerInsert, IRadiusDimension, IRubberEntity, ISymbolInsert, IText.

Returns:

The value of entity_type.

Return type:

entity_type (ipEntityType)

property extents

Gets Extents.

Description:

Returns an IRect object representing the extents of the entity.

Returns:

The value of Extents.

Return type:

extents (IRect)

property geometric

Gets Geometric.

Description:

Determines if the entity is a geometric entity, i.e. the entity is a line, arc or bezier.

Remarks:

This property is useful when iterating a list of entities to perform operations on only geometric entities.

Returns:

The value of Geometric.

Return type:

geometric (bool)

property palette

Gets Palette.

Description:

Returns an IPalette object representing the palette of this entity.

Returns:

The value of Palette.

Return type:

palette (IPalette)

property secondary_palette

Gets secondary_palette.

Description:

Gets and sets the name of the secondary palette.

Returns:

The value of secondary_palette.

Return type:

secondary_palette (str)

property selected

Gets Selected.

Description:

Indicates the selected state of the entity.

Returns:

The value of Selected.

Return type:

selected (bool)

property stale

Gets Stale.

Description:

Use Stale to determine if the entity that this object describes still exists.

Remarks:

An entity object may become “stale” when the underlying entity no longer exists. If Stale is TRUE then attempting to reference any other method or property of the object will cause an error.

Returns:

The value of Stale.

Return type:

stale (bool)

property visible

Gets Visible.

Description:

Indicates whether an entity is currently visible.

Remarks:

This is a read-only property. Any entity’s visibility is affected by factors such as its palette, its layer, its entity type, its block. Note that this property applies to the current window (equivalent to active_drawing.active_window). Introduced in Impact 8.0.0.74

Returns:

The value of Visible.

Return type:

visible (bool)

copy()
Description:

Makes an identical copy of the entity.

Remarks:

Note that the new entity goes into the same block as the original entity (not necessarily into the active block). See also copy_to_block method. Introduced in Impact 8.0.0.57

copy_to_block(block)
Description:

Makes a copy of the entity, placing it into the specified block.

Remarks:

Note that the entity’s location in block coordinates will remain constant, meaning that the entity might be moved in the layer (world coordinates). See also Copy method, which copies the entity within the same block. Introduced in Impact 8.0.0.73

Parameters:

block (IBlock) – The destination block for the entity. This can be an IBlock or an IActiveBlock, allowing you to copy entities to the active sub-block of another layer.

Examples:

delete()
Description:

Deletes the entity.

Remarks:

You need to avoid deleting entities while iterating through a collection of entities, because Impact is likely to crash when trying to find the next entity in the collection. One trick is to step backwards through the collection, as shown in the example script. A better solution is to put the entity objects into another data structure, such as an array or array_list, and then iterate through that structure instead. After calling this method it is an error to access any of the properties (except Stale) or methods of the entity since the entity is “stale”. Prior to Impact 9.0.0.77, Impact would crash if you attempt to delete an entity which is not within the current block (active_block).

explode()
Description:

Explodes this entity into its component parts. Please do not use this method (see remarks).

Remarks:

This method is no longer supported. Please use IActiveBlock.explode instead.

Is(other_entity)
Description:

Compares this entity object with another one, to see if they actually represent the same entity.

Remarks:

This method is not for comparing two entities which might be similar. If you copy an entity (using IEntity.copy, for example) then compare using this Is method, it will return False. Introduced in Impact 8.0.0.33.

Returns:

True if the two objects refer to the same underlying entity.

Parameters:

other_entity (IEntity) – The entity to be checked against this one.

Examples:

point_on_side(point)
Description:

Determines the side of the entity a given point lies on.

Remarks:

This method will only return valid results for entities with the following types: etLine etArc etBezier If the entity is not one of the above types then the result of this method will always be esUndefined.

Returns:

One of the values from the enumeration ipEntitySide.

Parameters:

point (IVector) – The point to query.

transform(matrix)
Description:

Apply a transformation matrix to the entity.

Remarks:

Introduced in Impact 7.0.0.31.

Parameters:

matrix (IMatrix) – The matrix to be applied.