zzz8662 发表于 2004-5-31 16:46:00

画三棱锥----大家看看错误在哪里

三棱锥型的创建法:
  1)生成多段线(Addpolyline);
  2)产生区域(AddRegion)后通过挤压(AddExtrudedSolid)
程序如下:
                       
Sub CreatePyramid()
       Dim polyObj As AcadPolyline
       Dim point(0 To 11) As Double
       point(0) = 0: point(1) = 0: point(2) = 0
       point(3) = 255: point(4) = 0: point(5) = 0
       point(6) = 128: point(7) = 221.7025: point(8) = 0
       point(9) = 0: point(10) = 0: point(11) = 0
       Set polyObj = ThisDrawing.ModelSpace.AddPolyline(point) ' 生成三角形
       Dim regionObj As Variant
       Set regionObj = ThisDrawing.ModelSpace.AddRegion(polyObj) ‘创造面域
       Dim height As Double
       Dim taperAngle As Double
       height = 255: taperAngle = 0
       Dim solidObj As Acad3DSolid
       Set solidObj = ThisDrawing.ModelSpace.AddExtrudeSolid(regionObj,height,taperAngle)’拉伸成三棱锥
End Sub
运行时会产生错误: 方法‘AddRegion' 作用于对象’IacadModelspace‘时失效
我在ACAD2002环境下运行。请大家帮忙找错误,谢谢了!

雪山飞狐_lzh 发表于 2004-5-31 18:33:00

AddRegion方法的参数是实体数组

zzz8662 发表于 2004-6-1 09:25:00

谢谢,能解释一下吗?

雪山飞狐_lzh 发表于 2004-6-1 10:24:00

AddRegion方法的参数是实体数组,返回值是也是是实体数组
Signature
RetVal = object.AddRegion(ObjectList)
Object
, ,
The object or objects this method applies to.
ObjectList
Array of Objects
The array of objects forming the closed coplanar face to be made into a region. This array may contain the following object types: , , , , , .
RetVal
Variant
This method outputs an array of the newly createdobjects.

zzz8662 发表于 2004-6-1 11:33:00

xiexie
页: [1]
查看完整版本: 画三棱锥----大家看看错误在哪里