我在用vb调用CAD画道路路线地面线时,编写了下面这段程序,程序未提示出错,可在CAD中就是没有出图效果,请高人给个解法: 我不会直接从数据库中取单个数据,于是我将数据引用到了listbox,在取其list属性值作为地面线各点值,可是我定义的basepnt()和pnt()却出现了下标越界的错误提示,实在想不通,而且在下面这个子过程中没有出现终止程序运行的错误 Public Sub drawdmx() Dim db As Database Dim rs As Recordset Dim i As Integer Dim basepnt() As Double, pnt() As Double Dim plineobj As AcadLWPolyline Dim points() As Double Dim lineobj As AcadLine Set db = opendatabase("L:\设计!重要!!\我的设计\zdm1.mdb") Set rs = db.OpenRecordset("地面线数据") Do While Not rs.EOF List1.AddItem rs.fields(1).Value List2.AddItem rs.fields(2).Value rs.MoveNext Loop ReDim points(List1.ListCount) Do Until i = List1.ListCount basepnt(0) = 0 basepnt(1) = 10 * Me.List2.List(0) basepnt(2) = 0 pnt(0) = Me.List1.List(i + 1) pnt(1) = 10 * Me.List2.List(i + 1) pnt(2) = 0 Set lineobj = cadapp.ActiveDocument.ModelSpace.AddLine(basepnt, pnt) i = i + 1 loop
还有个问题是:写好的添加文本程序为何只能使用前期绑定方式才能添加到CAD中? |