IDatabaseItem¶
- class IDatabaseItem¶
Bases:
ImpactCOMWrapperBase- Summary:
Represents an item in the database, this may be a project, symbol, template, standard or standard part.
Wraps a COM object or another wrapper instance. Accepts: - A valid impact_object - An existing impact_com_wrapper_base-derived instance
- property all_documents¶
Gets all_documents.
- Summary:
An IDocuments collection representing all documents associated with this item.
- Remarks:
This property provides a collection of IDocuments that this item has a relationship to. This includes not only directly related IDocument’s but documents for the item’s customer, site, and project layers if appropriate. See IDocuments.relationship for details of how to iterate the available relationships between documents and their associated objects. To retrieve documents that only have a direct relationship to this item use the Documents property. Introduced in Impact 9.0.0.83.
- Returns:
The value of all_documents.
- Return type:
Examples:
- property being_modified¶
Gets being_modified.
- Summary:
Indicates if the drawing that this object represents is being modified.
- Remarks:
The item may be being modified by one or more users, to determine the users who are modifing the item examine the User property of each of the item Layers. To determine if the item is being modified by the user connected to the database use the working_project property.
- Returns:
The value of being_modified.
- Return type:
being_modified (bool)
Examples:
- property code¶
Gets Code.
- Summary:
The code of the drawing.
- Returns:
The value of Code.
- Return type:
code (str)
- property created_by¶
Gets created_by.
- Summary:
The user that created this drawing.
- Returns:
The value of created_by.
- Return type:
- property created_by_key¶
Gets created_by_key.
- Summary:
The key of the user that created this drawing. (Internal use only)
- Remarks:
This property is for internal use only and may be removed without prior notice. Use the created_by.key property instead.
- Returns:
The value of created_by_key.
- Return type:
created_by_key (int)
- property created_date_time¶
Gets created_date_time.
- Summary:
The date and time the drawing was created.
- Returns:
The value of created_date_time.
- Return type:
created_date_time (datetime)
- property customer¶
Gets Customer.
- Summary:
The customer assigned to this drawing.
- Remarks:
This property does not apply to drawings of type dtSymbol, dtTemplate, or dtStandardPart. The value may not be modified directly; instead use IDatabaseItem.change_customer.
- property customer_key¶
Gets customer_key.
- Summary:
The key of the customer assigned to this drawing. (Internal use only)
- Remarks:
This property is for internal use only and may be removed without prior notice. Use the Customer.key property instead.
- Returns:
The value of customer_key.
- Return type:
customer_key (int)
- property customer_locked_by¶
Gets customer_locked_by.
- Summary:
The user who has locked the customer for modification.
- Returns:
The value of customer_locked_by.
- Return type:
- property description¶
Gets Description.
- Summary:
Gets the description of the item.
- Returns:
The value of Description.
- Return type:
description (str)
- property documents¶
Gets Documents.
- Summary:
An IDocuments collection representing all the documents directly associated with this item.
- Remarks:
This property provides a collection of IDocuments that this item has a direct relationship to. To retrieve all documents that are associated to this item see the all_documents property.
- Returns:
The value of Documents.
- Return type:
Examples:
- property drawing¶
Gets Drawing.
- Summary:
The IDrawing object that this item represents.
- Remarks:
If the drawing isn’t open, this property will be NULL. Before using this property, you should first ensure the drawing is open.
- property drawing_type¶
Gets drawing_type.
- Summary:
Indicates the type of drawing this is.
- Remarks:
Note that this method actually returns the extended ipDrawingType values, so for example a project which is also a standard will return dtStandard, not dtProject.
- Returns:
The value of drawing_type.
- Return type:
- property file_location¶
Gets file_location.
- Summary:
The location of the drawing file in the database.
- Remarks:
This property returns the location of the most up to date drawing file in the database. This property works with both File and BLOB databases. For a BLOB database the location is a temporary file in the Geometry Cache folder which will be deleted when the owning IDatabaseItem object is destroyed. This property will work with the IServer however the database must be configured to use UNC names and the client must have access to the network location to access the file. This property is provided so that you can pass the drawing file to another component such as the Impact active_x control. Replacing or deleting the file in the location may result in a corrupt Impact database. Extreme care should be exercised when using this property.
- Returns:
The value of file_location.
- Return type:
file_location (str)
Examples:
- property folder¶
Gets Folder.
- Summary:
Indicates the location of this item in the database.
- property guid¶
Gets GUID.
- Summary:
The GUID of the drawing.
- Returns:
The value of GUID.
- Return type:
guid (str)
- property key¶
Gets Key.
- Summary:
The key of the drawing.
- Returns:
The value of Key.
- Return type:
key (int)
- property layers¶
Gets Layers.
- Summary:
An IDatabaseLayers collection representing the layers in the drawing that this object represents.
- Returns:
The value of Layers.
- Return type:
- property locked_by¶
Gets locked_by.
- Summary:
The user that has locked this drawing.
- Remarks:
If the drawing is not locked by a user this property returns NULL. For drawings of type dtTemplate, dtSymbol and dtStandardPart this property is the user who is currently editing the item.
- property master¶
Gets Master.
- Summary:
Indicates if this is a master drawing or not.
- Remarks:
This property is only applicable to items whose drawing_type is dtProject or dtStandard.
- Returns:
The value of Master.
- Return type:
master (bool)
- property modified_by¶
Gets modified_by.
- Summary:
The user that last modified this drawing.
- Returns:
The value of modified_by.
- Return type:
- property modified_by_key¶
Gets modified_by_key.
- Summary:
The key of the user that modified this drawing. (Internal use only)
- Remarks:
This property is for internal use only and may be removed without prior notice. Use the modified_by.key property instead.
- Returns:
The value of modified_by_key.
- Return type:
modified_by_key (int)
- property modified_date_time¶
Gets modified_date_time.
- Summary:
The date and time that this item was last modified.
- Returns:
The value of modified_date_time.
- Return type:
modified_date_time (datetime)
- property project_info_locked_by¶
Gets project_info_locked_by.
- Summary:
The user who has locked the project info for modification.
- Returns:
The value of project_info_locked_by.
- Return type:
- property reference¶
Gets Reference.
- Summary:
The name of the drawing that this object represents.
- Returns:
The value of Reference.
- Return type:
reference (str)
- property release_action¶
Gets release_action.
- Summary:
The IReleaseAction object used to specify options when releasing the item into the database.
- Remarks:
Each IDatabaseItem has only a single IReleaseAction object associated with it. By accessing release_action it is automatically initialized with the current checked out layers of the item. It can then be used to examine and modify the options used to release the item.
- Returns:
The value of release_action.
- Return type:
Examples:
- property revisions¶
Gets Revisions.
- Summary:
An IDatabaseRevisions collection representing the revisions of the drawing that this object represents.
- Returns:
The value of Revisions.
- Return type:
- property site¶
Gets Site.
- Summary:
Returns the ISite object this database item is associated with.
- Remarks:
This property is only applicable to items whose drawing_type is dtProject or dtStandard. This property is only applicable when project_sites are enabled.
Examples:
- property size¶
Gets Size.
- Summary:
The size in bytes on the database item.
- Remarks:
You can use IConvertor.bytes_as_string to display the number in an easily readable format. Introduced in 8.0.0.21
- Returns:
The value of Size.
- Return type:
size (int)
- property standard_set¶
Gets standard_set.
- Summary:
The standard set this item belongs to.
- Remarks:
If this item was installed in the database as part of a standard set then this property will return an IStandardSet object. If the item is not part of a standard set this property returns NULL. This property is only applicable to items whose drawing_type is dtStandard or dtStandardPart.
- Returns:
The value of standard_set.
- Return type:
- property values¶
Gets Values.
- Summary:
An IDatabaseValues object that can be used to read/write the items associated database values.
- Remarks:
The Values object can be used to directly read/write database values, extreme care should be taken when using this object. If you wish to modify the database values of a working project or open item use the database_values member of the IDrawing or ILayer object instead.
- Returns:
The value of Values.
- Return type:
Examples:
- property version¶
Gets Version.
- Summary:
The version number of the drawing this object represents.
- Returns:
The value of Version.
- Return type:
version (int)
- property working_location¶
Gets working_location.
- Summary:
The location of the working drawing file in the database.
- Remarks:
This property is only applicable to items whose drawing_type is dtProject or dtStandard. This property returns the location of the working drawing file for the currently connected user. You should check working_project before using this property. To determine the working drawing files for all users working on an item examine the working_location property of each of the item Layers. This property works with both File and BLOB databases. For a BLOB database the location is a temporary file in the Geometry Cache folder which will be deleted when the owning IDatabaseItem object is destroyed. This property will work with the IServer however the database must be configured to use UNC names and the client must have access to the network location to access the file. This property is provided so that you can pass the drawing file to another component such as the Impact active_x control. Replacing or deleting the file in the location may result in a corrupt Impact database. Extreme care should be exercised when using this property.
- Returns:
The value of working_location.
- Return type:
working_location (str)
Examples:
- property working_project¶
Gets working_project.
- Summary:
Indicates if the drawing that this object represents is being modified by the currently connected user.
- Returns:
The value of working_project.
- Return type:
working_project (bool)
Examples:
- change_customer(customer, reason)¶
- Summary:
Assign a different customer to a saved project.
- Remarks:
The project must not be locked or checked out by any user (including the user calling this method). The user must have the privilege to change a customer. Introduced in Impact 8.0.0.29.
- Parameters:
customer (ICustomer) – The new customer.
reason (str) – A description of why this modification is being made (to provide an audit trail).
Examples:
- close_and_release()¶
- Summary:
Close and release the item back into the database.
- Remarks:
This method only applies to items whose drawing_type is dtProject or dtStandard. If the item is open then the drawing is automatically closed, however if the drawing requires saving this method will fail. The release_action object can be used to specify options for releasing the item. If you do not access the release_action object then by default any item that has been modified will be updated, and any item that has not been modified will be discarded.
- Returns:
Returns true if the item is successfully closed and released into the database. Returns false is any error occurred while trying to close and release the item.
Examples:
- delete()¶
- Summary:
Deletes the item from the database.
- Remarks:
If the drawing that this item represents is open this method fails.
- description_translated(language_id, exact_language_match)¶
- Summary:
Gets the translated description of the item, in the language specified.
- Remarks:
For a more detailed explanation of the parameters, please see the notes for the master_setting_name_translated method. Introduced in Impact 8.0.0.52
- Parameters:
language_id (any) – A string or enum representing the language wanted.
exact_language_match (bool) – Specifies what to do if there is no translation for the specified language.
Examples:
- export(file_name, settings, file_format)¶
- Summary:
Exports a drawing to a file, without the need to already have it open.
- Remarks:
Introduced in Impact 8.0.0.64
- 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.
Examples:
- export2(options)¶
- Summary:
Exports multiple layers of the drawing to a file, without the need to already have it open.
- 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.
Examples:
- export_to_stream(settings, file_format)¶
- Summary:
Exports a drawing to a stream without the need to already have it open.
- Remarks:
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 new file.
- export_to_stream2(options)¶
- Summary:
Exports multiple layers of a drawing to a stream, without the need to already have it open.
- Remarks:
Note that VBScript does not support streaming. Use ICreator.export_options to create the IExportOptions object. Introduced in Impact 11.0.0.86
- Parameters:
options (IExportOptions) – The export options, including import/export settings.
- isNone()¶
Checks if the COM object is None. This is useful for determining if the wrapper has been initialized with a valid COM object.
- move_to(folder)¶
- Summary:
Move the item to the specified IFolder.
- Remarks:
This method will return false if the item is already in the specified folder.
- Parameters:
folder (IFolder) – Specifies the destination IFolder, the item is moved into this folder. The IFolder must be in the same database as this item. The destination folder’s Type must match the type of this item (so for example a project may not be moved to a symbols folder).
- open()¶
- Summary:
Opens the drawing that this object represents from the database.
- Remarks:
If the drawing that this object represents is already open this method does not open a duplicate drawing it returns another IDrawing object representing the open drawing. If the drawing is already open the IDrawing object can also be accessed using the Drawing property. If the database is remote then a copy of the drawing is opened.
Examples:
- open_copy()¶
- Summary:
Opens a copy of the drawing that this object represents from the database.
- open_layers(layers)¶
- Summary:
Opens the drawing that this object represents from the database and checks out only the specified layers.
- Remarks:
If the drawing that this object represents is already open this method fails, the current user must not have any layers checked out to call this method. If another user has any of the requested layers checked out then this method also fails. If the drawing is already open the IDrawing object can also be accessed using the Drawing property.
- Parameters:
layers (any) – Specifies the names of the layers to check out.
- reference_translated(language_id, exact_language_match)¶
- Summary:
Gets the translated reference of the item, in the language specified.
- Remarks:
For a more detailed explanation of the parameters, please see the notes for the master_setting_name_translated method. Introduced in Impact 8.0.0.52
- Parameters:
language_id (any) – A string or enum representing the language wanted.
exact_language_match (bool) – Specifies what to do if there is no translation for the specified language.
Examples:
- refresh()¶
- Summary:
Refresh the item information from the database.
- rename(code, name)¶
- Summary:
Renames the drawing this object represents from the database. You can specify both a Code and Name to modify both the drawings code and name values. Alternatively specify just a Code or a Name to modify only one value.
- Remarks:
The drawing cannot be open, checked out, or locked by another user when this method is called.
- Parameters:
code (str) – Specifies the new code for the drawing.
name (str) – Specifies the new name for the drawing.
- save_guid_string()¶
- Summary:
Ensures that a GUID exists for this drawing.
- Remarks:
Introduced in Impact 5.1.5.1. A GUID is only created if one does not already exist.
- save_thumbnail_to_file(file_name, file_format, create_thumbnail)¶
- Summary:
Saves the embedded thumbnail image to a file.
- Remarks:
If an embedded thumbnail image does not exist in the drawing it is created if the method parameter create_thumbnail is true - this is potentially a slow operation as the drawing data must be retreived from the database.
- Parameters:
file_name (str) – Specifies full path of the new file.
file_format (ipFileFormat) – Specifies the format in which to save the file. This can be one of the following values from the enumeration ipFileFormat: ffBitmap ffJPG ffPNG ffMetafile ffTIFF
create_thumbnail (bool) – Specifies if a thumbnail image will be generated if one does not already exist.
Examples:
- save_thumbnail_to_stream(file_format, create_thumbnail)¶
- Summary:
Saves the embedded thumbnail image to a stream.
- Remarks:
If an embedded thumbnail image does not exist in the drawing it is created if the method parameter create_thumbnail is true - this is potentially a slow operation as the drawing data must be retreived from the database. This method cannot be called from VBScript as it does not support the IStream interface. You may use this method from other COM clients such as .NET applications.
- Returns:
This method returns an IUnknown interface but the interface also supports the IStream interface.
- Parameters:
file_format (ipFileFormat) – Specifies the format in which to save the file. This can be one of the following values from the enumeration ipFileFormat: ffBitmap ffJPG ffPNG ffMetafile ffTIFF
create_thumbnail (bool) – Specifies if a thumbnail image will be generated if one does not already exist.
Examples