Drop element Line String

I use microstation 08.11.09.578, DGN 2D V7 Upgrade V8

I use C# language

I want to break the LineString association into separate LineStrings as shown below

ElementScanCriteria _MSesc = new ElementScanCriteriaClass();
_MSesc.ExcludeAllTypes();
_MSesc.IncludeType(MsdElementType.LineString);

ElementEnumerator oEnumeration = app.ActiveModelReference.Scan(_MSesc);

while (oEnumeration.MoveNext())
{
    oEnumeration.Current.AsLineElement().AsDroppableElement().Drop();

}

I tried but it gives error "Specified cast is not valid"

Parents Reply Children
No Data