Element grouping¶
Read and manage element groups and element sets, including group membership, group data and suspended-group mode.
Access this group through api.tapir.element_grouping.
Commands¶
No commands match. Try another name or clear the filter.
For exceptions shared by Unified API commands, see error handling.
create_element_sets ¶
create_element_sets(
element_sets: list[ElementSetData],
) -> list[ElementSetIdArrayItem | ErrorItem]
Creates element sets of the given elements. An element set is a hidden, persistent collection of elements (it is not a group and has no effect on selection or editing).
Parameters:
-
element_sets(list[ElementSetData]) –The element sets to create.
Returns:
-
list[ElementSetIdArrayItem | ErrorItem]–The identifier of each created element set, or an error, in the order of the input.
create_groups ¶
create_groups(
element_groups: list[ElementGroupParameters],
) -> list[ErrorItem | GroupIdArrayItem]
Creates groups of the passed elements
Parameters:
-
element_groups(list[ElementGroupParameters]) –A list of element groups to create.
Returns:
-
list[ErrorItem | GroupIdArrayItem]–The results of the group creation operations.
delete_element_sets ¶
delete_element_sets(
element_sets: list[ElementSetIdArrayItem],
) -> list[
FailedExecutionResult | SuccessfulExecutionResult
]
Deletes the given element sets. The elements of a set are not deleted. Only element sets created by the Tapir Add-On can be deleted; sets created by other add-ons are reported as failed. With dryRun true nothing is deleted and no undo step is created: the response has dryRun set to true, and each element set that a real run would delete gets wouldDelete.
Parameters:
-
element_sets(list[ElementSetIdArrayItem]) –The element sets to delete, as returned by CreateElementSets or GetElementSetsOfElements. Only element sets created by the Tapir Add-On can be deleted. The elements of a deleted set are not deleted.
Returns:
-
list[FailedExecutionResult | SuccessfulExecutionResult]–One result for each input element set, in the order of the input. On a dry run an element set that exists and was created by the Tapir Add-On gets wouldDelete.
delete_element_sets_dry_run ¶
delete_element_sets_dry_run(
element_sets: list[ElementSetIdArrayItem],
) -> DeleteElementSetsResult
Preview this command without applying its changes. Deletes the given element sets. The elements of a set are not deleted. Only element sets created by the Tapir Add-On can be deleted; sets created by other add-ons are reported as failed. With dryRun true nothing is deleted and no undo step is created: the response has dryRun set to true, and each element set that a real run would delete gets wouldDelete.
Parameters:
-
element_sets(list[ElementSetIdArrayItem]) –The element sets to delete, as returned by CreateElementSets or GetElementSetsOfElements. Only element sets created by the Tapir Add-On can be deleted. The elements of a deleted set are not deleted.
Returns:
get_all_elements_of_groups ¶
get_all_elements_of_groups(
groups: list[GroupIdArrayItem],
) -> list[ElementsWrapper | ErrorItem]
Gets all the elements of each given group, including the elements of its nested groups.
Parameters:
-
groups(list[GroupIdArrayItem]) –The groups to get all the elements of.
Returns:
-
list[ElementsWrapper | ErrorItem]–All the elements of each given group, including the elements of its nested groups, or an error.
get_auto_group_mode ¶
get_auto_group_mode() -> bool
Gets the current state of the Auto Group mode.
Returns:
-
bool–True if the Auto Group mode is currently on.
get_element_set_data ¶
get_element_set_data(
element_sets: list[ElementSetIdArrayItem],
) -> list[ElementSetDetails | ErrorItem]
Gets the elements and the custom data of each given element set. Element sets are created by add-ons to link elements together; the custom data is returned as Base64 encoded bytes.
Parameters:
-
element_sets(list[ElementSetIdArrayItem]) –The element sets to get the data of.
Returns:
-
list[ElementSetDetails | ErrorItem]–The data of each given element set, or an error.
get_element_sets_of_elements ¶
get_element_sets_of_elements(
elements: list[ElementIdArrayItem],
) -> list[ElementSetsOfElement | ErrorItem]
Gets the element sets that contain each given element. Only element sets created by the Tapir Add-On are examined; sets created by other add-ons are not found.
Parameters:
-
elements(list[ElementIdArrayItem]) –A list of elements.
Returns:
-
list[ElementSetsOfElement | ErrorItem]–The element sets that contain each given element, or an error, in the order of the input. Only element sets created by the Tapir Add-On are examined.
get_elements_of_groups ¶
get_elements_of_groups(
groups: list[GroupIdArrayItem],
) -> list[ElementsWrapper | ErrorItem]
Gets the elements directly contained by each given group.
Parameters:
-
groups(list[GroupIdArrayItem]) –The groups to get the elements of.
Returns:
-
list[ElementsWrapper | ErrorItem]–The elements directly contained by each given group, or an error.
get_groups_of_elements ¶
get_groups_of_elements(
elements: list[ElementIdArrayItem],
) -> list[ErrorItem | GroupIdArrayItem]
Gets the identifier of the group that directly contains each given element. Returns an error for elements that are not part of any group.
Parameters:
-
elements(list[ElementIdArrayItem]) –A list of elements.
Returns:
-
list[ErrorItem | GroupIdArrayItem]–The identifier of the group that directly contains each given element, or an error for elements that are not part of any group.
get_main_groups ¶
get_main_groups(
groups: list[GroupIdArrayItem],
) -> list[ErrorItem | GroupIdArrayItem]
Gets the top level group of each given group. A group that is not nested in another group is its own top level group.
Parameters:
-
groups(list[GroupIdArrayItem]) –The groups to get the top level group of.
Returns:
-
list[ErrorItem | GroupIdArrayItem]–The top level group of each given group (the group itself if it is not nested in another group), or an error.
get_suspend_groups_mode ¶
get_suspend_groups_mode() -> bool
Gets the current state of the Suspend Groups mode.
Returns:
-
bool–True if the Suspend Groups mode is currently on.
get_user_data_of_groups ¶
get_user_data_of_groups(
groups: list[GroupIdArrayItem],
) -> list[ErrorItem | GroupUserDataResult]
Gets the user data an add-on attached to each given group: its version, platform sign, flags and bytes (base64 encoded), and, when its version is 1 (the layout SetUserDataOfGroups writes), its key-value pairs. Returns an error for groups that have no user data.
Parameters:
-
groups(list[GroupIdArrayItem]) –The groups to get the user data of.
Returns:
-
list[ErrorItem | GroupUserDataResult]–The user data attached to each given group, or an error for groups that have none.
set_suspend_groups_mode ¶
set_suspend_groups_mode(
suspend_groups: bool,
) -> FailedExecutionResult | SuccessfulExecutionResult
Turns the Suspend Groups mode on or off. Suspend groups to perform operations on elements that are part of a group; remember to restore the previous state afterwards.
Parameters:
-
suspend_groups(bool) –Turn the Suspend Groups mode on or off.
Returns:
-
FailedExecutionResult | SuccessfulExecutionResult–The result of the execution.
set_user_data_of_groups ¶
set_user_data_of_groups(
groups: list[GroupIdArrayItem],
pairs: None | list[UserDataPair] = None,
keys_to_delete: None | list[str] = None,
) -> list[
FailedExecutionResult | SuccessfulExecutionResult
]
Stores string values under keys in the user data of groups, for scripts to keep their own state on a group. The given pairs are merged into what each group already holds: a key that exists gets the new value, other keys are left as they are, and the keys listed in keysToDelete are removed. Prefix the keys with the script's name so that scripts do not overwrite each other's data. User data in another layout is left unchanged and reported as an error. One undo step per call.
Parameters:
-
groups(list[GroupIdArrayItem]) –The groups to store the pairs on.
-
pairs(None | list[UserDataPair], default:None) –The key-value pairs to store on each group. A key the group already holds gets the new value; other keys are left as they are.
-
keys_to_delete(None | list[str], default:None) –The keys to remove from the user data. A key that is not stored is ignored. Applied after pairs.
Returns:
-
list[FailedExecutionResult | SuccessfulExecutionResult]–One result per group, in the input order.
ungroup_elements ¶
ungroup_elements(
groups: list[GroupIdArrayItem],
) -> list[
FailedExecutionResult | SuccessfulExecutionResult
]
Ungroups the given groups one level, like Edit > Grouping > Ungroup: each group is dissolved, the elements and subgroups it directly contains stay. A group nested in another group is reported as failed; ungroup the containing group first. Returns an execution result per group.
Parameters:
-
groups(list[GroupIdArrayItem]) –The groups to ungroup, as returned by CreateGroups or GetGroupsOfElements. A group nested in another group is reported as failed: ungroup the containing group first.
Returns:
-
list[FailedExecutionResult | SuccessfulExecutionResult]–A list of execution results.
Related types¶
These include the parameter and result models used inside the client. The command signatures above show what to pass and what is returned.
CreateElementSetsParametersCreateElementSetsResultCreateGroupsParametersCreateGroupsResultDeleteElementSetsParametersDeleteElementSetsResultGetAllElementsOfGroupsParametersGetAllElementsOfGroupsResultGetAutoGroupModeResultGetElementSetDataParametersGetElementSetDataResultGetElementSetsOfElementsParametersGetElementSetsOfElementsResultGetElementsOfGroupsParametersGetElementsOfGroupsResultGetGroupsOfElementsParametersGetGroupsOfElementsResultGetMainGroupsParametersGetMainGroupsResultGetSuspendGroupsModeResultGetUserDataOfGroupsParametersGetUserDataOfGroupsResultSetSuspendGroupsModeParametersSetSuspendGroupsModeResultSetUserDataOfGroupsParametersSetUserDataOfGroupsResultUngroupElementsParametersUngroupElementsResultElementGroupParametersElementIdArrayItemElementSetDataElementSetDetailsElementSetIdArrayItemElementSetsOfElementElementsWrapperErrorItemExecutionResultFailedExecutionResultGroupIdArrayItemGroupUserDataResultSuccessfulExecutionResultUserDataPair