laoliu09 发表于 2004-11-10 10:16:00

新手求教!

扩展数据是什么啊?可以给我举个例子吗?谢了!

yulijin608 发表于 2004-11-10 13:40:00

Sub setxRecord()


Dim linext(0 To 4) As Integer<BR>Dim linexd(0 To 4) As Variant<BR>Dim sPoint(0 To 2) As Double<BR>Dim ePoint(0 To 2) As Double<BR>sPoint(0) = 10<BR>sPoint(1) = 10<BR>sPoint(2) = 0<BR>ePoint(0) = 30<BR>ePoint(1) = 30<BR>ePoint(2) = 0<BR>Dim lineObj As AcadLine<BR>Set lineObj = ThisDrawing.ModelSpace.addline(sPoint, ePoint)<BR>lineObj.Color = 1


linext(0) = 1001: linexd(0) = "LineInfo"<BR>linext(1) = 1000: linexd(1) = "a"<BR>linext(2) = 1000: linexd(2) = "b"<BR>linext(3) = 1000: linexd(3) = "c"<BR>linext(4) = 1000: linexd(4) = "d"


ThisDrawing.RegisteredApplications.Add "LineInfo"<BR>lineObj.SetXData linext, linexd<BR>lineObj.Update


End Sub


Sub getxRecord()<BR>Dim a As Variant<BR>Dim b As Variant<BR>Dim sset As AcadSelectionSet<BR>Set sset = ThisDrawing.SelectionSets.Add("ss")<BR>Dim point As Variant<BR>point = ThisDrawing.Utility.GetPoint()<BR>sset.SelectAtPoint point<BR>Dim entry As AcadEntity<BR>Dim xdataOut As Variant<BR>Dim xtypeOut As Variant<BR>                       <BR>For Each entry In sset<BR>                       If StrComp(entry.ObjectName, "AcDbLine", 1) = 0 Then<BR>                                                       entry.GetXData "", xtypeOut, xdataOut<BR>                                                       MsgBox xdataOut(1) &amp; "," &amp; xdataout(2) &amp; "," &amp; xdataout(3) &amp; "," &amp; xdataout(4)<BR>                       End If<BR>Next<BR>ThisDrawing.SelectionSets.Item("ss").Delete<BR>End Sub

efan2000 发表于 2004-11-10 13:43:00

XDATA,就是在图形上附加自己的数据,可以看看帮助中的示例。
页: [1]
查看完整版本: 新手求教!