明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1728|回复: 4

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

[复制链接]
发表于 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环境下运行。请大家帮忙找错误,谢谢了!
发表于 2004-5-31 18:33:00 | 显示全部楼层
AddRegion方法的参数是实体数组
 楼主| 发表于 2004-6-1 09:25:00 | 显示全部楼层
谢谢,能解释一下吗?
发表于 2004-6-1 10:24:00 | 显示全部楼层

AddRegion方法的参数是实体数组,返回值是也是是实体数组

Signature

RetVal = object.AddRegion(ObjectList)

Object

MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_modelspace_collection.htm" target="_blank" >ModelSpace Collection, MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_paperspace_collection.htm" target="_blank" >PaperSpace Collection, MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_block_object.htm" target="_blank" >Block
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: MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_line_object.htm" target="_blank" >Line, MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_arc_object.htm" target="_blank" >Arc, MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_circle_object.htm" target="_blank" >Circle, MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_ellipse_object.htm" target="_blank" >Elliptical Arc, MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_lightweightpolyline_object.htm" target="_blank" >LightweightPolyline, MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_spline_object.htm" target="_blank" >Spline.

RetVal

Variant
This method outputs an array of the newly created MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_region_object.htm" target="_blank" >Region objects.

 楼主| 发表于 2004-6-1 11:33:00 | 显示全部楼层
xiexie
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-28 05:35 , Processed in 0.161349 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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