查看单个帖子
旧 2009-04-19, 05:53 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】为什么会出错呢?请教!

为什么会出错呢?请教!
www.dimcax.com
为什么会出错呢?请教!
有以下一段代码 用来创建一个面域 :
'定义点
dim pt1(0 to 2) as double
dim pt3(0 to 2) as double
dim hpt1(0 to 2) as double
dim hpt3(0 to 2) as double
dim upt1 as variant
dim upt3 as variant
dim uhpt1 as variant
dim uhpt3 as variant
'获得点的坐标

pt1(0) = 0 - 1 / 2 * 100 * val(form1.mcbox1.text) - 100 * val(form1.lpbox1.text) - 100 * val(form1.ltbox1.text): pt1(1) = 0: pt1(2) = 0
hpt1(0) = 0 - 1 / 2 * 100 * val(form1.mcbox1.text) - 100 * val(form1.lpbox1.text) - 100 * val(form1.ltbox1.text): hpt1(1) = r + t + r: hpt1(2) = 0
pt3(0) = 1 / 2 * 100 * val(form1.mcbox1.text) + 100 * val(form1.rpbox1.text) + 100 * val(form1.rtbox1.text): pt3(1) = 0: pt3(2) = 0
hpt3(0) = 1 / 2 * 100 * val(form1.mcbox1.text) + 100 * val(form1.rpbox1.text) + 100 * val(form1.rtbox1.text): hpt3(1) = r + t + r: hpt3(2) = 0
'将点pt1,pt3,hpt1,hpt3的坐标转换为世界坐标
upt2 = thisdrawing.utility.translatecoordinates(pt2, acucs, acworld, false)
upt4 = thisdrawing.utility.translatecoordinates(pt4, acucs, acworld, false)
upt1 = thisdrawing.utility.translatecoordinates(pt1, acucs, acworld, false)
upt3 = thisdrawing.utility.translatecoordinates(pt3, acucs, acworld, false)
uhpt1 = thisdrawing.utility.translatecoordinates(hpt1, acucs, acworld, false)
uhpt3 = thisdrawing.utility.translatecoordinates(hpt3, acucs, acworld, false)


'定义一组直线
dim curs(0 to 3) as acadline

set curs(0) = thisdrawing.modelspace.addline(upt1, uhpt1)
curs(0).layer = "0"
set curs(1) = thisdrawing.modelspace.addline(uhpt1, uhpt3)
curs(1).layer = "0"
set curs(2) = thisdrawing.modelspace.addline(uhpt3, upt3)
curs(2).layer = "0"
set curs(3) = thisdrawing.modelspace.addline(upt3, upt1)
curs(3).layer = "0"
以下代码为:
根据以上衔接直线段创建一个面域
dim regionobj1 as variant
set regionobj1 = thisdrawing.modelspace.addregion(curs)
regionobj1(0).layer = "0"
可运行期间出现"运行时错误"的提示: 说是类型不[匹配,调试出现
-> set regionobj1 = thisdrawing.modelspace.addregion(curs)
我想找个好工作!
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)