Model.CE_MarkUpdateLink#
- Model.CE_MarkUpdateLink(collection, search_entity, search_name, search_rule, replace_entity, replace_name, replace_rule, replace_state)#
Allows search and replace of an existing link in the specified connector collection with a new link entity.
- Parameters:
collection (Collection) – The collection containing the connector entities.
search_entity (Entity) – The object describing the entity to search in the connector. This must be specified. The supported entities are Component, Property, Surface, Tag, Element, Node and Part.
search_name (hwString) –
The name of the link entity to replace in the connector. The name is optional only if one of the following is true:
1 - None
2 - Use ID
4 - Proximity
5 - Use UID
search_rule (unsigned int) –
The rule by which the link entity was added to the connector. The following codesmdefine the different rules:
0 - Undefined
1 - None
2 - Use ID
3 - Use name
4 - Proximity
5 - Use UID
If the rule is specified, the entity search is performed in accordance with the rule.
For example, a search_rule of 2 requires search_id.
replace_entity (Entity) – The object describing the entity.
replace_name (hwString) – The entity Name that replaces the found link entity. If not specified, the entity name information is not replaced for the found link (replace_name =
search_name).replace_rule (unsigned int) – The rule to set for the found link entity. All the rules supported for
search_ruleparameters are supported.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
Examples#
Replace component with ID 10 with component with ID 20 for displayed connectors#import hm import hm.entities as ent model = hm.Model() connectors = hm.CollectionByDisplayed(model, ent.Connector) model.CE_MarkUpdateLink( ce_collection=connectors, search_entity=ent.Component(model, 10), search_name=1, search_rule=0, replace_entity=ent.Component(model, 20), replace_name="", replace_rule=0, replace_state=0 )
Replace component with name “comp1” with component with name “bumper” for displayed connectors#import hm import hm.entities as ent model = hm.Model() connectors = hm.CollectionByDisplayed(model, ent.Connector) model.CE_MarkUpdateLink( ce_collection=connectors, search_entity=None, search_name="comp1", search_rule=0, replace_entity=None, replace_name="bumper", replace_rule=0, replace_state=0 )
Replace use ID with use name rule for component with ID 10 for displayed connectors#import hm import hm.entities as ent model = hm.Model() connectors = hm.CollectionByDisplayed(model, ent.Connector) model.CE_MarkUpdateLink( ce_collection=connectors, search_entity=ent.Component(model, 10), search_name=, search_rule=2, replace_entity=None, replace_name="", replace_rule=3, replace_state=0 )
Replace the state for component with ID 10 for displayed connectors from “connect to elems” to “connect to geom”#import hm import hm.entities as ent model = hm.Model() connectors = hm.CollectionByDisplayed(model, ent.Connector) model.CE_MarkUpdateLink( ce_collection=connectors, search_entity=ent.Component(model, 10), search_name=, search_rule=0, replace_entity=None, replace_name="", replace_rule=0, replace_state=2 )
Note
Note that in all of the above cases, the connector entity is unrealized and any existing welds are removed from the connector. 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.