Asset Documents

Asset Documents are a specialized type of smile2 documents. Their main purpose is, to be included (referenced) from other documents.

Cases, where this is useful are:

  • A piece of geometry or a functional unit (eg a transistor design), should be included in many documents. Ideally, one would also like change in the individual references, without modifications of the original object. Additionally, one might want to make improvements to the source and propagate these to all references.
  • More than one person is working on a structure design in parallel, and the different tasks should be separated such that they do not interfere.

The difference of asset document in comparison to normal smile2 documents is:

  • Asset documents have no document modes and can be opened and edited only in edit mode.
  • Asset documents have no write field or any write settings.
  • Asset documents do not contain a task list or task entries.
  • Assets can include special points, that can act as control ports in the reference.

Creating Asset Documents

There are two ways to create an asset document:

  1. Choose File → New Asset from the main menu. This will create a new asset document. You can now start editing this document like any other smile2 document.
  2. Select the design elements/objects you would like to export as an asset document. Choose Resources → Create Asset and specify your desired options (See: Create Asset (createAsset)).

Referencing Asset Documents

After an asset document has been created, one can start to create references (asset objects in other smile2 documents. To to this, the Load Asset (addAsset) command located in the main menu under Resources → Load Asset, can be used.

Beside a file name, this command has options to specify how the asset should be displayed and how the layers from the asset should be treated. This options can also be changed any time later on, in the Shape property sheet, found in the attribute editor.

After the asset reference has been created, one can treat it like any other object in smile2.

Asset Interfaces

After creating the asset reference (or the asset object), the content of the asset appears as a single object that cannot be changed. In cases where you want to reference an copy, without any internal changes, this is fine.

However in many cases, one would like to make changes to the referenced geometry (eg. changing the width of a contact, changing the position of an element, etc.). For this purpose, assets offer a concept called interface.

Using the Interface

The following example demonstrates an asset object that references an asset file containing a simple interface:

_images/asset_interface2.gif

The asset interface points can be accessed and manipulated in point selection mode. Depending on the features of the asset document, several things can be adjusted with the interface points (here, the asset file provides an interface to adjust the position of the wires, and the width and length of the “probe”).

The interface control points behave like an other vertices (eg. corners of a polygon). Eg. point snapping or tools like the Attach Points Tool can be used to attach “outer world” objects to asset elements.

If the asset provides Interface Attributes (see next chapter), these attributes are located in the “Interface Attribute” section of the asset shape property sheet. These attributes can also be used to numerically control internal aspects of the asset. Eg. the asset shown above, exposes a Bar Width attribute:

_images/asset_interface3.gif

The “Bar Width” interface attribute can be used to control the width of the bar numerically.

Creating an Interface

Only point shapes can act as interface points. To turn a normal point into an interface point, the Interface Layer attribute needs to be switched on:

_images/ae_interface_settings.png

The Interface Layer attribute can be found in the “Dynamic properties” section of point’s shape settings, in the attribute editor.

Additionally, an “Interface Label” text and draw style for the “handle” can be specified.

Note

These attributes are only available in asset documents.

As next, one can use the interface points, to implement the functionality. One could constrain components to it by using the Attach Points Tool, or with the Python API. One could also parenting other object or groups to it, or create connections from it’s position plug to the desired control plug (possibly using expression node(s) in-between). To set up connections, either the node editor or the connection features of the attribute editor can be used.

Creating Interface Attributes

Sometimes it is more convenient to control settings by an (numerical) input control instead of a handle (eg. the “width” of the bar in the example above).

To create an interface attribute, do the following:

  • Add a dynamic attribute to the asset document:

    _images/asset_interface4.gif

    Add a dynamic attribute to the document node.

  • Create an input connection from the desired plug you want to control to the newly created plug:

    _images/asset_interface5.gif

    Here, ctl2 refers to the object name of the control point used for the length. Without a handle, we could reference the width attribute of the rectangle directly. .tr.x refers to the x-coordinate of the translation plug (one could also write ctl2.translation.x).

    Hint

    The connection and/or required nodes, can also be created using the Python API.

That’s it. The newly created and connected plug will appear as interface attribute in the asset shape settings.