herywang 发表于 2009-8-14 13:30:00

帮忙看看这段代码,绘制直线有什么不对吗

<p>Dim acadapp As Object<br/>Dim acaddoc As Object<br/>Dim mospace As Object<br/>Dim paspace As Object<br/>Dim lineobj, txtobj As Object '实体定义<br/>Dim stp(2), endp(2) As Double '点定义<br/>Dim insp As Variant<br/>'On Error Resume Next<br/>Set acadapp = GetObject(, "AutoCAD.Application.16")<br/>If Err Then<br/>Set acadapp = CreateObject("AutoCAD.Application.16")<br/>If Err Then<br/>MsgBox Err.Description<br/>Exit Sub<br/>End If<br/>End If<br/>Set acaddoc = acadapp.ActiveDocument<br/>Set mospace = acaddoc.ModelSpace<br/>Set paspace = acaddoc.PaperSpace<br/>Set acadut = acaddoc.Utility<br/>acadapp.Visible = True<br/>stp(0) = 0#: stp(1) = 0#: stp(2) = 0#: endp(0) = 0#: endp(1) = 100#: endp(2) = 0#<br/>Set lineobj = mospace.AddLine(stp, endp)</p><p>上面这些语句生成一条直线为什么总提示”错误的过程调用或参数“,如果在屏幕上点取两个点可以画出直线,但这样应该没错啊,请各位指点一下</p><p>是stp和endp定义不对吗,导致参数错误吗?</p>

雪山飞狐_lzh 发表于 2009-8-14 13:59:00

Dim lineobj As Object, txtobj As Object '实体定义<br/>Dim stp(2) As Double, endp(2) As Double '点定义
页: [1]
查看完整版本: 帮忙看看这段代码,绘制直线有什么不对吗