Hi Tim,
Here is the code I got to work. It's very simple, just pass in the ObjectID of a dimension.
There is no error checking in this.
Public Shared Sub ChangeDimension(ByVal MyDim As ObjectId)
' This code will overide the current dimension setting the alternative units to true
' Setting the precision of the alternative units to 2 and giving the alternative units
' a prefix of the symbol for diameter
Dim myDwg As Document = DocumentManager.MdiActiveDocument
Using myTrans As Transaction = myDwg.TransactionManager.StartTransaction
Using (myDwg.LockDocument())
'Open the database for Read
Dim myBT As BlockTable = myDwg.Database.BlockTableId.GetObject(OpenMode.ForRead)
'Open ModelSpace for Write
Dim myBTR As BlockTableRecord = myBT(BlockTableRecord.ModelSpace).GetObject(OpenMode.ForWrite)
Dim NewDim As Dimension = TryCast(myTrans.GetObject(MyDim, OpenMode.ForWrite), Dimension)
NewDim.Dimalt = True
NewDim.Dimaltd = 2
NewDim.Dimapost = "%%C[]"
'Commit the transaction
myTrans.Commit()
End Using
End Using
End Sub
Thank again for your help.
Mick