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
  • I use microstation 08.11.09.578, DGN 2D V7 Upgrade V8

    What do you mean by 'DGN 2D V7 Upgrade V8'?

    MicroStation's native file format is a DGN file.  A file contains DGN models.  A model can be 2D or 3D.  A DGN file is neither 2D nor 3D.

    A previous version of MicroStation used a different file format that is referred to as V7.  See the History of MicroStation.

    Upgrade V8 is meaningless.

    I use C# language

    When you write C# code for MicroStation V8i then you are calling the VBA COM interface.  Prefer to develop your prototype using just VBA. 

    That way you...

    1. Avoid incompatibilities in programming languages
    2. Enable us to test code fragments directly when you post them here
    3. Port your code to C# once it works correctly
    I want to break the LineString association into separate LineStrings

    A VBA LineElement implements the VertexList interface.  Get that list and create a new LineElement for each pair of vertices in that list.

     
    Regards, Jon Summers
    LA Solutions

  • A VBA LineElement implements the VertexList interface.  Get that list and create a new LineElement for each pair of vertices in that list.

    Good idea, thanks

Reply Children