|
|
发表于 2008-6-18 19:44:53
|
显示全部楼层
来自: 中国浙江宁波
首先字段是多行文本对象或单行文本对象(AcadMText、AcadTex),参考二对象的FieldCode方法的帮助或许会得到启发!具体没有试过,猜测应该是按fieldcode方法来区分一个文本对象是否为字段;普通文本对象的fieldcode方法是文本对象的内容,而字段则为通配符,至于下面该怎么做你自己考虑吧!
4 u) A- e6 | N ?/ ^- Z下面是ACAD2008的帮助例子
1 A5 T" H% v' @" p, SSub Example_FieldCode(); [5 u& E: S+ U* l% u% [( P
' This example creates a text object in model space., h4 Y! u T$ ]! Q/ [: v' j
' It then returns the field code string for the object.
1 _% F0 R$ t B! h8 B: i0 E- ]
$ \( b' b/ W2 ~ Dim textObj As AcadText
2 c7 C2 M# M5 n, H7 w4 q Dim text As String1 Y/ `8 a0 _! O, a
Dim insertionPoint(0 To 2) As Double9 ?- ~. x) o" C+ h% b, E% g
Dim height As Double
* M7 l0 [4 L3 D4 ?
2 X& _. s+ Y& X ' Define the text object
! L# f2 W W: N! @ text = "%<\AcVar Date \f ""M/d/yyyy""%>%"
& m! v3 P0 q1 z& F% Z0 D6 @ insertionPoint(0) = 2: insertionPoint(1) = 2: insertionPoint(2) = 01 _$ l; A- v4 t+ d) c, d) k
height = 0.5
0 Y* o0 a$ g. g7 }8 _( d, D ( O. F% {( U* @+ E F( R1 Z# x
' Create the text object in model space! Z& L( _1 M) k0 l: R
Set textObj = ThisDrawing.ModelSpace.AddText(text, insertionPoint, height)4 m2 f0 _1 q6 [3 ], ^8 R! w/ c
ZoomAll
. c) P- c2 b. c- c" X+ k" W " j; r! Q% v% U9 e6 [, A z
' Return the current text string for the object
9 [: ]% l C1 [ F text = textObj.FieldCode
6 }5 M+ ]! w% v# i7 d MsgBox "The FieldCode for the text object equals: " & text, vbInformation, "FieldCode Example"
8 G5 w# {% T, E* n! }; F. T4 b! Z. f* X' `) @
End Sub
& U% d6 I. p; V/ R- w# x9 w% K! W& p* J" q5 e7 m
[ 本帖最后由 sealive_leafage 于 2008-6-18 20:04 编辑 ] |
评分
-
查看全部评分
|