IDrawing

class IDrawing

Bases: ImpactCOMWrapperBase

Description:

Represents a drawing.

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

property active_layer

Gets active_layer.

Description:

Returns an ILayer object that represents the active layer.

Remarks:

There is always at least one layer in a drawing so this property will never be NULL. To set a different active layer of a drawing, assign an ILayer object to this property.

Returns:

The value of active_layer.

Return type:

active_layer (ILayer)

property active_window

Gets active_window.

Description:

Gets the active window associated with the drawing.

Returns:

The value of active_window.

Return type:

active_window (IWindow)

property actual_face

Gets actual_face.

Description:

Sets and gets the actual face of the design.

Returns:

The value of actual_face.

Return type:

actual_face (ipFaceOrientation)

property auto_number_columns

Gets auto_number_columns.

Description:

Determines the columns for a specific drawing that will have Auto-Number codes generated.

Remarks:

Use this property to determine those database columns in a drawing that will have Auto-Number codes automatically generated when saved. This can be useful if you want to determine or disable those columns.

Returns:

The value of auto_number_columns.

Return type:

auto_number_columns (any)

property auto_number_columns2

Gets auto_number_columns2.

Description:

Determines the columns for a specific drawing that will have Auto-Number codes generated.

Remarks:

The auto_number_columns property only returns names of columns in the DRAWINGS, LAYERS and Layer Type tables (such as ONE_UP). This property also includes an auto-number Type for each column. This is required because, for a given column, the auto-numbering options can be set to only be applied if the existing version is null. Such columns are considered Overridable, as a supplied value will override the auto-numbering; otherwise they are Unconditional. When setting up Auto-Number Rules in Database Installation, there is an option ‘Replace existing codes at Save As’. If this option is switched on, this column is Unconditional. If the option is switched off, it is Overridable. Introduced in 8.0.0.75.

Returns:

The value of auto_number_columns2.

Return type:

auto_number_columns2 (any)

property auto_number_save_folder

Gets auto_number_save_folder.

Description:

Determines the defaut IFolder an item will be saved into if an Auto-Number rule is defined.

Remarks:

An Auto-Number rule assigned to DRAWINGS.D_GROUP or SYMBOLS.S_GROUP is used to generate a default save folder for an item.

Returns:

The value of auto_number_save_folder.

Return type:

auto_number_save_folder (IFolder)

property bridge_styles

Gets bridge_styles.

Description:

Gets an IBridgeStyles collection representing all the bridge styles in the drawing.

Returns:

The value of bridge_styles.

Return type:

bridge_styles (IBridgeStyles)

property coordinate_system

Gets coordinate_system.

Description:

Gets the current coordinate system for this drawing.

Returns:

The value of coordinate_system.

Return type:

coordinate_system (ICoordinateSystem)

property customer

Gets Customer.

Description:

The ICustomer object currently assigned to this project.

Remarks:

This property only applies to drawings whose drawing_type is dtProject or dtStandard. To set the customer of a drawing assign an ICustomer object to this property.

Returns:

The value of Customer.

Return type:

customer (ICustomer)

property database_item

Gets database_item.

Description:

The IDatabaseItem object that represents this drawing.

Remarks:

If this drawing has not yet been saved in the database this property returns NULL.

Returns:

The value of database_item.

Return type:

database_item (IDatabaseItem)

property database_values

Gets database_values.

Description:

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. 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)

property document_creator

Gets document_creator.

Description:

Gets an IDocumentCreator for adding documents to an unsaved drawing.

Remarks:

Using the document_creator property will fail if the drawing has already been saved in the database. Instead use the database_item.documents.Creator property. The document_creator can be used to add multiple documents, however none of the documents will actually be added to the document repository until after the drawing is saved. Once the drawing is successfully saved the IDocumentCreator.perform method is automatically called and all the documents and document relationships are added to the document repository.

Returns:

The value of document_creator.

Return type:

document_creator (IDocumentCreator)

property drawing_type

Gets drawing_type.

Description:

Indicates the type of drawing - project, template or symbol.

Remarks:

Note that there are two definitions of ipDrawingType. This method only returns the abbreviated values. You may alternatively use IDrawing.database_item.drawing_type to retrieve the extended ipDrawingType values; this is necessary to determine if the drawing is a standard, for example.

Returns:

The value of drawing_type.

Return type:

drawing_type (ipDrawingType)

property extents

Gets Extents.

Description:

Gets the extents of the drawing.

Returns:

The value of Extents.

Return type:

extents (IRect)

property full_name

Gets full_name.

Description:

The full name of the drawing.

Returns:

The value of full_name.

Return type:

full_name (str)

property graphic_images

Gets graphic_images.

Description:

