明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1327|回复: 2

[求助]数据类型

[复制链接]
发表于 2010-9-29 09:31:00 | 显示全部楼层 |阅读模式
Public Function AddCircleBy2Point(ByVal StartPoint As Variant, ByVal EndPoint As Variant) As AcadCircle
'参数有效性检查
Debug.Assert (VarType(StartPoint) = vbArray + vbDouble)
Debug.Assert (VarType(EndPoint) = vbArray + vbDouble)
'计算圆心和半径
Dim CenterPoint As Variant
Dim Radius As Double
CenterPoint = Math.GetMiddlePointBetween2Point(StartPoint, EndPoint)
Radius = Math.GetDistanceBetween2Point(StartPoint, EndPoint) / 2
'创建圆
Set AddCircleBy2Point = ThisDrawing.ModelSpace.AddCircle(CenterPoint, Radius)
End Function

centerpoint的数据类型为什麽不可以是double??
发表于 2010-9-29 09:52:00 | 显示全部楼层

是double的数组

 楼主| 发表于 2010-9-29 10:56:00 | 显示全部楼层

Public Function GetMiddlePointBetween2Point(ByVal StartPoint As Variant, ByVal EndPoint As Variant) As Variant
Dim MiddlePoint(0 To 2) As Double
MiddlePoint(0) = (StartPoint(0) + EndPoint(0)) / 2
MiddlePoint(1) = (StartPoint(1) + EndPoint(1)) / 2
MiddlePoint(2) = (StartPoint(2) + EndPoint(2)) / 2
GetMiddlePointBetween2Point = MiddlePoint
End Function

是不是这个函数也要改成数组???

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-26 01:48 , Processed in 0.164230 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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