声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 2938|回复: 3

[AutoCAD] 基于VB&AutoCAD的螺旋面的绘制(原代码)

[复制链接]
发表于 2006-9-14 20:23 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
Private Sub Command1_Click()

Dim theta, r1, r2, h1, h0, l

l = Val(Me.Text1)

theta = Val(Me.Text2) / 180 * 3.1415

r1 = Val(Me.Text3)

r2 = Val(Me.Text4)

ActiveDocument.SendCommand "_shademode" + vbCr + "_G" + vbCr

Dim center_point(0 To 2) As Double

center_point(0) = 0: center_point(1) = 0: center_point(2) = 0

Dim lines(0 To 0) As AcadCircle

Set lines(0) = ActiveDocument.ModelSpace.AddCircle(center_point, r2)

Dim region As Variant

region = ActiveDocument.ModelSpace.AddRegion(lines)

Dim base As Acad3DSolid

h = 5 * l

Set base = ActiveDocument.ModelSpace.AddExtrudedSolid(region(0), h, 0)

base.Color = acBlue

Dim ptcontrol() As Double

Dim ptcontrol1() As Double

Dim k As Integer

Dim liness(0 To 700) As AcadLine

k = 700

ReDim ptcontrol(3 * k + 2) As Double

ReDim ptcontrol1(3 * k + 2) As Double

Dim stpt(0 To 2) As Double

Dim etpt(0 To 2) As Double

For i = 0 To k Step 1

ptcontrol(3 * i) = r2 * Cos(2 * 3.1415926 * i / 180)

ptcontrol(3 * i + 1) = r2 * Sin(2 * 3.1415926 * i / 180)

ptcontrol(3 * i + 2) = l / (2 * 3.1415) * (2 * 3.1415926 * i / 180) + r2 * Tan(theta) - 5

stpt(0) = ptcontrol(3 * i): stpt(1) = ptcontrol(3 * i + 1): stpt(2) = ptcontrol(3 * i + 2)

ptcontrol1(3 * i) = r1 * Cos(2 * 3.1415926 * i / 180)

ptcontrol1(3 * i + 1) = r1 * Sin(2 * 3.1415926 * i / 180)

ptcontrol1(3 * i + 2) = l / (2 * 3.1415) * (2 * 3.1415926 * i / 180) + r1 * Tan(theta) - 5

etpt(0) = ptcontrol1(3 * i): etpt(1) = ptcontrol1(3 * i + 1): etpt(2) = ptcontrol1(3 * i + 2)

Set liness(i) = ActiveDocument.ModelSpace.AddLine(stpt, etpt)

liness(i).Color = acRed

Next i

Dim luo As Acad3DPolyline

Set luo = ActiveDocument.ModelSpace.Add3DPoly(ptcontrol1)

luo.Color = acGreen

Dim wailuo As Acad3DPolyline

Set wailuo = ActiveDocument.ModelSpace.Add3DPoly(ptcontrol)

wailuo.Color = acYellow

End Sub

Private Sub Command2_Click()

End

End Sub
附件:

2223  [时间:2006-9-14 20:23]

[ 本帖最后由 huright 于 2007-8-8 18:28 编辑 ]

评分

1

查看全部评分

回复
分享到:

使用道具 举报

发表于 2006-9-20 16:00 | 显示全部楼层
感谢呀,我正在找这方面的资料。
发表于 2007-11-16 15:59 | 显示全部楼层
我是菜鸟啊。。。。想问一下然后怎么继续把得到的线框转化到曲面或实体啊~谢谢~~~
发表于 2007-11-19 13:56 | 显示全部楼层
不知道这些代码是在哪里用的,请楼主把这个操作步骤的弄得详细一些,
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-11-15 19:59 , Processed in 0.073850 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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