Model.CE_ConvertLinksByMark#

Model.CE_ConvertLinksByMark(collection, target_entity_type, link_index, target_link_rule=0, target_link_state=0, keep_current_state=0)#

Converts connector links to a new entity type.

Parameters:
  • collection (Collection) – The collection containing the connector entities to update.

  • target_entity_type (EntityFullType) – The entity type to which the link is converted. Valid values are components, properties and parts.

  • link_index (int) –

    The index of the link to be converted, starting from 0.

    -1 - all links are converted

  • target_link_rule (int) –

    The optional rule to set for the converted link entity. Valid rules are:

    0 - Undefined

    1 - None

    2 - Use ID

    3 - Use name

    4 - Proximity

    5 - Use UID

  • target_link_state (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

Examples#

Convert all displayed connectors at link index 0 to part links#
import hm
import hm.entities as ent

model = hm.Model()

model.CE_ConvertLinksByMark(
    collection=hm.CollectionByDisplayed(model, ent.Connector),
    target_entity_type=ent.Part,
    link_index=0,
)
Convert all links of connector with ID 3 to part links#
import hm
import hm.entities as ent

model = hm.Model()

model.CE_ConvertLinksByMark(
    collection=hm.Collection(model, ent.Connector,[3]),
    target_entity_type=ent.Part,
    link_index=-1,
)
Convert all links of displayed connectors to part links using the UID rule#
import hm
import hm.entities as ent

model = hm.Model()

model.CE_ConvertLinksByMark(
    collection=hm.CollectionByDisplayed(model, ent.Connector),
    target_entity_type=ent.Part,
    link_index=-1,
    target_link_rule=5,
)