AutoCAD Map 3D Developer
Welcome to Autodesk’s AutoCAD Map 3D Developer Forums. Share your knowledge, ask questions, and explore popular AutoCAD Map 3D Developer topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

vb.net - delete all entities ?

1 REPLY 1
Reply
Message 1 of 2
jan_tappenbeck
595 Views, 1 Reply

vb.net - delete all entities ?

HI !

 

could someone tell me how to delete all entities in the modellspace ?

 

reagards Jan

1 REPLY 1
Message 2 of 2

Only saying VB.NET does not provide enough details/information for others to help. Which API do you want to use (COM or .NET), what context the actual deleting code you are going to put into (i.e. do you know how to make the code work if a few line of COM or .NET code is provided)? Anyway, here is afew line of code using .NET API

 

Public Sub DleteleEntitiesInModel(Document dwg)

  

  Using tran As Transaction=dwg.StartTransaction() 

    ObjectId spaceId=SymbolUtilityServices.GetBlockModelSpaceId(dwg.Database)

    Dim space As BlockTableRecord = DirectCast( _

      tran.GetObject(spaceId, OpenMode.ForRead), BlockTableRecord)

    For Each id As ObjectId in space

      Dim ent As Entity=DirectCast(tran.GetObject(id, OpenMode.ForWrite), Entity)

      ent.Erase()

    Next

    tran.Commit();

  End Using

 

End Sub

 

Assume you know how to incorporate into your application project

Norman Yuan

Drive CAD With Code

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost