xwjljh 发表于 2009-5-5 17:33:00
<p>下面是我的代码,望大侠帮帮我呀,谢谢了</p><p>Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br/> AddEntXData()<br/> End Sub<br/><br/> Public Sub AddEntXData()<br/> Dim ent As Autodesk.AutoCAD.Interop.Common.AcadEntity<br/> Dim pickPoint As Object<br/> ' ThisDrawing.Utility.GetEntity(ent, pickPoint)<br/> ThisDrawing.ActiveDocument.Utility.GetEntity(ent, pickPoint)<br/><br/> Dim point(0 To 2) As Double<br/> 'SetPoint3d(point, 100, 100, 0)<br/> point(0) = 100 : point(1) = 100 : point(2) = 0<br/> Dim xRecord As New ClassXRecord<br/> Dim dataType As Object<br/> Dim data As Object<br/> xRecord.CreateXRecord(dataType, data, _<br/> 1, "道路", _<br/> 8, ent.Layer, _<br/> 40, pickPoint(0), _<br/> 10, point)<br/><br/> If xRecord.HasXRecord(ent, "EX02") Then<br/> ThisDrawing.ActiveDocument.Utility.Prompt(vbNewLine & "实体已经包含指定名称的扩展记录.")<br/> Else<br/> xRecord.AddXRecord(ent, "EX02", dataType, data)<br/> ThisDrawing.ActiveDocument.Utility.Prompt(vbNewLine & "成功为实体添加扩展记录.")<br/> End If<br/> End Sub<br/> ' 向实体追加扩展记录<br/> Public Sub AddXRecord1(ByVal ent As Autodesk.AutoCAD.Interop.Common.AcadEntity, ByVal key As String, ByVal xDataType As Object, ByVal xData As Object)<br/> Dim objDict As Autodesk.AutoCAD.Interop.Common.AcadDictionary<br/> Dim objXRecord As Autodesk.AutoCAD.Interop.Common.AcadXRecord<br/><br/> objDict = ent.GetExtensionDictionary()<br/> objXRecord = objDict.AddXRecord(key)<br/> objXRecord.SetXRecordData(xDataType, xData)<br/> End Sub</p>xwjljh 发表于 2009-5-7 14:59:00
<p>高手帮帮了</p><p></p>雪山飞狐_lzh 发表于 2009-5-7 15:29:00
<p>xDataType, xData分别是short数组和object数组</p><p></p>xwjljh 发表于 2009-5-7 21:37:00
<p>谢谢 <strong><font color="#da2549" face="Verdana">lzh741206</font></strong>的大力帮助</p><p>时隔将近半年的 问题终于解决了</p><p>也解除了困扰我4个多月的问题</p><p>谢谢了</p><p>向你表示崇高的敬意!!</p>河外之星 发表于 2015-12-15 08:45:54
果然xDataType, xData分别是short数组和object数组 integer都不行,还必须是short
页:
1
[2]