明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1783|回复: 2

[VBA]求助:sendcommand 创建直线出现一些问题

[复制链接]
发表于 2005-6-25 13:47:00 | 显示全部楼层 |阅读模式
我用 sendcommand 创建直线出现一些问题,请求各位大哥指点,程序如下 Sub myl()
Dim ptpick As Variant
Dim x As Double
Dim y As Double

Dim x1 As Double
Dim y1 As Double

ptpick = ThisDrawing.Utility.GetPoint(, "请选择第一点")
x = ptpick(0)
y = ptpick(1) ptpick = ThisDrawing.Utility.GetPoint(, "请选择下一点")
x1 = ptpick(0)
y1 = ptpick(1)
ThisDrawing.SendCommand ("_line" & vbCr & "x,y,0" & vbCr & "x1,y1,0" & vbCr)

End Sub 但是同样是差不多的代码,画圆的时候就可以 Sub mycircle()

Dim ptpick As Variant
Dim x As Double
Dim y As Double
Dim z As Double
ptpick = ThisDrawing.Utility.GetPoint(, "请选择第一点")
x = ptpick(0)
y = ptpick(1)
z = 0

static r as Double
Dim returnString As String
returnString = ThisDrawing.Utility.GetString(False, "输入半径:")
If returnString = "" Then
r = r
Else
r = Val(returnString)
End If
ThisDrawing.SendCommand ("_Circle" & vbCr & "x, y, 0" & vbCr & r & vbCr)

End Sub 请教各位高手!
发表于 2005-6-25 14:17:00 | 显示全部楼层

reply

Sub myl()
Dim ptpick As Variant
Dim x As Double
Dim y As Double

Dim x1 As Double
Dim y1 As Double

ptpick = ThisDrawing.Utility.GetPoint(, "请选择第一点")
x = ptpick(0)
y = ptpick(1) ptpick = ThisDrawing.Utility.GetPoint(, "请选择下一点")
x1 = ptpick(0)
y1 = ptpick(1) Dim mac As String
mac = "_line" & vbCr & VBA.str(x) & "," & VBA.str(y) & Chr(10) & VBA.str(x1) & "," & VBA.str(y1) & vbCr & vbCr
mac = VBA.Replace(mac, " ", "")
'MsgBox mac
ThisDrawing.SendCommand mac

End Sub
 楼主| 发表于 2005-6-25 20:49:00 | 显示全部楼层
谢谢版主!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-27 12:37 , Processed in 0.158420 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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