Flyingdancing 发表于 2012-7-14 12:28:24

getpoint 变量未设置


[*]http://club.excelhome.net/source/plugin/mc_colorcode/images/jssc_shrink.gifSub data_x()

[*]http://club.excelhome.net/source/plugin/mc_colorcode/images/jssc_none.gifDim linex As AcadLine

[*]http://club.excelhome.net/source/plugin/mc_colorcode/images/jssc_none.gifDim pt(1) As AcadPoint

[*]http://club.excelhome.net/source/plugin/mc_colorcode/images/jssc_none.gifDim part As AcadPoint

[*]http://club.excelhome.net/source/plugin/mc_colorcode/images/jssc_none.gifDim doubl As Double

[*]http://club.excelhome.net/source/plugin/mc_colorcode/images/jssc_none.gifpt(0) = ThisDrawing.Utility.GetPoint

[*]http://club.excelhome.net/source/plugin/mc_colorcode/images/jssc_none.gifpt(1) = ThisDrawing.Utility.GetPoint()

[*]http://club.excelhome.net/source/plugin/mc_colorcode/images/jssc_none.gifSet linex = ThisDrawing.ModelSpace.AddLine(pt(0), pt(1))

[*]http://club.excelhome.net/source/plugin/mc_colorcode/images/jssc_none.gifEnd Sub



                还有:
               
[*]http://club.excelhome.net/source/plugin/mc_colorcode/images/jssc_shrink.gifSub data_x()

[*]http://club.excelhome.net/source/plugin/mc_colorcode/images/jssc_none.gifDim linex As AcadLine

[*]http://club.excelhome.net/source/plugin/mc_colorcode/images/jssc_none.gifDim pt1, pt2 As AcadPoint

[*]http://club.excelhome.net/source/plugin/mc_colorcode/images/jssc_none.gifDim part As AcadPoint

[*]http://club.excelhome.net/source/plugin/mc_colorcode/images/jssc_none.gifDim doubl As Double

[*]http://club.excelhome.net/source/plugin/mc_colorcode/images/jssc_none.gifpt1 = ThisDrawing.Utility.GetPoint(, "a")

[*]http://club.excelhome.net/source/plugin/mc_colorcode/images/jssc_none.gifpt2 = ThisDrawing.Utility.GetPoint(, "d")

[*]http://club.excelhome.net/source/plugin/mc_colorcode/images/jssc_none.gifSet linex = ThisDrawing.ModelSpace.AddLine(pt1, pt2)

[*]http://club.excelhome.net/source/plugin/mc_colorcode/images/jssc_none.gifEnd Sub




                这样的时候就是pt2时报错……
我知道用variant的
只是,这两者之间的差别让我费解。有人能解释下么?

雪山飞狐_lzh 发表于 2012-7-14 22:48:44

本帖最后由 雪山飞狐_lzh 于 2012-7-14 22:50 编辑

Dim pt1, pt2 As AcadPoint
VB里这样声明是错误的
等同于
Dim pt1 as variant, pt2 As AcadPoint
不过VB.Net可以。。。

woaishuijia 发表于 2012-7-15 09:52:27

getpoint方法得到的是三维点坐标,是一个三元素双精度数组.声明变量时应该声明为变体变量(双精度动态数组也可以)
而楼主声明为acadpoint是不对的,这是一个单点对象,是一个图元,要用addpoint方法画出来的.
二者风马牛不相及.

Flyingdancing 发表于 2012-7-15 12:57:04

雪山飞狐_lzh 发表于 2012-7-14 22:48 static/image/common/back.gif
Dim pt1, pt2 As AcadPoint
VB里这样声明是错误的
等同于


……这样啊
我是看例子里面都是这样定义的……
怪不得

sscylh 发表于 2012-9-11 19:00:42

Dim pt1, pt2 As AcadPoint
改为:dim pt1,pt2
页: [1]
查看完整版本: getpoint 变量未设置