> Public Sub CreateDrawingCallback(ByVal RemoveLayers As Generic.List(Of String))
>
> 'Determine the currently active document
> Dim ActiveDoc As Document = Application.DocumentManager.MdiActiveDocument
>
> 'Create drawings and remove excessive layers
> For Each Template As BaseTemplate In Templates
>
> 'Create document object
> Dim Docs As DocumentCollection = Application.DocumentManager
> Dim Dwg As Document = Docs.Add(Template.TemplatePath)
>
> 'Remove objects identified on specified layers and update properties
> Using trn As Transaction = Dwg.TransactionManager.StartTransaction
>
> Dim bt As BlockTable = trn.GetObject(Dwg.Database.BlockTableId, OpenMode.ForWrite, False)
> Dim btrModelSpace As BlockTableRecord = trn.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite, False)
>
> Dim bteEntities As BlockTableRecordEnumerator = btrModelSpace.GetEnumerator
>
@Anonymous wrote:
Woops... I found this one... I forgot to lock the document. It all works now... Thanks!
I am trying to use parts of your code in the previous post. Where did you place the document lock. Can you post the solution with the document lock?