I want to dimension objects z values to zero.
dimension's point(start/end) is remain unchanged.
Microsoft Visual Studio 2010, Target .NET Framework = 2.0
<CommandMethod("dimtest")> _
Public Sub GetDim()
Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database
Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
Try
Using acTr As Transaction = db.TransactionManager.StartTransaction
Dim peo As New PromptEntityOptions(vbLf & "Select a Dimension:")
peo.SetRejectMessage(vbLf & "Select Dimension only")
peo.AddAllowedClass(GetType(Dimension), False)
Dim res As PromptEntityResult
res = ed.GetEntity(peo)
If res.Status <> PromptStatus.OK Then
Return
End If
Dim ent As Entity = CType(acTr.GetObject(res.ObjectId, OpenMode.ForRead), Entity)
If ent Is Nothing Then
Return
End If
Dim diment As Dimension = TryCast(CType(ent, Dimension), Dimension)
If diment Is Nothing Then
ed.WriteMessage(vbLf & "Error: selected entity is not a Dimension")
Return
End If
With diment
.UpgradeOpen()
.Elevation = 0
.DowngradeOpen()
End With
acTr.Commit()
End Using
Catch ex As Exception
End Try
End Sub