嗨,伙计们
我的问题类似于安德的问题。我在使用从SHP到多段线转换的自定义特性时遇到了一些问题。
我将形状作为多段线插入,其中包含来自形状文件数据库的额外属性。到现在为止,一直都还不错。但是现在我想把多段线放到不同的层中,这取决于我刚刚创建的属性。
问题是,我似乎无法使用VBA编码从自定义属性中获取数组,甚至是某种变体对象。对于LW Poly,这可能吗?我正在使用AutoCAD MAP 3D 2011。
我有一个开始的代码:
- Sub Layer()
- Dim Ent As AcadEntity
- Dim pLine As AcadLWPolyline
- Dim aAttributes As Variant
- Dim Attrib As Variant
- Dim Layer As AcadLayer
- Dim sText As String
-
- For Each Ent In ThisDrawing.ModelSpace
- If TypeOf Ent Is AcadLWPolyline Then
- Set pLine = Ent
- aAttributes = pLine.GetAttributes
-
- Select Case pLine.Layer
- Case "ggba"
- For Each Attrib In aAttributes
- If Attrib.TagString = "TPC" Then
- sText = Attrib.TextString
- Set Layer = ThisDrawing.Application.ActiveDocument.Layers.Add("GBA" & sText)
- pLine.Layer = Layer
- End If
- Next Attrib
- End Select
- End If
- Next
- End Sub
显然是。getattribute方法不适用于LW多边形。
非常感谢您的帮助,
谢谢 |