Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4331

C# Remove Element using OpenDesignFile

$
0
0

I am using MicroStation V8i

This is a windows executable

void Remove_Element(string sPath, int iLevel)
{
    MicroStationDGN.Application app = new MicroStationDGN.Application();

    DesignFile dgnfile = app.OpenDesignFile(sPath, false, MsdV7Action.msdV7ActionUpgradeToV8);
    ElementScanCriteria _MSesc = new ElementScanCriteria();

    _MSesc.ExcludeAllTypes();
    _MSesc.IncludeType(MsdElementType.msdElementTypeText);
    _MSesc.IncludeType(MsdElementType.msdElementTypeLine);

    _MSesc.ExcludeAllLevels(); 
    _MSesc.IncludeLevel(app.ActiveModelReference.Levels.FindByNumber(iLevel));

    _Element Objectt;
    ElementEnumerator ele = app.ActiveModelReference.Scan(_MSesc);

    while (ele.MoveNext())
    {
        Objectt = ele.Current;
        Objectt.ModelReference.RemoveElement(ele.Current);
    }
    
    dgnfile.Save();
    dgnfile.Close();
}

i want to delete the element but i can't, the elements are not removed


Viewing all articles
Browse latest Browse all 4331

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>