|
|
发表于 2008-6-18 19:44:53
|
显示全部楼层
来自: 中国浙江宁波
首先字段是多行文本对象或单行文本对象(AcadMText、AcadTex),参考二对象的FieldCode方法的帮助或许会得到启发!具体没有试过,猜测应该是按fieldcode方法来区分一个文本对象是否为字段;普通文本对象的fieldcode方法是文本对象的内容,而字段则为通配符,至于下面该怎么做你自己考虑吧!& e# P! D% {6 @. T9 b
下面是ACAD2008的帮助例子) m" E0 s* b1 F# i Q
Sub Example_FieldCode()
/ [4 q# X- W5 w* ~ ' This example creates a text object in model space.
9 A) G, w! O% w0 x+ _. a' ] ' It then returns the field code string for the object.
2 B" w# a2 O0 c. V5 W2 p& p* }1 E; q4 b1 J3 m
Dim textObj As AcadText
3 w m/ u; L' X( N" r/ s# o Dim text As String- k2 i0 K( f/ ~: H2 T, j1 F
Dim insertionPoint(0 To 2) As Double
8 {' Q9 E7 H" [/ d Dim height As Double
+ [1 I. ]! L/ _+ O* V6 P( ~& z; V6 M% {% {
' Define the text object4 s" H" u& [5 g
text = "%<\AcVar Date \f ""M/d/yyyy""%>%"9 {( W k; ^: ]% b4 ^6 p
insertionPoint(0) = 2: insertionPoint(1) = 2: insertionPoint(2) = 0
4 |' c8 D) H I) L: t7 y height = 0.5( @7 o5 Q5 M h( o3 `/ h# k% q
/ _+ V6 R1 e# w
' Create the text object in model space
/ Q4 u( d8 a3 ^ Set textObj = ThisDrawing.ModelSpace.AddText(text, insertionPoint, height)
* D& c4 m4 }) m, `/ ?' w3 W$ Y ZoomAll, C( h! c/ V7 l" E# U4 }8 Y
7 s% L7 C, i, F. ?
' Return the current text string for the object
- `/ K/ Q! m6 `# B+ E8 g1 i5 @ text = textObj.FieldCode k4 X0 V! u5 d e
MsgBox "The FieldCode for the text object equals: " & text, vbInformation, "FieldCode Example"- p8 z1 d- v- P: v& x
8 |4 P! b; f2 l) E" f. ]
End Sub
8 R; `4 [$ s- j9 p, }5 @' [
+ R! H$ F) m/ _6 q8 A) {[ 本帖最后由 sealive_leafage 于 2008-6-18 20:04 编辑 ] |
评分
-
查看全部评分
|