明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 602|回复: 0

cass获取界址线每条线段属性

[复制链接]
发表于 2019-9-12 09:27 | 显示全部楼层 |阅读模式
代码如下,运行结果显示每段线的属性都为空值,但用cass导出属性,有属性数据,有起点号和终点号等属性,求高手解答!!!

Sub test4()
    On Error Resume Next

    Dim obj As AcadEntity, pnt, oVers
    Dim xt, xd
    Dim i As Integer
    Dim s As String, j As Integer
    ThisDrawing.Utility.GetEntity obj, pnt, "请选择界址线所在的宗地:"
    oVers = GetVertexs(obj)
    If oVers <> vbEmpty Then
        For i = 0 To UBound(oVers)
            s = ""
            Call oVers(i).GetXData("", xt, xd)
            Debug.Print UBound(xd)
            For j = 0 To UBound(xd)
                s = s & vbCrLf & xd(j)
            Next j
            If Err Then
                Err.Clear
                MsgBox "空值"
            Else
                MsgBox s
            End If
        Next i
    Else
        MsgBox "错误选择"
    End If
End Sub
Function GetVertexs(Ent As AcadEntity) As Variant
    Dim n As Integer
    Dim oVertexs() As AcadObject
    Dim sName As String
    sName = UCase(Ent.ObjectName)
    Dim lst
    Dim i As Integer

   Debug.Print sName & "aaa" & UBound(Ent.Coordinates)


    If sName = "ACDB2DPOLYLINE" Or sName = "ACDB3DPOLYLINE" Then
        n = (UBound(Ent.Coordinates) + 1) / 3
    End If
   Debug.Print n
    If n = 0 Then Exit Function

    ReDim oVertexs(n - 1)

    Dim oVlax As New VLAX
    lst = oVlax.GetLispList("(GetVers """ & Ent.Handle & """)")
    Debug.Print Ent.Handle
    For i = 1 To n
        Set oVertexs(i - 1) = ThisDrawing.HandleToObject(lst(n - i))
        Debug.Print oVertexs(i - 1).Handle
    Next i

    GetVertexs = oVertexs

End Function


您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-4-18 19:02 , Processed in 0.197130 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表