关于在 3D 中旋转 (VBA/ActiveX)
使用该方法,您可以围绕指定点以 2D 形式旋转对象。Rotate 旋转方向由 WCS 确定。该方法以 3D 形式围绕指定的轴旋转对象。该方法采用三个值作为输入:定义旋转轴的两点的 WCS 坐标和以弧度为单位的旋转角度。Rotate3DRotate3D ![]() 若要旋转 3D 对象,请使用 or 方法。RotateRotate3D 创建一个 3D 盒子并绕轴旋转它本示例创建一个 3D 框。然后,它定义要旋转的轴,最后将盒子绕轴旋转 30 度。 Sub Ch8_Rotate_3DBox()
Dim boxObj As Acad3DSolid
Dim length As Double
Dim width As Double
Dim height As Double
Dim center(0 To 2) As Double
' Define the box
center(0) = 5: center(1) = 5: center(2) = 0
length = 5
width = 7
height = 10
' Create the box object in model space
Set boxObj = ThisDrawing.ModelSpace. _
AddBox(center, length, width, height)
' Define the rotation axis with two points
Dim rotatePt1(0 To 2) As Double
Dim rotatePt2(0 To 2) As Double
Dim rotateAngle As Double
rotatePt1(0) = -3: rotatePt1(1) = 4: rotatePt1(2) = 0
rotatePt2(0) = -3: rotatePt2(1) = -4: rotatePt2(2) = 0
rotateAngle = 30
rotateAngle = rotateAngle * 3.141592 / 180#
' Rotate the box
boxObj.Rotate3D rotatePt1, rotatePt2, rotateAngle
ZoomAll
End Sub
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-11-1 12:02
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.