AddRevolvedSolid Пример |
Sub Example_AddRevolvedSolid() ' Этот пример создает тело из области, вращаемой вокруг оси. ' Область создана из дуги и линии. Dim curves(0 To 1) As AcadEntity ' Определите дугу Dim centerPoint(0 To 2) As Double Dim radius As Double Dim startAngle As Double Dim endAngle As Double centerPoint(0) = 5#: centerPoint(1) = 3#: centerPoint(2) = 0# radius = 2# startAngle = 0 endAngle = 3.141592 Set curves(0) = ThisDrawing.ModelSpace.AddArc(centerPoint, radius, startAngle, endAngle) ' Определите линию Set curves(1) = ThisDrawing.ModelSpace.AddLine(curves(0).startPoint, curves(0).endPoint) ' Создайте область Dim regionObj As Variant regionObj = ThisDrawing.ModelSpace.AddRegion(curves) ZoomAll MsgBox "Вращайте область, чтобы создать тело.", , "AddRevolvedSolid Пример" ' Определите ось вращения Dim axisPt(0 To 2) As Double Dim axisDir(0 To 2) As Double Dim angle As Double axisPt(0) = 7: axisPt(1) = 2.5: axisPt(2) = 0 axisDir(0) = 11: axisDir(1) = 1: axisDir(2) = 3 angle = 6.28 ' Создайте тело Dim solidObj As Acad3DSolid Set solidObj = ThisDrawing.ModelSpace.AddRevolvedSolid(regionObj(0), axisPt, axisDir, angle) ZoomAll ' Измените направление рассмотрения области просмотра Dim NewDirection(0 To 2) As Double NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1 ThisDrawing.ActiveViewport.direction = NewDirection ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport ZoomAll MsgBox "Созданное тело.", , "AddRevolvedSolid Пример" End Sub