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

# Layouts

This notebook shows how to access layouts through the Streamlined API.

## Connect to Granta MI

```python theme={null}
from GRANTA_MIScriptingToolkit import granta as mpy
mi = mpy.connect("http://my.server.name/mi_servicelayer", autologon=True)
db = mi.get_db(db_key="MI_Training")
```

## Access a layout and inspect its properties

The `Table.layouts` property contains a **dict** of all layouts in the table, indexed by the layout name. Show the
first two elements in this dictionary.

```python theme={null}
table = db.get_table("MaterialUniverse")
list(table.layouts.items())[:2]
```

*Previous cell output:*

```output theme={null}
[('Polymers', <TableLayout: Polymers; categories: 23>),
 ('Metals', <TableLayout: Metals; categories: 18>)]
```

Each layout contains a list of categories. Select a particular **Layout** object and view the first two categories
within the layout.

```python theme={null}
polymers_layout = table.layouts["Polymers"]
polymers_layout.categories[:2]
```

*Previous cell output:*

```output theme={null}
['General properties', 'Composition overview']
```

The `attributes_by_category` property contains a **dict** of attributes indexed by their category. Display the
attributes in the first two categories.

```python theme={null}
list(polymers_layout.attributes_by_category.items())[:2]
```

*Previous cell output:*

```output theme={null}
[('General properties',
  ['Designation', 'Tradenames', 'Density', 'Price', 'Material form']),
 ('Composition overview',
  ['Composition (summary)',
   'Polymer class',
   'Polymer type',
   'Polymer type full name',
   '% filler (by weight)',
   'Filler type',
   'Additive'])]
```
