iCAx开思网
标题:
请教一个很菜鸟的问题——怎么用vba画椭球体?
[打印本页]
作者:
magicpu
时间:
2005-7-26 22:46
标题:
请教一个很菜鸟的问题——怎么用vba画椭球体?
本人想通过AddRevolvedSolid命令实现,似乎这个命令只对直线和圆弧有效,对椭圆好像不行,望大虾指教
作者:
qomolangma
时间:
2005-7-27 13:41
可以先做成半个椭圆,形成面域之后在回转成椭球体。
作者:
magicpu
时间:
2005-7-28 13:17
呵呵,谢了,昨天仔细研究了一下,终于搞定了
Public Sub AddMyEllipsoid(ellipsoid As EllipsoidModel)
Dim majAxis(0 To 2) As Double
Dim center(0 To 2) As Double
Dim radRatio As Double
Dim curves(0 To 1) As AcadEntity
Dim regionObj As Variant
Dim startpt(0 To 2) As Double
Dim endpt(0 To 2) As Double
center(0) = ellipsoid.cx: center(1) = ellipsoid.cy: center(2) = ellipsoid.cz
majAxis(0) = ellipsoid.rx: majAxis(1) = 0: majAxis(2) = 0
radRatio = ellipsoid.ry / ellipsoid.rx
Set curves(0) = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)
curves(0).StartParameter = 0
curves(0).EndParameter = 3.141592
startpt(0) = ellipsoid.cx: startpt(1) = ellipsoid.cy: startpt(2) = ellipsoid.cz
endpt(0) = ellipsoid.rx: endpt(1) = 0: endpt(2) = 0
Set curves(1) = ThisDrawing.ModelSpace.AddLine(curves(0).StartPoint, curves(0).EndPoint)
regionObj = ThisDrawing.ModelSpace.AddRegion(curves)
Set ModelObj = ThisDrawing.ModelSpace.AddRevolvedSolid(regionObj(0), startpt, endpt, 6.28)
End Sub
其中EllipsoidModel是个结构体
欢迎光临 iCAx开思网 (https://www.icax.org/)
Powered by Discuz! X3.3