Boolean op. on different types of groups

Hi,

Are there any TUI commands that add all SOLIDS and COMPOUNDS to a list to enable boolean operations on them? Writing a loop to create the text below is not a useful method.

An example;
Fuse_1_objects_1 = [model.selection(“SOLID”, “solids_A_1”),
model.selection(“SOLID”, “solids_A_2”),
model.selection(“SOLID”, “solids_A_3”),
.
.
.
model.selection(“COMPOUND”, “Comp_A_1”),
model.selection(“COMPOUND”, “Comp_A_2”),
model.selection(“COMPOUND”, “Comp_A_3”),
.
.
.
model.selection(“SOLID”, “solids_B_1”),
model.selection(“SOLID”, “solids_B_2”),
model.selection(“SOLID”, “solids_B_3”),
.
.
.
model.selection(“COMPOUND”, “Comp_B_1”),
model.selection(“COMPOUND”, “Comp_B_2”),
model.selection(“COMPOUND”, “Comp_B_3”), … )]
Fuse_1 = model.addFuse(Part_1_doc, Fuse_1_objects_1, keepSubResults = False)

To;
Fuse_1_objects_1 = [model.selection(“SOLID”, “list_of_solids”),
model.selection(“COMPOUND”, “list_of_comp”)]
Fuse_1 = model.addFuse(Part_1_doc, Fuse_1_objects_1, keepSubResults = False)

I use the method down below.

object_names_1 = [f"obj_1_{i}" for i in range(counter1)]
object_names_2 = [f"obj_2_{i}" for i in range(counter2)]

fuse_objects1 = [model.selection(“SOLID”, name) for name in object_names_1]
Fuse_1 = model.addFuse(Part_1_doc, fuse_objects1, removeEdges = True, keepSubResults = True)
Fuse_1.result().setName(“Fuse1”)
fuse_objects2 = [model.selection(“COMPOUND”, name) for name in object_names_2]
Fuse_2 = model.addFuse(Part_1_doc, fuse_objects2, removeEdges = True, keepSubResults = True)
Fuse_2.result().setName(“Fuse2”)
Fuse_101 = model.addFuse(Part_1_doc, [model.selection(“SOLID”, “Fuse1”),model.selection(“COMPOUND”, “Fuse2”)], keepSubResults = True)
Fuse_101.result().setName(“FuseAll”)

Regards,
Said

Hi,

to get the first level of result, you can call

Feature_1.results()

or select them with all-in prefix:

model.selection(“COMPOUND”, “all-in-Feature_1”),

If you want all the solids of an assembly result, you can use a loop on a feature’s results like in
test_get_results.py (3,0 Ko)

Christophe

1 Like