Model.CE_MarkUpdateLinkMark#
- Model.CE_MarkUpdateLinkMark(collection, search_collection, replace_type, replace_rule, replace_state, string_array, keep_current_state=0)#
Allows search and replace of existing links in the specified connectors with new link information.
- Parameters:
collection (Collection) – The collection containing the connector entities.
search_collection (Collection) – The collection containing the entities to search in the connector. This must be specified. The supported entities are Component, Property, Surface, Tag, Element, Node and Part.
replace_type (EntityFullType) –
If specified with IDs/names/UIDs in the
string_array, existing links insearch_collectionget replaced with the new information. The supported entities are Component, Property, Surface, Tag, Element, Node and Part.If specified with no IDs/names/UIDs in the
string_array, existing links insearch_collectionget converted to thereplace_type. The supported entities are Component, Property and Part.replace_rule (unsigned int) –
If specified with IDs/names/UIDs in the
string_array, existing links insearch_collectionget replaced with the new information. If specified with no IDs/names/UIDs in thestring_array, existing links insearch_collectionget converted to thereplace_rule.The following codes define the different rules:
0 - Undefined
1 - None
2 - Use ID
3 - Use name
4 - Proximity
5 - Use UID
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
string_array (hwStringList) –
A string array containing the list of new IDs/names/UIDs.
The strings are generally IDs/names/UIDs based on the
replace_rule.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#
Convert component links with IDs 1-10 to part links across all displayed connectors#import hm import hm.entities as ent model = hm.Model() connectors = hm.Collection(model, ent.Connector, [1, 2, 4]) components = hm.Collection(model, ent.Component, list(range(1, 11))) model.CE_MarkUpdateLinkMark( collection=connectors, search_collection=components, replace_type=ent.Part, replace_rule=0, replace_state=0, string_array=None, keep_current_state=0 )
Convert link rule for component links with IDs 1-10 to “use-name” across all displayed connectors#import hm import hm.entities as ent model = hm.Model() connectors = hm.Collection(model, ent.Connector, [1, 2, 4]) components = hm.Collection(model, ent.Component, list(range(1, 11))) model.CE_MarkUpdateLinkMark( collection=connectors, search_collection=components, replace_type=ent.Component, replace_rule=3, replace_state=1, string_array=None, keep_current_state=0 )
Convert component links with IDs 1-10 to “geom” across all displayed connectors#import hm import hm.entities as ent model = hm.Model() connectors = hm.Collection(model, ent.Connector, [1, 2, 4]) components = hm.Collection(model, ent.Component, list(range(1, 11))) model.CE_MarkUpdateLinkMark( collection=connectors, search_collection=components, replace_type=ent.Component, replace_rule=0, replace_state=2, string_array=None, keep_current_state=0 )
Replace component with ID 1 with component group (IDs 2 and 3) across all displayed connectors#import hm import hm.entities as ent model = hm.Model() connectors = hm.Collection(model, ent.Connector, [1, 2, 4]) components = hm.Collection(model, ent.Component, [1]) model.CE_MarkUpdateLinkMark( collection=connectors, search_collection=components, replace_type=ent.Component, replace_rule=2, replace_state=0, string_array=["2", "3"], keep_current_state=0 )