乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 216|回复: 11

我哪里出错了-字段到区域(折线)。

[复制链接]

57

主题

235

帖子

3

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
463
发表于 2007-11-2 08:09:57 | 显示全部楼层 |阅读模式

本帖以下内容被隐藏保护;需要你回复后,才能看到!

游客,如果您要查看本帖隐藏内容请回复
回复

使用道具 举报

57

主题

235

帖子

3

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
463
发表于 2007-11-2 10:08:48 | 显示全部楼层
尝试编辑文本,然后选择编辑字段。当我这样做时,它显示*未知*。所以该字段的代码在某个地方是错误的。
回复

使用道具 举报

6

主题

103

帖子

2

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
127
发表于 2007-11-2 12:28:48 | 显示全部楼层

如果他使用MText而不是Text,为什么会有所不同?
回复

使用道具 举报

57

主题

235

帖子

3

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
463
发表于 2007-11-2 14:54:45 | 显示全部楼层
问题或错误在这一行:
我不使用vb/a,但尝试将字段代码更改为:
,正如您在代码中的某个位置所做的那样,取消注释。。。
回复

使用道具 举报

57

主题

235

帖子

3

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
463
发表于 2007-11-2 15:46:59 | 显示全部楼层
或者尝试/测试以下内容:
这将添加字段值....
回复

使用道具 举报

6

主题

103

帖子

2

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
127
发表于 2007-11-2 16:21:54 | 显示全部楼层
...仍然行不通。
回复

使用道具 举报

57

主题

235

帖子

3

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
463
发表于 2007-11-2 16:43:16 | 显示全部楼层

奇怪。。。这是我测试的代码...(我只是对你的原始代码做了一些小的改动)
  1. Public Sub AddAreaField()
  2. Dim Mytext As AcadText
  3. Dim entarea As Double
  4. Dim textObj As AcadEntity
  5. Dim text As String
  6. Dim fieldcode As String
  7. Dim insertionPoint(0 To 2) As Double
  8. Dim height As Double
  9. Dim NewArea As Double
  10. Dim OBJID As Variant
  11. Dim objEnt As AcadEntity
  12. Dim varPick As Variant
  13. Dim TXTID2 As AcadText
  14. Dim entObjectID As Long
  15. Dim sysVarName As Variant
  16. Dim VARDATA As Variant
  17. Dim returnpnt As Variant
  18. sysVarName = "dimscale"
  19. VARDATA = ThisDrawing.GetVariable(sysVarName)
  20.     Dim plineObj As AcadLWPolyline
  21.     Dim plineArea As Double
  22. ThisDrawing.Utility.GetEntity objEnt, varPick, vbCr & "Select object for Area: "
  23. entObjectID = objEnt.ObjectID
  24. Set plineObj = objEnt
  25. MsgBox "The ObjectID of this object is " & entObjectID, vbInformation, "ObjectID Example"
  26. plineArea = (plineObj.Area \ 144)
  27. MsgBox "The area is: " & plineArea, vbInformation, "Area Example"
  28. returnpnt = ThisDrawing.Utility.GetPoint(, "Select Block Insertion Point: ")
  29. height = Val(VARDATA * 0.09375) 'fixED to 3/32
  30. text = "%%).Area>%"
  31. 'text = "%%"
  32. MsgBox "The Square Footage for the selected entity equals: " & fieldcode, vbInformation, "FieldCode Example"
  33. Set textObj = ThisDrawing.ModelSpace.AddText(text, returnpnt, height) 'must use fieldcode
  34. 'Set textObj = ThisDrawing.ModelSpace.AddMText(returnpnt, height, text) 'must use fieldcode
  35. text = textObj.fieldcode
  36. End Sub

回复

使用道具 举报

57

主题

235

帖子

3

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
463
发表于 2007-11-2 16:55:36 | 显示全部楼层
它在-
Str$
处窒息,这是什么原因?
回复

使用道具 举报

57

主题

235

帖子

3

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
463
发表于 2007-11-2 16:58:10 | 显示全部楼层

我在AutoCAD 2007中运行了宏/函数,它工作正常
正如我所说,我不是VB/A程序员
回复

使用道具 举报

57

主题

235

帖子

3

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
463
发表于 2007-11-2 17:05:48 | 显示全部楼层

,这在A2007eng
  1. Private Sub CommandButton5_Click()
  2. Me.hide
  3. Dim Mytext As AcadMText
  4. Dim entarea As Double
  5. Dim textObj As AcadEntity
  6. Dim text As String
  7. Dim fieldcode As String
  8. Dim insertionPoint(0 To 2) As Double
  9. Dim height As Double
  10. Dim NewArea As Double
  11. Dim OBJID As Variant
  12. Dim objEnt As AcadEntity
  13. Dim varPick As Variant
  14. Dim TXTID2 As AcadText
  15. Dim entObjectID As Long
  16. Dim sysVarName As Variant
  17. Dim VARDATA As Variant
  18. Dim returnpnt As Variant
  19. sysVarName = "dimscale"
  20. VARDATA = ThisDrawing.GetVariable(sysVarName)
  21. Dim plineObj As AcadLWPolyline
  22. Dim plineArea As Double
  23. ThisDrawing.Utility.GetEntity objEnt, varPick, vbCr & "Select object for Area: "
  24. entObjectID = objEnt.ObjectID
  25. Set plineObj = objEnt
  26. '//MsgBox "The ObjectID of this object is " & entObjectID, vbInformation, "ObjectID Example"
  27. plineArea = plineObj.Area / 144
  28. MsgBox "The area is: " & Format(CStr(plineArea), "0.00000"), vbInformation, "Area Example"
  29. returnpnt = ThisDrawing.Utility.GetPoint(, "Select Block Insertion Point: ")
  30. height = CDbl(VARDATA * 0.09375) 'fixED to 3/32
  31. text = " %%).Area \f " & Chr(34) & "%lu2%ct4%qf1 SQ. FT." & Chr(34) & ">%"
  32. '//MsgBox "The Square Footage for the selected entity equals: " & fieldcode, vbInformation, "FieldCode Example"
  33. Set Mytext = ThisDrawing.ModelSpace.AddMText(returnpnt, 0#, text)   'must use fieldcode
  34. Mytext.height = height
  35. ThisDrawing.Regen acActiveViewport
  36. text = Mytext.fieldcode
  37. MsgBox text
  38. Me.Show
  39. End Sub

中也对我有用
~'J'~
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-7-5 16:59 , Processed in 1.085965 second(s), 73 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表