cqy 发表于 2007-9-22 16:55:00

求助:文字加扩展数据无法实现

<p>文字加扩展数据无法实现:</p><p>Dim objText As AcadText<br/>Dim dataType(0 To 1) As Integer<br/>&nbsp;&nbsp;&nbsp; Dim data(0 To 1) As Variant<br/>&nbsp;&nbsp;&nbsp; dataType(0) = 1001: data(0) = "XData"<br/>&nbsp;&nbsp;&nbsp; dataType(1) = 1000: data(1) = "123"<br/>&nbsp;&nbsp;&nbsp; Dim ptinsert(2) As Double<br/>&nbsp;&nbsp;&nbsp; ptinsert(0) = 100: ptinsert(1) = 100: ptinsert(2) = 0<br/>&nbsp;&nbsp;&nbsp; AddText "AutoCAD 2004", ptinsert, 5<br/>&nbsp;&nbsp;&nbsp; objText.SetXData dataType, data</p><p>同样的方法直线没有问题,请帮忙。</p>

alin 发表于 2007-9-24 07:25:00

<p>怎会呢?</p><p>Sub TEST()<br/>Dim objText As AcadText<br/>Dim dataType(0 To 1) As Integer<br/>&nbsp;&nbsp;&nbsp; Dim data(0 To 1) As Variant<br/>&nbsp;&nbsp;&nbsp; dataType(0) = 1001: data(0) = "XData"<br/>&nbsp;&nbsp;&nbsp; dataType(1) = 1000: data(1) = "123"<br/>&nbsp;&nbsp;&nbsp; Dim ptinsert(2) As Double<br/>&nbsp;&nbsp;&nbsp; ptinsert(0) = 100: ptinsert(1) = 100: ptinsert(2) = 0<br/>&nbsp;&nbsp;&nbsp; Set objText = ThisDrawing.ModelSpace.AddText("AutoCAD 2004", ptinsert, 5)<br/>&nbsp;&nbsp;&nbsp; objText.SetXData dataType, data<br/>&nbsp;&nbsp;&nbsp; Dim xdataOut As Variant<br/>&nbsp;&nbsp;&nbsp; Dim xtypeOut As Variant<br/>&nbsp;&nbsp;&nbsp; objText.GetXData "", xtypeOut, xdataOut<br/>&nbsp;&nbsp;&nbsp; MsgBox xtypeOut(0)<br/>&nbsp;&nbsp;&nbsp; MsgBox xdataOut(0)<br/>&nbsp;&nbsp;&nbsp; MsgBox xtypeOut(1)<br/>&nbsp;&nbsp;&nbsp; MsgBox xdataOut(1)<br/>End Sub</p>

cqy 发表于 2007-9-24 14:23:00

<p>感谢alin老师:</p><p>AddText "AutoCAD 2004", ptinsert, 5</p><p>Set objText = ThisDrawing.ModelSpace.AddText("AutoCAD 2004", ptinsert, 5)</p><p>这一句的问题,再次感谢!<br/></p><p><br/></p>
页: [1]
查看完整版本: 求助:文字加扩展数据无法实现