|
If your strings are plain text(no
format),you can do: Right click source dataset->properties->Format
Attributes->autocad_text_String. If your strings are mixed_format(In
autocad, called mText,in a String you can use multiformat),you can check the
autocad_mtext_string. Before long,I translated
mtext of Autocad to Geodatabase,In arcmap you can use xml tag show your label. Here is my code,hope useful
for you task. Sub cadmText2xml() ' ' Get the current
map. ' Dim pMxDoc As
IMxDocument, pMap As IMap Dim field1, field2 As
String Dim newString As
String Set pMxDoc =
ThisDocument Set pMap =
pMxDoc.FocusMap ' ' Here, we select the
top layer in the Map to work with. ' Dim pFeatureLyr As
IFeatureLayer, pFeatureClass As IFeatureClass Dim
pNewFields As IFields If TypeOf
pMap.Layer(0) Is IFeatureLayer Then Set
pFeatureLyr = pMap.Layer(0) Set
pFeatureClass = pFeatureLyr.FeatureClass Set
pNewFields = pFeatureClass.Fields
'
' Now we create a FeatureCursor from all of the features in the original feature
' class. We use this cursor to iterate the features to find closed Polylines.
'
Dim pFeatureCursor As IFeatureCursor, pFeature As IFeature
Set pFeatureCursor = pFeatureClass.Search(Nothing, False)
Set pFeature = pFeatureCursor.NextFeature
Do While Not pFeature Is Nothing
'
Iterate all the Fields to copy the attribute values.
'
Dim i As Integer
For i = 0 To pNewFields.FieldCount - 1
If (pNewFields.Field(i).Name = "MTEXT") Then
If pNewFields.Field(i).Editable Then
pFeature.Value(i) = mText2xml(pFeature.Value(i))
End If
End If
Next i
pFeature.Store
'
FeatureClass.
'
Set pFeature = pFeatureCursor.NextFeature
End If End Sub Function mText2xml(oldValue
As String) As String 'use three function
to parse mtext String of AutoCAD to xml. Dim step1Str() As
String 'newString =
"" oldValue =
Left(oldValue, Len(oldValue) - 1) step1Str =
Split(oldValue, "\") For i = 0 To UBound(step1Str)
newString = newString + toXml(step1Str(i))
'newString = newString + step1Str(i) Next i mText2xml = newString End Function Function toXml(fd As String)
As String Dim idx As Integer fd = Replace(fd,
"{", "") If fd = ""
Then fd = fd Else
Select Case Left(fd, 1)
Case "S"
fd = Left(fd, Len(fd) - 1)
fd = Right(fd, Len(fd) - 1)
idx = InStr(fd, "^")
fd = "<SUP>" + Left(fd, idx - 1) +
"</SUP><SUB>" + Right(fd, Len(fd) - idx) +
"</SUB>"
Case Else
fd = Right(fd, Len(fd) - 1)
idx = InStr(fd, ";")
fd = Right(fd, Len(fd) - idx) End
Select End If toXml = fd End Function **************************************** 专业数据转换与数据入库技术讨论。 Yahoo Group:http://groups.yahoo.com/group/cad2gis/ BBS:http://www.ezforums.org/cad2gis **************************************** 发件人: Dear All, I'm new in
FME, how to extract Autocad_text string and put into shapefile attribute
using the transformer in workbench.. dinium Do you Yahoo!? Get the maximum benefit from your FME, FME Objects, or SpatialDirect via our Professional Services team. Visit www.safe.com/services for details. Yahoo! Groups Links
|
