VB.net中为何DimensionText取不到值?
本帖最后由 wyqzm 于 2014-1-11 17:34 编辑Dim db As Database = HostApplicationServices.WorkingDatabase
Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
Dim optSel As New PromptSelectionOptions
optSel.MessageForAdding = vbCrLf & "请选择对象:"
Dim resSel As PromptSelectionResult = ed.GetSelection(optSel)
Dim sSeT As SelectionSet = resSel.Value
Dim ids As ObjectId() = sSeT.GetObjectIds()
Using trans As Transaction = db.TransactionManager.StartTransaction()
For Each sSetEntId As ObjectId In ids
Dim en As Entity = trans.GetObject(sSetEntId, OpenMode.ForWrite)
ed.WriteMessage(vbCrLf & "你选择的是: " & en.GetType().Name)
Select Case en.GetType().Name
Case "RotatedDimension"
Dim ent As Dimension = en
ed.WriteMessage(vbCrLf & "标注文字:" & ent.DimensionText)‘这句得到的文字为空,为什么?’
Case Else
MsgBox("other")
End Select
Next
trans.Commit()
End Using写: ent.DimensionText = “1234567890” ,倒是正常的,请请教!
若尺寸被改写,DimensionText才会有值,否则是空,相当于使用命令编辑尺寸时看到的<> sieben 发表于 2014-1-11 22:05 static/image/common/back.gif
若尺寸被改写,DimensionText才会有值,否则是空,相当于使用命令编辑尺寸时看到的
谢谢,我已经明白了,不是DimensionText,而是Measurement,已经解决。
页:
[1]