明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1178|回复: 2

[基础] VB.net中为何DimensionText取不到值?

[复制链接]
发表于 2014-1-11 17:30 | 显示全部楼层 |阅读模式
本帖最后由 wyqzm 于 2014-1-11 17:34 编辑
  1.         Dim db As Database = HostApplicationServices.WorkingDatabase
  2.         Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
  3.         Dim optSel As New PromptSelectionOptions
  4.         optSel.MessageForAdding = vbCrLf & "请选择对象:"

  5.         Dim resSel As PromptSelectionResult = ed.GetSelection(optSel)
  6.         Dim sSeT As SelectionSet = resSel.Value
  7.         Dim ids As ObjectId() = sSeT.GetObjectIds()
  8.         Using trans As Transaction = db.TransactionManager.StartTransaction()
  9.             For Each sSetEntId As ObjectId In ids
  10.                 Dim en As Entity = trans.GetObject(sSetEntId, OpenMode.ForWrite)
  11.                 ed.WriteMessage(vbCrLf & "你选择的是: " & en.GetType().Name)
  12.                 Select Case en.GetType().Name
  13.                     Case "RotatedDimension"
  14.                         Dim ent As Dimension = en
  15.                         ed.WriteMessage(vbCrLf & "标注文字:" & ent.DimensionText)  ‘这句得到的文字为空,为什么?’
  16.                     Case Else
  17.                         MsgBox("other")
  18.                 End Select
  19.             Next
  20.             trans.Commit()
  21.         End Using
写: ent.DimensionText = “1234567890” ,倒是正常的,请请教!

发表于 2014-1-11 22:05 | 显示全部楼层
若尺寸被改写,DimensionText才会有值,否则是空,相当于使用命令编辑尺寸时看到的<>
 楼主| 发表于 2014-1-11 23:13 | 显示全部楼层
sieben 发表于 2014-1-11 22:05
若尺寸被改写,DimensionText才会有值,否则是空,相当于使用命令编辑尺寸时看到的

谢谢,我已经明白了,不是DimensionText,而是Measurement,已经解决。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-17 12:18 , Processed in 0.175917 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表