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

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

<b>三棱锥型的创建法:<BR><BR>  1)生成多段线(Addpolyline);<BR><BR>  2)产生区域(AddRegion)后通过挤压(AddExtrudedSolid)</b>


程序如下:


                       <BR>Sub CreatePyramid()<BR>       Dim polyObj As AcadPolyline<BR>       Dim point(0 To 11) As Double<BR>       point(0) = 0: point(1) = 0: point(2) = 0<BR>       point(3) = 255: point(4) = 0: point(5) = 0<BR>       point(6) = 128: point(7) = 221.7025: point(8) = 0<BR>       point(9) = 0: point(10) = 0: point(11) = 0<BR>       Set polyObj = ThisDrawing.ModelSpace.AddPolyline(point) ' 生成三角形<BR>       Dim regionObj As Variant<BR>       Set regionObj = ThisDrawing.ModelSpace.AddRegion(polyObj) ‘创造面域<BR>       Dim height As Double<BR>       Dim taperAngle As Double<BR>       height = 255: taperAngle = 0<BR>       Dim solidObj As Acad3DSolid<BR>       Set solidObj = ThisDrawing.ModelSpace.AddExtrudeSolid(regionObj,height,taperAngle)’拉伸成三棱锥<BR>End Sub


<b>运行时会产生错误: 方法‘AddRegion' 作用于对象’IacadModelspace‘时失效</b>


<b>我在ACAD2002环境下运行。请大家帮忙找错误,谢谢了!<BR>

</b>

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

AddRegion方法的参数是实体数组

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

谢谢,能解释一下吗?

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

<P class=Heading-2>AddRegion方法的参数是实体数组,返回值是也是是实体数组
<P class=Heading-2>Signature
<P class=syntax>RetVal = object.AddRegion(ObjectList)
<P class=element>Object


<P class=element-desc><A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_modelspace_collection.htm" target="_blank" >ModelSpace Collection</A>, <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_paperspace_collection.htm" target="_blank" >PaperSpace Collection</A>, <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_block_object.htm" target="_blank" >Block</A><BR>The object or objects this method applies to.
<P class=element>ObjectList


<P class=element-desc>Array of Objects<BR>The array of objects forming the closed coplanar face to be made into a region. This array may contain the following object types: <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_line_object.htm" target="_blank" >Line</A>, <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_arc_object.htm" target="_blank" >Arc</A>, <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_circle_object.htm" target="_blank" >Circle</A>, <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_ellipse_object.htm" target="_blank" >Elliptical Arc</A>, <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_lightweightpolyline_object.htm" target="_blank" >LightweightPolyline</A>, <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_spline_object.htm" target="_blank" >Spline</A>.
<P class=element>RetVal


<P class=element-desc>Variant<BR>This method outputs an array of the newly created <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_region_object.htm" target="_blank" >Region</A> objects.

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

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