|
发表于 2004-3-25 21:02:00
|
显示全部楼层
不是这个意思!
我的意思是通过鼠标单击的感应确定三维图形的移动
在vba中实现
请斑竹多多指教
万分感激!谢谢!!
顺便请您帮我检查一下我的程序!
是移动三维图形的!
Public Sub MoveShape()
'move a shape from a to b in one or more step
Dim ShapeObject As Acad3DSolid
Const NumberOfMoves = 200
Dim StartPoint As Variant, EndPoint As Variant
Dim CurrentPosition(0 To 2) As Double
Dim LastPosition As Variant
Dim IncX As Double, IncY As Double, IncZ As Double
Dim Count As Integer, ButtonClicked As Integer
StartPoint = ThisDrawing.Utility.GetPoint(, "Enter the startpoint for the starting position for the direction of the move. ")
EndPoint = ThisDrawing.Utility.GetPoint(StartPoint, "Enter the EndPoint for the Ending Position for the direction of the move")
ButtonClicked = MsgBox("Do you want to animate the move?", vbYesNo, "Moving Shape")
If ButtonClicked = vbYes Then
IncX = (EndPoint(0) - StartPoint(0)) / NumberOfMoves
IncY = (EndPoint(1) - StartPoint(1)) / NumberOfMoves
IncZ = (EndPoint(2) - StartPoint(2)) / NumberOfMoves
LastPosition = StartPoint
CurrentPosition(0) = StartPoint(0)
CurrentPosition(1) = StartPoint(1)
CurrentPosition(2) = StartPoint(2)
For Count = 1 To NumberOfMoves
CurrentPosition(0) = CurrentPosition(0) + IncX
CurrentPosition(1) = CurrentPosition(1) + IncY
CurrentPosition(2) = CurrentPosition(2) + IncZ
ShapeObject.Move LastPosition, CurrentPosition
LastPosition = CurrentPosition
ShapeObject.Update
Next
Else
ShapeObject.Move StartPoint, EndPoint
ShapeObject.Update
End If
End Sub |
|