Hi Diego,
If you are only interested in the geometry of all the elements in the group, this shouldn't be a problem.
As you already noticed, the result of the selection is not the element group directly (it is not possible in ALLPLAN to select an element group) but an element belonging to this group. You can get the group with the parent element service, as you did. Then you can use the ChildElementsService to get all the elements belonging to this group.
Here's a small code-snippet with a ScriptObject, that does exactly this and prints the selected groups and all the elements belonging to them (regardless, which elements were selected):
class ExampleScriptObjectInteractor(BaseScriptObject):
def __init__(self,
build_ele: BuildingElement,
script_object_data: BaseScriptObjectData):
"""Default constructor"""
super().__init__(script_object_data)
self.build_ele = build_ele
self.selection_result = MultiElementSelectInteractorResult()
def execute(self) -> CreateElementResult:
"""Execute the element creation"""
return CreateElementResult()
def start_input(self):
self.script_object_interactor = MultiElementSelectInteractor(
prompt_msg="Select elements",
interactor_result = self.selection_result,
)
def start_next_input(self):
self.script_object_interactor = None
ele_group_filter_function = AllplanIFW.QueryTypeID(AllplanEleAdapter.ElementGroup_TypeUUID)
parent_elements = [AllplanEleAdapter.BaseElementAdapterParentElementService.GetParentElement(ele) for ele in self.selection_result.sel_elements]
ele_group_filter = filter(ele_group_filter_function, parent_elements)
selected_groups = AllplanEleAdapter.BaseElementAdapterList(list(ele_group_filter))
print("Selected groups:")
for i, group in enumerate(selected_groups):
print(f"{i}. {group.GetModelElementUUID() }")
children = AllplanEleAdapter.BaseElementAdapterChildElementsService.GetChildElements(group, True)
for child in children:
print(f" - {child.GetElementAdapterType().GetTypeName()} ({child.GetModelElementUUID() })")
As you can see above, I used the QueryTypeID object as filtering function to get only the ElementGroup_TypeUUID objects. You can do it, because it's callable.
I hope that helps.
Cheers,
Bart