明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1742|回复: 4

[求助]能够获得点坐标,为什么不能添加点呢?

[复制链接]
发表于 2004-10-29 10:30:00 | 显示全部楼层 |阅读模式
我在模块1里面定义了 pulic P1(2)as double 然后写了一个求点的函数 Public Function calc_point1(ByVal whirl_cen As Variant, ByVal PtoP_angle As Double, _
ByVal whirl_a As Double, ByVal whirl_r As Double) As Variant 'whirl_cen 为圆弧圆心坐标,PtoP_angle 为一个方位角,whirl_a 为回旋线放大系数, 'whirl_r为回旋线上一点对应半径
Dim temp_pt(1), t,Arc_xy(1) As Double Arc_xy(0) = 10 Arc_xy(1)=20
t = whirl_a ^ 2 / whirl_r ^ 2 / 2 temp_pt(0) = whirl_cen(0) + (Arc_xy(1) + whirl_r * Cos(t)) * Cos(PtoP_angle)
temp_pt(1) = whirl_cen(1) + (Arc_xy(1) + whirl_r * Cos(t)) * Sin(PtoP_angle) P1(0) = temp_pt(0) - (Arc_xy(0) - whirl_r * Sin(t)) * Sin(PtoP_angle)
P1(1) = temp_pt(1) + (Arc_xy(0) - whirl_r * Sin(t)) * Cos(PtoP_angle)
P1(2) = 0 '添加debug.print ThisDrawing.ModelSpace.addpoint P1 calc_point1 = P1 End Function 在运行到ThisDrawing.ModelSpace.addpoint P1时出现 运行时错误 ‘5’,无效的过程调用或参数 而我在添加的debug.print处得出点坐标为564.610060386037 ,178.306128990985 , 0 为什么有了点坐标却不能添加一个点呢?请高手帮帮忙,谢谢!
发表于 2004-10-29 10:51:00 | 显示全部楼层
public p1(2) As Double
 楼主| 发表于 2004-10-29 12:11:00 | 显示全部楼层
public p1(2) As Double?


括号是我在发帖的时候,没弄好的


括号应该没什么问题


是不是定义的类型不匹配阿?
发表于 2004-10-29 15:21:00 | 显示全部楼层
Dim p1(2) As Double
Public Function calc_point1(ByVal whirl_cen As Variant, ByVal PtoP_angle As Double, _
ByVal whirl_a As Double, ByVal whirl_r As Double) As Variant 'whirl_cen 为圆弧圆心坐标,PtoP_angle 为一个方位角,whirl_a 为回旋线放大系数, 'whirl_r为回旋线上一点对应半径
Dim temp_pt(1) As Double, t As Double, Arc_xy(1) As Double Arc_xy(0) = 10
Arc_xy(1) = 20 t = whirl_a ^ 2 / whirl_r ^ 2 / 2 temp_pt(0) = whirl_cen(0) + (Arc_xy(1) + whirl_r * Cos(t)) * Cos(PtoP_angle)
temp_pt(1) = whirl_cen(1) + (Arc_xy(1) + whirl_r * Cos(t)) * Sin(PtoP_angle) p1(0) = temp_pt(0) - (Arc_xy(0) - whirl_r * Sin(t)) * Sin(PtoP_angle)
p1(1) = temp_pt(1) + (Arc_xy(0) - whirl_r * Sin(t)) * Cos(PtoP_angle)
p1(2) = 0 '添加debug.print ThisDrawing.ModelSpace.AddPoint p1 calc_point1 = p1 End Function Sub tt()
a = calc_point1(p1, 30, 1, 5)
End Sub
发表于 2013-1-15 10:17:10 | 显示全部楼层
我也发现有时类型定义都没问题,就是加不进去。研究中...
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-25 15:48 , Processed in 0.178089 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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