|
发表于 2008-6-18 19:44:53
|
显示全部楼层
来自: 中国浙江宁波
首先字段是多行文本对象或单行文本对象(AcadMText、AcadTex),参考二对象的FieldCode方法的帮助或许会得到启发!具体没有试过,猜测应该是按fieldcode方法来区分一个文本对象是否为字段;普通文本对象的fieldcode方法是文本对象的内容,而字段则为通配符,至于下面该怎么做你自己考虑吧!9 b7 s, }( U4 m, l/ o8 U
下面是ACAD2008的帮助例子
+ h8 L, Q- R* CSub Example_FieldCode()
$ y7 u3 a; _$ j7 } ' This example creates a text object in model space.
4 P+ g; ]$ P" H5 {0 r( N% Y ' It then returns the field code string for the object.5 f7 c% B) y* ~- K# t
4 A+ B$ h) P# z& a H) W
Dim textObj As AcadText# M3 d6 I) W# I8 ^ s! R
Dim text As String" ]. Y* |" m0 T
Dim insertionPoint(0 To 2) As Double( j, P* |0 G+ [1 E' m M
Dim height As Double% u' g* V2 Y$ J
* Z6 g+ c& l: y0 F" Q/ ^: N ' Define the text object: E4 I$ O' _6 i# w
text = "%<\AcVar Date \f ""M/d/yyyy""%>%"" x# E( b: r6 }6 O* i+ M
insertionPoint(0) = 2: insertionPoint(1) = 2: insertionPoint(2) = 0, H$ f! m3 z! |1 P+ G+ |; t
height = 0.5! v; O% ~( M& P7 |
9 |& \! v1 t5 t! h' O ' Create the text object in model space+ E4 y E0 x( l5 F
Set textObj = ThisDrawing.ModelSpace.AddText(text, insertionPoint, height)" R: t O& \9 w# K0 C p0 \* F
ZoomAll! ^1 N( c9 \- L8 r* S
3 O% s, r! |3 A" f9 S, ]1 r- M ' Return the current text string for the object
( _1 Y0 {" _1 q/ K( c; x3 w text = textObj.FieldCode7 y2 m* O" H7 s# e3 D1 U* @
MsgBox "The FieldCode for the text object equals: " & text, vbInformation, "FieldCode Example") }9 x& k4 x! p" h3 \' \' p
$ T/ `' q/ y! g/ f5 c) D8 m% Z
End Sub
* E6 P! w2 }* U* }4 s; a6 A
9 h6 [3 W8 R4 V+ Y) A7 H[ 本帖最后由 sealive_leafage 于 2008-6-18 20:04 编辑 ] |
评分
-
查看全部评分
|