明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 852|回复: 6

AUTOCAD vba 面域拉伸画3D实体 报错高手进

[复制链接]
发表于 2015-1-4 15:49:23 | 显示全部楼层 |阅读模式
Public Sub Myl()
Dim MyLineObject(0) As AcadLWPolyline
Dim firstsolid As Acad3DSolid
Dim myarea As Variant

Dim BasePoints(11) As Double

BasePoints(0) = 0#
BasePoints(1) = 0#

BasePoints(2) = 55#
BasePoints(3) = -25#

BasePoints(4) = 145#
BasePoints(5) = -25#


BasePoints(6) = 200#
BasePoints(7) = 0#

BasePoints(8) = 145#
BasePoints(9) = 25#


BasePoints(10) = 55#
BasePoints(11) = 25#

Set MyLineObject(0) = ThisDrawing.ModelSpace.AddLightWeightPolyline(BasePoints)
MyLineObject(0).Closed = True
Dim H As Double
Dim t As Double
H = 30
t = 0
Set myarea = ThisDrawing.ModelSpace.AddRegion(MyLineObject)
Set firstsolid = ThisDrawing.ModelSpace.AddExtrudedSolid(myarea, H, t)

End Sub

 楼主| 发表于 2015-1-4 15:55:04 | 显示全部楼层
C:\Users\stx\Desktop\Untitled.jpg
 楼主| 发表于 2015-1-4 15:57:36 | 显示全部楼层
补发图,一个是报错图 一个是面域图,还不能画出3d实体

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2015-1-6 00:20:13 | 显示全部楼层
  1. Option Explicit


  2. Public Sub Myl()
  3. Dim MyLineObject(0) As AcadEntity
  4. Dim firstsolid As Acad3DSolid
  5. Dim myarea As Variant

  6. Dim BasePoints(11) As Double

  7. BasePoints(0) = 0#
  8. BasePoints(1) = 0#

  9. BasePoints(2) = 55#
  10. BasePoints(3) = -25#

  11. BasePoints(4) = 145#
  12. BasePoints(5) = -25#


  13. BasePoints(6) = 200#
  14. BasePoints(7) = 0#

  15. BasePoints(8) = 145#
  16. BasePoints(9) = 25#


  17. BasePoints(10) = 55#
  18. BasePoints(11) = 25#

  19. Set MyLineObject(0) = ThisDrawing.ModelSpace.AddLightWeightPolyline(BasePoints)
  20. MyLineObject(0).Closed = True
  21. Dim H As Double
  22. Dim t As Double
  23. H = 30
  24. t = 0
  25. myarea = ThisDrawing.ModelSpace.AddRegion(MyLineObject)
  26. Set firstsolid = ThisDrawing.ModelSpace.AddExtrudedSolid(myarea(0), H, t)

  27. End Sub
 楼主| 发表于 2015-1-7 08:42:11 | 显示全部楼层
zzyong00 发表于 2015-1-6 00:20

谢谢高手的指点迷津,我主要还不是很能分得清数据类型,另外我比较困惑什么时候用SET 什么时候不用

点评

数据类型是必须地整明白了! 被赋值的变量只有是对象时才用set  发表于 2015-1-7 09:27
 楼主| 发表于 2015-1-7 16:11:52 | 显示全部楼层
xueliang123 发表于 2015-1-7 08:42
谢谢高手的指点迷津,我主要还不是很能分得清数据类型,另外我比较困惑什么时候用SET 什么时候不用

弱弱的问一下zzyong00 ,你回复我的时候存放程序的界面是什么软件啊 挺方便的
发表于 2015-1-8 13:39:17 | 显示全部楼层
就是这个打字的地方,上面第六个按钮
这问题。。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-25 12:58 , Processed in 0.161383 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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