Adding a new layer will remove previous layer automatically
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
I have a customized app developed for AutoCad 2012(using acmgd.dll and acdbmgd.dll). As part of a ReBuild Dwg feature, I'm trying to erase all the entities and layers from the working DB and recreate all of them again.
Steps:
1. Erase all the existing layers and objects from the database.
2. Create all the layers again and add the objects to the layers programatically as shown below.
Using ltr As LayerTableRecord = New LayerTableRecord()
ltr.Name = LayerName
ltr.Color = AePlan.AutoCAD.CAcadColor.WindowsColor2AcadColor(LayerWindowsColor)
lt.UpgradeOpen()
layerId = lt.Add(ltr)
trans.AddNewlyCreatedDBObject(ltr, True)
End Using
This function works fine till creation of 3 to 4 layers. But during the creation of 5th layer(after executing layerId = lt.Add(ltr)), very strangely one of the previously created layers will be removed randomly from the database.
Example: lt.Has(1st Layer) returns false and also lt.Item(1st layer name) throws exception
This is very annoying as my rebuild dwg feature has snowball effect and fails miserably due to this unexpected behavior. I tried all over the internet but couldn't find a solution. Any help or suggestion is galdly welcomed.
Thanks in advance,
Prashanth