|
|
发表于 2008-6-18 19:44:53
|
显示全部楼层
来自: 中国浙江宁波
首先字段是多行文本对象或单行文本对象(AcadMText、AcadTex),参考二对象的FieldCode方法的帮助或许会得到启发!具体没有试过,猜测应该是按fieldcode方法来区分一个文本对象是否为字段;普通文本对象的fieldcode方法是文本对象的内容,而字段则为通配符,至于下面该怎么做你自己考虑吧!1 o+ [9 v9 q1 z
下面是ACAD2008的帮助例子/ s* L2 R( M! E8 i# [
Sub Example_FieldCode()& }8 M: h k, f2 G8 R- H4 M& `# Q
' This example creates a text object in model space.
, E) b/ e6 g9 r/ V ' It then returns the field code string for the object.& u. z* I; {, [* _$ [
7 G& g0 i: ^9 a$ v w, e9 q
Dim textObj As AcadText
: _+ n3 Q& O5 G1 \ Dim text As String
1 m3 J6 e7 B1 C, U: {7 O3 t Dim insertionPoint(0 To 2) As Double
& Q# L+ c: F7 M- V8 o9 M( V Dim height As Double
+ \9 `0 m( o0 S0 a3 q" [
6 x, N Y" {( Y& K6 o ' Define the text object
( ^" n% V! K" k; `" d3 l: K: q text = "%<\AcVar Date \f ""M/d/yyyy""%>%"
" a3 n' [% b N+ H* ? insertionPoint(0) = 2: insertionPoint(1) = 2: insertionPoint(2) = 00 k7 I7 c6 y n6 \- G
height = 0.5
. w1 Y/ h8 ^' |! R0 Z
! `* d- d2 S/ O) F, T* E ' Create the text object in model space* }" D" `. R+ G7 s
Set textObj = ThisDrawing.ModelSpace.AddText(text, insertionPoint, height)& D5 P" k0 ^0 o1 J* ]1 Z9 C. Q8 C
ZoomAll( R% T6 ~4 Q& z g6 V9 D8 \7 E" O
+ n0 f$ |* i9 { z
' Return the current text string for the object9 `6 F) B0 ? O! R3 {0 N
text = textObj.FieldCode* |- ?! t4 l# E4 T6 ]
MsgBox "The FieldCode for the text object equals: " & text, vbInformation, "FieldCode Example"
, j. t, k4 X( Y' F, r5 o' ?8 E, f: [, L( i8 l1 W
End Sub
; f) j3 b* v* M9 T# y; U; k
5 W, I/ b2 T9 o& `9 F6 g[ 本帖最后由 sealive_leafage 于 2008-6-18 20:04 编辑 ] |
评分
-
查看全部评分
|