http://www.mjtd.com/e-zine/list04.htm 有这么如下描述,问XLAX类模块在哪里下载? 要使用以下代码,你必须将XLAX类模块输入到你的工程中。如果你还没有,可以在本站下载。 Public Sub AddXdataToVertices() Dim obj As VLAX, ent As AcadObject Dim vertex As AcadObject, xType(0 To 1) As Integer, xData(0 To 1) ThisDrawing.Utility.GetEntity ent, pt, "Select polyline" If TypeOf ent Is AcadPolyline Then Set obj = New VLAX obj.EvalLispExpression "(defun getvertices (poly / tmp lst) " & _ "(setq tmp (entget (entnext poly))) (while " & _ "(= (cdr (assoc 0 tmp)) ""VERTEX"") (setq lst " & _ "(cons (cdr (assoc 5 tmp)) lst) tmp (entget " & _ "(entnext (cdr (assoc -1 tmp)))))) (reverse lst))" obj.EvalLispExpression _ "(setq vertexlist (getvertices (handent """ &_ ent.Handle & """)))" retVal = obj.GetLispList("vertexlist") obj.NullifySymbol "getvertices", "vertexlist" xType(0) = 1001: xData(0) = "MY_APP" For i = LBound(retVal) To UBound(retVal) xType(1) = 1000: xData(1) = retVal(i) Set vertex = ThisDrawing.HandleToObject(retVal(i)) vertex.SetXData xType, xData Next End If End Sub |