Balaji thank you for your suggestions. I tried them all and the dimension still is not updated on the screen. What I want to do is something like selecting a dimension from the drawing, opening the properties window and changing the dimension overall dimscale. The dimension entity is updated immediately after. Here is my code, if you could say what I am doing wrong I will really appreciate. Thanks in advance.
Try
Using Trans As Transaction = HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction
peo = New PromptEntityOptions(vbCrLf & "Please select a dimension: ")
peo.SetRejectMessage("Please select dimensions only.")
peo.AddAllowedClass(GetType(Dimension), False)
peo.AddAllowedClass(GetType(AlignedDimension), False)
peo.AddAllowedClass(GetType(RotatedDimension), False)
peo.AddAllowedClass(GetType(ArcDimension), False)
peo.AddAllowedClass(GetType(RadialDimension), False)
peo.AddAllowedClass(GetType(OrdinateDimension), False)
per = Ed.GetEntity(peo)
If per.Status = PromptStatus.OK Then
Id = per.ObjectId
Else
Return False
End If
BlkTbl = CType(Trans.GetObject(Db.BlockTableId, OpenMode.ForRead), BlockTable)
BlkTblr = CType(Trans.GetObject(BlkTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite), BlockTableRecord)
Ent = CType(Trans.GetObject(Id, OpenMode.ForWrite), Entity)
If TypeOf (Ent) Is AlignedDimension Then
AlignDim = CType(Ent, AlignedDimension)
AlignDim.Dimscale = NewDimScale
ElseIf TypeOf (Ent) Is RotatedDimension Then
RotatedDim = CType(Ent, RotatedDimension)
RotatedDim.Dimscale = NewDimScale
ElseIf TypeOf (Ent) Is ArcDimension Then
ArcDim = CType(Ent, ArcDimension)
ArcDim.Dimscale = NewDimScale
ElseIf TypeOf (Ent) Is RadialDimension Then
RadialDim = CType(Ent, RadialDimension)
RadialDim.Dimscale = NewDimScale
ElseIf TypeOf (Ent) Is OrdinateDimension Then
OrdinateDim = CType(Ent, OrdinateDimension)
OrdinateDim.Dimscale = NewDimScale
End If
Ent.Draw()
Trans.Commit()
Trans.TransactionManager.QueueForGraphicsFlush()
Application.DocumentManager.MdiActiveDocument.SendStringToExecute("DIMREGEN", True, False, False)
Application.DocumentManager.MdiActiveDocument.SendStringToExecute("REGEN", True, False, False)
Autodesk.AutoCAD.Internal.LayerUtilities.RegenLayers({Ent.LayerId}, Autodesk.AutoCAD.Internal.LayerUtilities.RegenPending)
End Using
Return True
Catch ex As Exception
MessageBox.Show(ex.Message, "DimScale Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
DocLock.Dispose()
End Try