|
|
发表于 2008-6-18 19:44:53
|
显示全部楼层
来自: 中国浙江宁波
首先字段是多行文本对象或单行文本对象(AcadMText、AcadTex),参考二对象的FieldCode方法的帮助或许会得到启发!具体没有试过,猜测应该是按fieldcode方法来区分一个文本对象是否为字段;普通文本对象的fieldcode方法是文本对象的内容,而字段则为通配符,至于下面该怎么做你自己考虑吧!
' {% U- ]( K* w0 h7 ]4 g7 _0 |下面是ACAD2008的帮助例子' |% i3 b7 {: b+ j7 [. y1 N
Sub Example_FieldCode()
) r9 X' [7 @/ x' ]8 `5 L ' This example creates a text object in model space.6 e, K2 G& r' Z, i9 `& L
' It then returns the field code string for the object.2 j C% k- O+ r$ t+ D- v
( s7 J& d [% Y5 I
Dim textObj As AcadText8 e) u7 g6 ]$ R9 {: P8 w
Dim text As String2 n( `" @# G6 C6 j
Dim insertionPoint(0 To 2) As Double
n1 M# s$ {8 z" n4 r Dim height As Double
, i% X& p. K, L+ ]0 D& B
8 I- v8 n4 t+ ` ' Define the text object
5 p' z, t3 g; N text = "%<\AcVar Date \f ""M/d/yyyy""%>%"
% H; S) A4 ?1 n/ a8 T insertionPoint(0) = 2: insertionPoint(1) = 2: insertionPoint(2) = 0
4 ^# |! g8 n( s0 i! y8 K height = 0.5
: s$ n$ P# h2 N' s! \6 C
- z/ G5 p r! @' S8 R4 A( ` ' Create the text object in model space
, j6 R1 y$ }! p( y0 m) j- { Set textObj = ThisDrawing.ModelSpace.AddText(text, insertionPoint, height)
+ z T# z# Z, N r h9 F. i7 h ZoomAll
4 L3 ?; R- C, }( f
# W Q* p& n! \8 O7 s ' Return the current text string for the object l; d. }* @% ~3 J C
text = textObj.FieldCode: ^5 K- D6 m" H0 A/ l: P q
MsgBox "The FieldCode for the text object equals: " & text, vbInformation, "FieldCode Example"
, a% P! m) A9 S) w! e2 g$ i9 S9 \
1 S" [" R/ c0 VEnd Sub/ H* p8 r. O( }) w! p. B
1 [7 u! T0 ?. h$ @3 ^" g[ 本帖最后由 sealive_leafage 于 2008-6-18 20:04 编辑 ] |
评分
-
查看全部评分
|