Can I speed up retrieval of SubShape IDS for faces from a solid in a CAD composed of this solid + others?

Hi,
I’ve a complex geometry CAD with 2 solids and a lot of faces.
I would like to somehow sort faces of CAD depending on which solid they lay
In GEOM module I’ve tried this to get the IDs (in CAD) of the faces laying on Solid1:

_faces = _geompy.ExtractShapes(Solid1, _geompy.ShapeType["FACE"])
_faces_ids = [ _geompy.GetSubShapeID(CAD, sub_face) for sub_face in _faces]

It works but it’s a very long operation.
Are there ways to perform the same operations more rapidly?

Any suggestions?
Best

Hi Christophe,

indeed, that is the purpose of GetSubShapesIDs(). Try:

_faces_ids = _geompy.GetSubShapesIDs(CAD, _faces )

Best regards,

Christophe

Thanks @cbourcier

Do you have any recommendation in terms of perf on when selecting subshape by type:
_faces = _geompy.SubShapeAll(solid1, _geompy.ShapeType[“FACE”])
_faces = _geompy.ExtractShapes(solid1, _geompy.ShapeType[“FACE”])

which method is more suited?

SubShapeAll sould be faster since there is no sorting algorithm, whereas there is one in ExtractShapes as stated in Sorting Shapes Algorithm.