Gets an IGraphicImages collection that represents all the images in this drawing.

Returns:

The value of graphic_images.

Return type:

graphic_images (IGraphicImages)

property guid

Gets GUID.

Description:

The GUID of the drawing.

Returns:

The value of GUID.

Return type:

guid (str)

property is_untitled

Gets is_untitled.

Description:

Tests if the drawing has no name.

Remarks:

Introduced in 8.0.0.75.

Returns:

The value of is_untitled.

Return type:

is_untitled (bool)

property last_point

Gets last_point.

Description:

Gets the last point in the drawing used in a previous drawing operation.

Remarks:

All drawing operations work by starting with the last point given in a previous drawing operation, or the origin if no drawing has been carried out beforehand. This makes the drawing of connected geometry easier. This property returns the last such point or the origin.

Returns:

The value of last_point.

Return type:

last_point (IVector)

property layers

Gets Layers.

Description:

Returns an ILayers collection that represents all the layers in the drawing.

Returns:

The value of Layers.

Return type:

layers (ILayers)

property palette_groups

Gets palette_groups.

Description:

An IPaletteGroups collection representing all the palette groups in the drawing.

Returns:

The value of palette_groups.

Return type:

palette_groups (IPaletteGroups)

property palette_options

Gets palette_options.

Description:

Gets an IPaletteOptions object to modify the palettes used for construction, dimension and text entities.

Returns:

The value of palette_options.

Return type:

palette_options (IPaletteOptions)

property palettes

Gets Palettes.

Description:

Returns an IPalettes collection that represents all the palettes in the drawing.

Remarks:

This is equivalent to accessing the ‘Palettes’ property of the first palette group in this drawing.

Returns:

The value of Palettes.

Return type:

palettes (IPalettes)

property saved

Gets Saved.

Description:

Gets the saved status of the drawing. If any changes are made to the drawing Saved becomes false until the drawing has been saved.

Returns:

The value of Saved.

Return type:

saved (bool)

property symbols

Gets Symbols.

Description:

Returns an ISymbols collection that represents all the symbols in the drawing.

Returns:

The value of Symbols.

Return type:

symbols (ISymbols)

property text_style_sheets

Gets text_style_sheets.

Description:

Gets an ITextStyleSheets collection representing all the text styles in the drawing.

Returns:

The value of text_style_sheets.

Return type:

text_style_sheets (ITextStyleSheets)

property variable_settings

Gets variable_settings.

Description:

Returns an IDrawingVariableSettings object representing all the variable settings.

Remarks:

The IDrawingVariableSettings object represents all the variables, variable groups and variable settings in the drawing.

Returns:

The value of variable_settings.

Return type:

variable_settings (IDrawingVariableSettings)

property windows

Gets Windows.

Description:

Returns an IWindows collection that represents all the IWindow objects that represent the drawing.

Returns:

The value of Windows.

Return type:

windows (IWindows)

border_plot_layer(border_plot_area_name)
Description:

Find the layer referenced by a specified border plot area. If more than one layer is matched, only the first layer is returned.

Remarks:

This method is normally used from scripts embedded in text entities within a border plot template; it allows the script to retrieve properties of the returned layer, in order to generate text specific to that layer. Introduced in Impact 5.1.4.4.

Returns:

An ILayer is returned. If no border plot area exists with the specified name, or if no layer is matched to the area, a NULL object is returned.

Parameters:

border_plot_area_name (str) – The name of the border plot area (in the border plot template).

close()
Description:

Closes the drawing.

Remarks:

Any unsaved changes will be discarded.

convert_coords(point, from_coordinate_system, to_coord_system)
Description:

Converts an IVector between two specific coordinate systems.

Remarks:

Most methods/properties will return points that are in the project’s coordinate system (as defined by IDrawing.coordinate_system.Mode). Some however will always use block coordinates. Introduced in Impact 6.3.0.2.

Parameters:
  • point (IVector) – The point to convert.

  • from_coordinate_system (ipCoordinateMode) – The coordinate system the point is currently in (or assumed to be in).

  • to_coord_system (ipCoordinateMode) – The coordinate system of the resultant point.

copy_entities()
Description:

Copy all selected entities to the clipboard.

Remarks:

This method should not be used from the IServer application as there is no clipboard in this context. Use IActiveBlock.paste to create the new copied entities. See also IActiveBlock.copy_entities for copying entities without using the clipboard.

export(file_name, settings, file_format)
Description:

Exports the drawing to a file.

Remarks:

If this IDrawing was obtained from an IServer object and it contains some macro objects these objects will be skipped. This is a limitation of the IServer object because it does not support the IML. If the export fails the IDatabase.errors property may be accessed in order to determine why.

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

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

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

