明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1705|回复: 2

vba中如何实现鼠标控制三维图形的移动!请高手指点!谢谢!

[复制链接]
发表于 2004-3-24 22:37:00 | 显示全部楼层 |阅读模式
请问斑竹和高手、大侠指点:


vba中如何实现鼠标控制三维图形的移动!请高手指点!谢谢!
发表于 2004-3-25 19:53:00 | 显示全部楼层
鼠标是用手控制的,而不是用程序控制的。
 楼主| 发表于 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
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-28 07:50 , Processed in 0.159962 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表