为什么我这么旋转不好用呢?
Sub test() Dim curves(0 To 3) As AcadEntity
' This example adds a line in model space Dim lineObj As AcadLine Dim startPoint(0 To 2) As Double Dim endPoint(0 To 2) As Double ' Define the start and end points for the line startPoint(0) = 1#: startPoint(1) = 1#: startPoint(2) = 0# endPoint(0) = 5#: endPoint(1) = 5#: endPoint(2) = 0# 'Á¬½Ó³É·â±ÕÇøÓò Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint) Dim offsetobj As Variant offsetobj = lineObj.Offset(0.25) Set curves(0) = lineObj Set curves(1) = offsetobj(0) Set curves(2) = ThisDrawing.ModelSpace.AddLine(lineObj.startPoint, offsetobj(0).startPoint) Set curves(3) = ThisDrawing.ModelSpace.AddLine(lineObj.endPoint, offsetobj(0).endPoint) ' Create the region Dim regionObj As Variant regionObj = ThisDrawing.ModelSpace.AddRegion(curves) regionObj(0).Color = acCyan ZoomAll MsgBox "Revolve the region to create the solid.", , "AddRevolvedSolid Example" ' Define the rotation axis Dim axisPt(0 To 2) As Double Dim axisDir(0 To 2) As Double Dim angle As Double axisPt(0) = 5: axisPt(1) = 5: axisPt(2) = 0 axisDir(0) = 11: axisDir(1) = 1: axisDir(2) = 3 angle = 0.785 ' Create the solid Dim solidObj As Acad3DSolid Set solidObj = ThisDrawing.ModelSpace.AddRevolvedSolid(regionObj(0), axisPt, axisDir, angle) solidObj.Color = acRed ZoomAll ' Change the viewing direction of the viewport 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 "Solid created.", , "AddRevolvedSolid Example"
End Sub
|