明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1203|回复: 1

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

[复制链接]
发表于 2009-8-14 13:30:00 | 显示全部楼层 |阅读模式

Dim acadapp As Object
Dim acaddoc As Object
Dim mospace As Object
Dim paspace As Object
Dim lineobj, txtobj As Object '实体定义
Dim stp(2), endp(2) As Double '点定义
Dim insp As Variant
'On Error Resume Next
Set acadapp = GetObject(, "AutoCAD.Application.16")
If Err Then
Set acadapp = CreateObject("AutoCAD.Application.16")
If Err Then
MsgBox Err.Description
Exit Sub
End If
End If
Set acaddoc = acadapp.ActiveDocument
Set mospace = acaddoc.ModelSpace
Set paspace = acaddoc.PaperSpace
Set acadut = acaddoc.Utility
acadapp.Visible = True
stp(0) = 0#: stp(1) = 0#: stp(2) = 0#: endp(0) = 0#: endp(1) = 100#: endp(2) = 0#
Set lineobj = mospace.AddLine(stp, endp)

上面这些语句生成一条直线为什么总提示”错误的过程调用或参数“,如果在屏幕上点取两个点可以画出直线,但这样应该没错啊,请各位指点一下

是stp和endp定义不对吗,导致参数错误吗?

发表于 2009-8-14 13:59:00 | 显示全部楼层
Dim lineobj As Object, txtobj As Object '实体定义
Dim stp(2) As Double, endp(2) As Double '点定义
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-26 02:25 , Processed in 0.159459 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表