Slow performance deleting many sketch segments at once

Hello,

I'm currently fighting with a performance issue and I hope to find a way to improve that.

I'm currently working on a macro that cleans up the active sketch in a part which is imported geometry. That sketch contains 38,000 (in other cases even more) sketch segments of different types. I cannot provide an example here as it is very detailed customer data but maybe still someone has a good approach.

The selecting part is quiet easy. I filter the unwanted elements by type, length etc. and select them and that only takes a few seconds for many thousand elements.

But then when deleting the geometry this takes a long time, e.g. 12min for 26,000 elements (just lines and arcs so far).

Here is what I checked / tried to improve the performance:

- there is not even one sketch relation in that sketch
- automatic solve is disabled
- the image quality of the document is very low
- I tested both ModelDocExtension::DeleteSelection2 and ModelDoc2::EditDelete
- I've set ModelView::EnableGraphicsUpdate to false
- I've set ModelDoc2::Visible to false
- I've set SketchManager::AddToDb to true
- I've set SketchManager::DisplayWhenAdded to false
- I moved the sketch geometry out of the visible part in the graphics area
- I've rotated the view 90° so that my view is parallel to the sketch plane
- I minimized the SOLIDWORKS window

Is there anything else that could make that run faster?

Thanks in advance.

Kind regards
Ronny

SolidworksApi/macros