export2(options)
Description:

Exports multiple layers of the drawing to a file.

Remarks:

Use ICreator.export_options to create the IExportOptions object. Introduced in Impact 11.0.0.86

Parameters:

options (IExportOptions) – The export options, including file path and import/export settings.

export_to_stream(settings, file_format)
Description:

Exports the drawing to a stream.

Remarks:

If this IDrawing was obtained from an IServer object and it contains some macro objects these objects will be skipped. This is a limitation of the IServer object because it does not support the IML. If the export fails the IDatabase.errors property may be accessed in order to determine why. 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 drawing.

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

export_to_stream2(options)
Description:

Exports multiple layers of the drawing to a stream.

Remarks:

Use ICreator.export_options to create the IExportOptions object. Note that VBScript does not support streaming. Introduced in Impact 11.0.0.86

Returns:

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

Parameters:

options (IExportOptions) – The export options, including import/export settings.

generate_auto_number(settings)
Description:

Generates an single auto-number code from a specific Auto-Number setting.

Remarks:

The Auto-Number setting can reference values from the drawing or any layers (such as database values or variables). To use an Auto-Number setting without a drawing us the IDatabase.generate_auto_number method.

Parameters:

settings (IMasterSetting) – The Auto-Number settings to use to generate the code.

get_unreferenced_blocks()
Description:

Gets a list of IBlock objects representing all the unreferenced blocks in this drawing.

insert_master_layer(project_name, layer_name)
Description:

Inserts a master layer from another drawing.

Remarks:

Introduced in Impact 10.0.0.65. (In previous versions the method existed, but was not implemented.)

Parameters:
  • project_name (str) – Specifies the name of the drawing from which to insert the layer.

  • layer_name (str) – Specifies the name of the layer to be inserted.

print(options)
Description:

Prints the active canvas of the this drawing.

Remarks:

See IPrintOptions for additional examples.

Parameters:

options (IPrintOptions) – Specifies the printing options.

purge_block(block)
Description:

Purges a block in the drawing.

Remarks:

If the block to purge is not purgeable, i.e. it is still referenced in the drawing, it will not be purged. If the block to purge is not from the drawing an error will occur.

Parameters:

block (IBlock) – The block to purge.

purge_blocks()
Description:

Purges all unreferenced blocks in the drawing.

purge_history()
Description:

Clears the “undo history” of the drawing.

Remarks:

Introduced in Impact 7.0.0.30.

recalculate_text_entities()
Description:

Updates all Dynamic Text in the drawing.

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 updates all layers within the drawing, to update only those text entities within a single layer see ILayer.recalculate_text_entities. IServer does not support the updating of IML text entities.

save()
Description:

Saves the drawing assuming the drawing has already been saved into the database.

Remarks:

If the drawing does not already exist in the database this method fails.

save2(options)
Description:

Saves the drawing assuming the drawing has already been saved into the database.

Remarks:

Introduced in 8.0.0.86.

Parameters:

options (IDrawingSaveOptions) – This is used to report back errors if the save fails. replace_existing is ignored for this type of save.

save_as(code, name, description, folder, replace_existing)
Description:

Saves a copy of the drawing in the database.

Remarks:

The newly saved/generated drawing becomes the active drawing.

Parameters:
  • code (str) – Specifies the code of the drawing.

  • name (str) – Specifies the name of the drawing.

  • description (str) – Specifies a description of the drawing.

  • folder (IFolder) – Specifies the IFolder to save drawing in.

  • replace_existing (bool) – Specifies whether to replace any existing drawing.

save_as2(options)
Description:

Saves a copy of the drawing in the database using an options parameter.

Remarks:

Introduced in 8.0.0.86. Unlike save_as, this doesn’t specify any specific values (Code, Name etc), but relies entirely on the existing database_values having been set appropriately before it is called. Additionally, the Error fields in the Options parameter will be filled in appropriately if the save fails. The newly saved/generated drawing becomes the active drawing.

Parameters:

options (IDrawingSaveOptions) – This is used mainly to report back errors if the save fails. replace_existing property specifies whether to replace any existing drawing having the same name.

save_drawing_as_image(image_params)
Description:

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

Remarks:

Introduced in Impact 8.0.0.47

Parameters:

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

save_drawing_as_image_stream(image_params)
Description:

Saves the drawing as an image to a stream.

Remarks:

Note that VBScript does not support streaming. Introduced in Impact 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.

update_drawing_items(item)
Description:

Updates items in the drawing that are out of date.

Remarks:

IDrawing.update_drawing_items(duRecalculateText) is equivalent to IDrawing.recalculate_text_entities.

Parameters:

item (ipDrawingUpdate) – Defines the items that should be updated.