AutoCAD 2016 API Dimension Reference BUG

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I tried to figure it out but cannot. For some reason AutoCAD 2016 fails to maintain reference when deleting an item from a block. I added two dimension objects into a block and when I delete one autocad loses reference of an item. Can anyone please help. Below is the code. Thanks.
Sub DimensionBug()
Dim ACADBlock As ACADBlock
Dim ACADReference As AcadBlockReference
Dim Origin(2) As Double
Dim Dimension As AcadDimRotated
Dim Point1(2) As Double
Dim Point2(2) As Double
Dim Point3(2) As Double
Point2(0) = 10
Point3(1) = 10
Set ACADBlock = ThisDrawing.Blocks.Add(Origin, "NameMe1")
Set Dimension = ACADBlock.AddDimRotated(Point1, Point2, Point3, 0)
Set Dimension = ACADBlock.AddDimRotated(Point1, Point2, Point3, 0)
Set ACADReference = ThisDrawing.ModelSpace.InsertBlock(Origin, "NameMe1", 1, 1, 1, 0)
MsgBox ACADReference.Name
ACADBlock.Item(1).Delete
MsgBox ACADReference.Name
End Sub