Model.CE_MarkUpdateLinkGroup#
- Model.CE_MarkUpdateLinkGroup(collection, search_type, search_rule, replace_type, replace_rule, search_list_and_update_list_string_array, search_list_length, replace_state, keep_current_state)#
Allows search and replace of existing link information in the specified connector collection with new link information.
- Parameters:
collection (Collection) – The collection containing the connector entities.
search_type (EntityFullType) – The entity type to search in the connector. This must be specified. The supported entities are Component, Property, Surface, Tag, Element, Node and Part.
search_rule (unsigned int) –
The rule by which the link entity was added to the connector. The following codes define the different rules:
0 - Undefined
1 - None
2 - Use ID
3 - Use name
4 - Proximity
5 - Use UID
The rule must be specified to perform a search.
replace_type (EntityFullType) – The type of entity that replaces the found link entity (
search_type) in the connector. If not specified, the entity type information is not replaced for the found link (replace_type =search_type). The supported types are the same as that forsearch_type.replace_rule (unsigned int) – The rule to set for the found link entity. All the rules supported for
search_ruleparameters are supported.search_list_and_update_list_string_array (hwStringList) –
A string array containing the list of search IDs/names/UIDs, and the list of replace IDs/names/UIDs.
The string has two pieces:
The first part is a search list of IDs/names/UIDs based on the
search_rule.The second part is a replace list of IDs/names/UIDs based on the
replace_rule.
search_list_length (unsigned int) – The number of strings/items in the search list. The replace list length = total_string_array_length - search_list_length.
replace_state (unsigned int) –
The flag to set for the link entity that specifies if you are connecting to mesh or to geometry. The supported values are:
0 - Undefined
1 - Connect to mesh
2 - Connect to geometry
keep_current_state (unsigned int) –
Optional option to keep the current connector state after the update operation. Valid states are:
0 - Unrealize if needed (default)
1 - Keep current state
At most, one of the “replace” data must be specified to see a change in the link attributes. If the replace data exactly matches the search data, the connector is not unrealized and no change is made to the link entity.
Examples#
Replace component with ID 1 with component group (IDs 3 and 4) across all displayed connectors#import hm import hm.entities as ent model = hm.Model() connectors = hm.CollectionByDisplayed(model, ent.Connector) search_list = [1] replace_list = [3, 4] string_list = ["1", "3", "4"] total_length = len(string_list) search_length = len(search_list) model.CE_MarkUpdateLinkGroup( collection=connectors, search_type=ent.Component, search_rule=2, replace_type=ent.Component, replace_rule=2, search_list_and_update_list_string_array=string_list, search_list_length=search_length, replace_state=0, keep_current_state=0 )
Replace component group (IDs 1 and 2) with component group (IDs 3 and 4) across all displayed connectors#import hm import hm.entities as ent model = hm.Model() connectors = hm.CollectionByDisplayed(model, ent.Connector) search_list = [1, 2] replace_list = [3, 4] string_list = ["1", "2", "3", "4"] total_length = len(string_list) search_length = len(search_list) model.CE_MarkUpdateLinkGroup( collection=connectors, search_type=ent.Component, search_rule=2, replace_type=ent.Component, replace_rule=2, search_list_and_update_list_string_array=string_list, search_list_length=search_length, replace_state=0, keep_current_state=0 )
Update the link rule of component group (IDs 1 and 2) to “use name” across all displayed connectors#import hm import hm.entities as ent model = hm.Model() connectors = hm.CollectionByDisplayed(model, ent.Connector) search_list = [1, 2] replace_list = [] string_list = ["1", "2"] total_length = len(string_list) search_length = len(search_list) model.CE_MarkUpdateLinkGroup( collection=connectors, search_type=ent.Component, search_rule=2, replace_type=ent.Component, replace_rule=3, search_list_and_update_list_string_array=string_list, search_list_length=search_length, replace_state=0, keep_current_state=0 )