tiancao1001 于 2009-05-22 04:44 PM 发表评论: |
SCREENSIZE 获取屏幕绘图区域像素的尺寸,通过该系统变量可以得到绘图区域的四个顶点坐标。 |
|
查看所评论的日志:田草日志 |
tiancao1001 于 2009-05-14 09:08 AM 发表评论: |
在CAD中,使用truetype字体,并且字体宽度为1,导出wmf后,再导入dwg,文字不会被炸开。 |
|
查看所评论的日志:田草日志 |
tiancao1001 于 2009-05-13 09:51 AM 发表评论: |
'得到鼠标屏幕坐标
Private Type POINTAPI x As Long Y As Long End Type
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Dim CAD_Point1 As Variant Dim CAD_Point2 As Variant Dim ScreenPoint1 As POINTAPI Dim ScreenPoint2(1) As Long Dim BiLi As Double '获取CAD坐标系统和屏幕像素的比值 Function ViewScreen() As Double Dim ScreenSize As Variant ScreenSize = ThisDrawing.GetVariable("screensize") '当前视口的屏幕宽度和高度 Dim H As Variant H = ThisDrawing.GetVariable("viewsize") '当前视图图形的实际高度 ViewScreen = Abs(H / ScreenSize(1)) End Function '通过CAD坐标计算屏幕坐标 Sub GetScreenPoint()
BiLi = ViewScreen CAD_Point1 = ThisDrawing.Utility.GetPoint(, "先指定一个点:") '获得鼠标所在位置的CAD坐标 ThisDrawing.ModelSpace.AddPoint CAD_Point1 GetCursorPos ScreenPoint1 '通过api直接获得鼠标所在位置的屏幕坐标 MsgBox "屏幕坐标:" & ScreenPoint1.x & " / " & ScreenPoint1.Y MsgBox "对应的CAD坐标:" & CAD_Point1(0) & " / " & CAD_Point1(1) '以上获得了CAD坐标和屏幕坐标的对应关系,下面就可以计算了 CAD_Point2 = ThisDrawing.Utility.GetPoint(CAD_Point1, "指定下一点,这个点将通过计算得到屏幕坐标:") ScreenPoint2(0) = Int(ScreenPoint1.x + (CAD_Point2(0) - CAD_Point1(0)) / BiLi) ScreenPoint2(1) = Int(ScreenPoint1.Y - (CAD_Point2(1) - CAD_Point1(1)) / BiLi) MsgBox "屏幕坐标:" & ScreenPoint2(0) & " / " & ScreenPoint2(1) '为了验证计算坐标,将CAD窗口在屏幕上移动到该点,看看效果吧。 ThisDrawing.Application.WindowState = acNorm ThisDrawing.Application.WindowLeft = ScreenPoint2(0) ThisDrawing.Application.WindowTop = ScreenPoint2(1) End Sub ' 通过屏幕坐标计算CAD坐标 Sub GetCAD_Point() BiLi = ViewScreen CAD_Point1 = ThisDrawing.Utility.GetPoint(, "先指定一个点:") '获得鼠标所在位置的CAD坐标 ThisDrawing.ModelSpace.AddPoint CAD_Point1 GetCursorPos ScreenPoint1 '通过api直接获得鼠标所在位置的屏幕坐标 MsgBox "屏幕坐标:" & ScreenPoint1.x & " / " & ScreenPoint1.Y MsgBox "对应的CAD坐标:" & CAD_Point1(0) & " / " & CAD_Point1(1) '以上获得了CAD坐标和屏幕坐标的对应关系,下面就可以计算了 Dim ScreenPoint3 As POINTAPI GetCursorPos ScreenPoint3 Dim CAD_Point3(2) As Double '计算cad坐标 CAD_Point3(0) = CAD_Point1(0) + BiLi * (ScreenPoint3.x - ScreenPoint1.x) CAD_Point3(1) = CAD_Point1(1) - BiLi * (ScreenPoint3.Y - ScreenPoint1.Y) CAD_Point3(2) = 0 MsgBox "屏幕坐标:" & CAD_Point3(0) & " / " & CAD_Point3(1) '为了验证计算坐标,将画一条直线,看看效果吧。 ThisDrawing.ModelSpace.AddLine CAD_Point1, CAD_Point3 End Sub
|
|
查看所评论的日志:CAD VBA实现橡皮筋直线、圆 |
tiancao1001 于 2009-05-06 07:46 PM 发表评论: |
|
查看所评论的日志:田草日志 |
tiancao1001 于 2009-04-22 08:13 PM 发表评论: |
你们好,都是VBA写的,不是编译好的exe,所以运行起来难免有很多错误,具体问题还得看是错误出在哪行代码上。 |
|
查看所评论的日志:田草CAD工具箱(VBA)安装程序(2009.04.13) |
tiancao1001 于 2009-04-11 09:52 PM 发表评论: |
你好,加载后,你可以停止vba的运行,然后到菜单:工具-->引用 中找到无效的dll,不勾选她。就可以了。 文件一般都在tiancaocadtools文件夹下面,你可以注册这些dll或ocx。 |
|
查看所评论的日志:田草CAD工具箱(VBA)安装程序(2009.04.13) |
tiancao1001 于 2009-04-11 09:49 PM 发表评论: |
你好,我不懂桥梁,你要实现什么功能到可以给我说说,也许能帮你实现。 |
|
查看所评论的日志:田草结构工具箱 |
tiancao1001 于 2009-03-22 08:33 PM 发表评论: |
beta 4 下载地址 ed2k://|file|AutoCAD%202010%20GatorB4x86.zip|1570360385|8D78CF18868C7A66237966D53E685A50|/
thunder://QUFlZDJrOi8vfGZpbGV8QXV0b0NBRCUyMDIwMTAlMjBHYXRvckI0eDg2LnppcHwxNTcwMzYwMzg1fDhENzhDRjE4ODY4QzdBNjYyMzc5NjZENTNFNjg1QTUwfC8NClpa
英文版下载后只能安装不能注册 |
|
查看所评论的日志:AutoCAD 2010 Revealed 发布啦 |