Model.CE_AddLinkEntitiesDirectByRule#

Model.CE_AddLinkEntitiesDirectByRule(collection, link_type, link_rule, link_state, link_string_array, extra_link_integer_array, create_group)#

Allows the user to add link directly to the connectors without considering tolerance or number of layers.

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

  • link_type (EntityFullType) – The entity type to be added to the connectors as links.

  • link_rule (unsigned int) –

    The rule by which the link entity is added to the connector. If the rule is specified, the modification is performed in accordance with the rule. For example, a value of 2 requires link IDs to be specified for link_string_array. Valid values are:

    0 - Undefined

    1 - None

    2 - Use ID

    3 - Use Name

    4 - Proximity

    5 - Use UID

  • link_state (unsigned int) –

    The state of the link entity which is to be added:

    0 - Undefined

    1 - Elems

    2 - Geom

  • link_string_array (hwStringList) – A list of strings containing the list of link IDs/names/UIDs to be added directly to connectors. The strings are generally IDs/names/UIDs based on the link_rule.

  • extra_link_integer_array (hwIntList) – A list of integers containing the list of extra link additions allowed for spots and seams. The integers are generally IDs/UIDs based on the link_rule.

  • create_group (unsigned int) –

    0 - Add the newly chosen links separately to the connector

    1 - Add the newly chosen links as a group to the connector

Example#

Add two component links (ID 1 and 2) directly to connector with ID 2 of type spot using without creating a group link#
import hm
import hm.entities as ent

model = hm.Model()

model.CE_AddLinkEntitiesDirectByRule(
    collection=hm.Collection(model, ent.Connector, [1, 2]),
    link_type=ent.Component,
    link_rule=2,
    link_state=1,
    link_string_array=["1", "2"],
    extra_link_integer_array=["2", "2"],
    create_group=0,
)