with all respect, you approach (and consequently your code) is wrong from several reasons.

As Jon explained, it's not good idea to create new elements in element enumerator. The scan enumerator caches only a few elements and when it's necessary, it reads a next part of DGN file. So when you create a new element (or you modify existing element in such way it has to be moved the end of the file; because of its size change), the enumerator will read also this newly created element, which is never correct.

But what is more important: To create a new element and to remove the old one is completely wrong in my opinion. In fact you do not round line elements, but you create lines copies with rounded vertices. But the result elements are not the same, e.g. ElementIDs are different ... which can be a critical issue in some scenarios.

This code (structured to single response subs and functions, which I prefer), should work:

ElementnEnumerator is a tool that can be used to iterate model (active or reference). So when talking about scanning model, the enumerator is the tool that do it.

Main features of enumerator (it's common to many programming languages) are:

You can go by one step forward only.

There is no index.

It will stop at the end of a list / collection (model in the discussed case).

So the definition is not "it will run once only", but "it will stop at the end of the model". But "end of the model" is not fixed, so when you add elements during scanning or modify existing element and change its size, so it has to be rewritten to the end of the file, the end is moving.