呵呵,谢了,昨天仔细研究了一下,终于搞定了
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是个结构体 |