IManagedAssembly Interface |
In a rule, this interface is implemented by the predefined object named ThisAssembly.
Namespace: Autodesk.iLogic.Interfaces
The IManagedAssembly type exposes the following members.
Name | Description | |
---|---|---|
Components |
Gets an object that can be used to add, modify, and delete components.
| |
Constraints |
Gets an object that can be used to add, modify, and delete constraints.
| |
Document |
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.
| |
Geometry |
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.
| |
ImmediateConstraints |
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.
| |
Patterns |
Gets an object that can be used to add, modify, and delete component patterns.
|
Name | Description | |
---|---|---|
BeginManage |
Puts the system in a "managed group" state.
The BeginManage/EndManage pair of functions provides for automatic deletion of unused components.
| |
EndManage |
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.)
| |
GetAppearanceAsset(String) |
Gets an appearance asset from the document.
An error will occur if the appearance is not found.
| |
GetAppearanceAsset(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.
|
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:
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")