Click or drag to resize

IManagedAssembly Interface

Provides functions for managing components, patterns, and constraints in the assembly in which the rule is running.

In a rule, this interface is implemented by the predefined object named ThisAssembly.

Namespace:  Autodesk.iLogic.Interfaces
Assembly:  Autodesk.iLogic.Interfaces (in Autodesk.iLogic.Interfaces.dll) Version: 23.0
Syntax
Public Interface IManagedAssembly

The IManagedAssembly type exposes the following members.

Properties
  NameDescription
Public propertyComponents
Gets an object that can be used to add, modify, and delete components.
Public propertyConstraints
Gets an object that can be used to add, modify, and delete constraints.
Public propertyDocument
Gets the AssemblyDocument that is being managed. This will usually be the document that contains the rule. For external rules, it will be the document in which the rule is running.
Public propertyGeometry
Gets an object that can be used to create points, vectors, and matrices that have values in the units of the assembly in which the rule is running.
Public propertyImmediateConstraints
During rule execution, assembly update is deferred by default. Set this property to True to turn off this behavior. If this is set to True, the assembly is updated immediately after each constraint change.
Public propertyPatterns
Gets an object that can be used to add, modify, and delete component patterns.
Top
Methods
  NameDescription
Public methodBeginManage
Puts the system in a "managed group" state. The BeginManage/EndManage pair of functions provides for automatic deletion of unused components.
Public methodEndManage
Takes the system out of a "managed group" state. Any items (components, patterns, and constraints) that were previously managed by this group, but have not been touched in the current run will be deleted. (The current run includes all the statements between the preceding BeginManage and this EndManage statement.)
Public methodGetAppearanceAsset(String)
Gets an appearance asset from the document. An error will occur if the appearance is not found.
Public methodGetAppearanceAsset(String, String)
Gets an appearance asset from the document. If that fails it gets the appearance asset from a library and copies it to the document. An error will occur if the appearance is not found.
Top
Remarks

The BeginManage/EndManage pair of functions provides for automatic deletion of unused components, patterns, and constraints. Those are known as managed items.

The Components, Patterns, and Constraints objects provide Add* functions. Each of these functions operates on an item. Within a BeginManage/EndManage block, you must call Add* for every desired item, even if it already exists. The Add* call might create the item, modify it, or leave it unchanged. When EndManage is called, any items that were managed (within the current BeginManage/EndManage block), in a previous run but which were not "touched" (by an Add* call) this time are deleted. This allows for code that ensures the existence of items under certain conditions, without requiring any statements to explicitly delete the items when those conditions are not met.

So within a BeginManage/EndManage block, you only have to write the Add* functions. iLogic automatically takes care of the deletions.

Within a BeginManage/EndManage block, an Add* function can only be called once for a given item name.

BeginManage/EndManage blocks cannot be nested.

Note: the Add* functions can also be used in unmanaged mode. Any code that is outside of a BeginManage/EndManage block will run in unmanaged mode. In unmanaged mode, you can add and modify items. If there are conditions in which some of the items need to be deleted, you have to make the explicit calls to a Delete function.

When an Add* function is used and an item name is specified:

  • If an item with that name does not already exist, iLogic will create it and use the supplied name.
  • If an item with that name already exists, iLogic will modify it (if necessary) to fit the new specification.

For components and constraints (but not patterns), the Add* functions will accept a blank string for the item name. This can be used to add an item with a system-generated default name. (But it's hard to find and modify an item like that later.)

There is an AssetNameLanguage rule property to support appearance asset names in different languages. It affects the GetAppearanceAsset functions. In a rule that is stored in a document, AssetNameLanguage usually doesn't have to be set explicitly. When a rule is created, the system will store the current language in a document attribute (one time only). That language is then used as the default for all rules in the document. But in an external rule, this property should be set explicitly. Acceptable values of the AssetNameLanguage property are: "chs", "cht", "csy", "deu", "eng", "esp", "fra", "hun", "ita", "jpn", "kor", "plk", "ptb", or "rus".

Sample code:

AssetNameLanguage = "fra"
Dim assetV = ThisAssembly.GetAppearanceAsset("Vert poli")

See Also