> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Database classes

## `DB` class

#### *class* compolyx.DB(\*args, \*\*kwargs)

Class to represent the ComPoLyX database.

* **Access:**

```python theme={null}
>>> import compolyx
>>> db = compolyx.DB()
```

#### *property* active\_model

Active model.

#### clear()

Clear database.

#### clear\_generated\_data(model=None)

Function clears the eventually stored update results and deletes the generated data such as Production and Analysis Plies, Solid Models, etc.

* **Parameters:**
  * **model**: The ACP model to be cleared.

#### close(model=None)

Close model.

* **Parameters:**
  * **model**: Model to close (optional). If no model is given, then all models are closed.

#### import\_model(name, path, format, ignored\_entities=None, convert\_section\_data=None, unit\_system\_type=None, reference\_surface\_input\_unit\_system\_type=None)

Create a model from file.

* **Parameters:**
  * **name**: Custom name of the model.
  * **path**: Path to the data file.
  * **format**: File format string. Options:
    * `abaqus:inp`
    * `ansys:cdb`
    * `ansys:dat`
    * `nastran:bdf`
    * `ansys:h5`
  * **ignored\_entities**: Entities to ignore. Can be a subset of the following list:
    * \[`mesh`, `element_sets`, `materials`, `coordinate_systems`, `shell_sections`]
  * **convert\_section\_data**: Whether to import and convert the shell section data into ACP composite definitions. Default is `False`.
  * **unit\_system\_type**: Set the unit system of the model to this type. Ignored if a unit system was already defined in the data file.
  * **reference\_surface\_input\_unit\_system\_type**: Set the unit system of the reference surface if the unit system cannot be read from the input.

#### *property* material\_data

Material databse.

#### *property* models

Models.

#### open(path, replace\_workbench\_inputs=None, pre\_db=None, unit\_system\_type=None, load\_cached\_data=False, apply\_shared\_commands=False)

Open ACP file and append the model to models container.

* **Parameters:**
  * **path**: Path to ACP file.
  * **replace\_mesh\_kwargs**: Optional keyword arguments to replace the mesh to load in db.import\_model(…) upfront.
  * **replace\_workbench\_inputs**: Optional dictionary with Workbench application inputs to replace before executing the .acp file.

#### open\_h5(path, cache\_data=False, apply\_shared\_commands=False)

Load a model from an .acph5 database.

* **Parameters:**
  * **path**: The .acph5 file path.
  * **cache\_data**: Boolean on whether to load the update results.
  * **apply\_shared\_commands**: Boolean to specify whether to load the Python commands from the ACP shared section of the .acph5 file.

#### refresh\_acph5(path, external\_sources, input\_parameters=None, initialize=False, unit\_system\_type=None, upgrade\_from=None)

Refresh an .acph5 database (Workbench application mode only).

* **Parameters:**
  * **path**: File path to the .acph5 file.
  * **external\_sources**: Nested dict provided by the ACP Workbench application add-in containing all the external source’s information (the file path, whether the source was modified, its ID, etc.). The dict keys are:
    * \[`model`, `materials`, `cad_geometries`, `imported_solid_models`, `pre_db`, `solutions`]
      * Values for `model` and `materials` are dicts with the following fields:
        * \[`path`, `external_id`, `modified`]
      * Values for `cad_geometries`, `imported_solid_models` and `pre_db` are list of dicts with fields:
        * \[`name`, `path`, `external_id`, `modified`]
      * Values for `solutions` are dicts with fields:
        * \[`name`, `path`, `external_id`, `modified`, `renumbering_mapping_paths`] where
          renumbering\_mapping\_paths is a list of file paths.
  * **input\_parameters**: A dict of pairs (`name`, `value`) of the Workbench application input parameters.
  * **initialize**: Specifies whether the .acph5 database needs to be initialized (for example if the file does not yet exist).
  * **unit\_system\_type**: Defines the unit system of the main/downstream ACP file.
  * **upgrade\_from**: Defines the path of a legacy (.acp) ACP database that has to be upgrade to the new format (load composite definitions and save as .acph5).

#### reload(model)

Reloads the reference surface (mesh) of the model. For more details, see reload\_mesh in the model.

* **Parameters:**
  * **model**: The model to be reloaded.

#### save(path=None, model=None, cache\_data=None)

Save active model.

* **Parameters:**
  * **path**: File path.
  * **model**: Active model.
  * **cache\_data**: Whether to store the update results.

#### set\_unit\_system(unit\_system\_type)

Set the unit system of all models opened in the database.
