|
发表于 2021-6-15 08:37:00
|
显示全部楼层
详见:http://blog.sina.com.cn/s/blog_af1320c70102xraw.html
'读取扩展数据
Public Function GetCode(objEnt As AcadEntity, strAppName As String) As Variant
Dim DataType As Variant, DataVaue As Variant, i As Integer
If HasXData(objEnt, strAppName) = False Then
GetCode = ""
Else
objEnt.GetXData strAppName, DataType, DataValue
For i = LBound(DataType) To UBound(DataType)
If DataType(i) = 1000 Then GetCode = DataValue(i): Exit For
Next i
End If
End Function
'设置扩展数据
Public Function SetCode(objEnt As AcadEntity, strAppName As String, strDataValue As String)
Dim DataType(0 To 1) As Integer
Dim DataValue(0 To 1) As Variant
DataType(0) = 1001: DataValue(0) = strAppName
DataType(1) = 1000: DataValue(1) = strDataValue
objEnt.SetXData DataType, DataValue
End Function |
|