乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
楼主: 329

Autocad。激活或Autocad。设置焦点

[复制链接]

0

主题

7

帖子

2

银币

初来乍到

Rank: 1

铜币
7
发表于 2007-10-24 14:18:25 | 显示全部楼层

我不'我不认为这会起作用:语法有道理,但我不'我不知道你会怎么触发它
  1. If SendKeys = "{F8}"
  2. Then Application.VBE.MainWindow.Visible = False
  3. End If
回复

使用道具 举报

0

主题

5

帖子

3

银币

初来乍到

Rank: 1

铜币
6
发表于 2007-10-24 14:20:08 | 显示全部楼层

我刚刚回答了你在CM上面的问题,那就是ACAD如何知道你点击F8,如何在你需要的特定事件中触发它,我不确定
回复

使用道具 举报

0

主题

6

帖子

4

银币

初来乍到

Rank: 1

铜币
8
发表于 2007-10-24 14:45:40 | 显示全部楼层
ML,I'我不确定你'我正确地得到了他想要的 何#039;s正在谈论使用F8在VBAIDE中一次一行地遍历代码 当acad中需要输入时,例如选择,他希望焦点切换到acad窗口 如果使用Application.VBE.MainWindow。Visible=False在遍历代码时,它只会在到达下一行代码所需的瞬间关闭IDE 我尝试了旧的awesomey acad示例事件代码dvb,以查看选择是否触发了任何事件,并且它没有't似乎;我使用了下面的代码 当宽度更改但'这是唯一让我兴奋的事件
  1. '      AutoCAD 2000
  2. '
  3. '      Events Example Code ActiveX Automation.
  4. '
  5. '      Copyright (C) 1999 by Autodesk, Inc.
  6. '
  7. '      Permission to use, copy, modify, and distribute this software
  8. '      for any purpose and without fee is hereby granted, provided
  9. '      that the above copyright notice appears in all copies and
  10. '      that both that copyright notice and the limited warranty and
  11. '      restricted rights notice below appear in all supporting
  12. '      documentation.
  13. '
  14. '      AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
  15. '      AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
  16. '      MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.
  17. '      DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
  18. '      UNINTERRUPTED OR ERROR FREE.
  19. '
  20. '      Use, duplication, or disclosure by the U.S. Government is subject to
  21. '      restrictions set forth in FAR 52.227-19 (Commercial Computer
  22. '      Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
  23. '      (Rights in Technical Data and Computer Software), as applicable.
  24. '
  25. Option Explicit
  26. Public WithEvents PLine As AcadLWPolyline       ' Use with Modified Event Example
  27. Public WithEvents ACADApp As AcadApplication    ' Use with Application Event Examples
  28. '------------------------------------------------------------------
  29. ' Document Events
  30. '------------------------------------------------------------------
  31. Private Sub AcadDocument_Activate()
  32.     ' This example intercepts a drawing Activate event.
  33.     '
  34.     ' This event is triggered when a drawing window becomes active.
  35.     '
  36.     ' To trigger this example event: Either open a new drawing or switch from
  37.     ' one drawing window to another
  38.     MsgBox "You have just activated a drawing!"
  39. End Sub
  40. Private Sub AcadDocument_BeginClose()
  41.     ' This example intercepts a drawing BeginClose event.
  42.     '
  43.     ' This event is triggered when a drawing receives a request to close.
  44.     '
  45.     ' To trigger this example event: Close an open drawing
  46.     MsgBox "A drawing has just been closed!"
  47. End Sub
  48. Private Sub AcadDocument_BeginCommand(ByVal CommandName As String)
  49.     ' This example intercepts a drawing BeginCommand event.
  50.     '
  51.     ' This event is triggered when a drawing receives
  52.     ' any command compatible with this event.
  53.     '
  54.     ' To trigger this example event: Issue any command to an open drawing from
  55.     ' either the command line, VBA, the ACAD menus, the ACAD toolbars, or LISP.
  56.     ' Use the "CommandName" variable to determine which command was started
  57.     MsgBox "A drawing has just been issued a " & CommandName & " command."
  58. End Sub
  59. '----------------------------------------------------------------------------
  60. ' Modified (PLINE) Event Sample
  61. '----------------------------------------------------------------------------
  62. Sub Example_Modified()
  63.      ' This example creates a light weight polyline in model space and
  64.      ' references the new PolyLine using the public variable (PLine) which
  65.      ' is setup to intercept Modified events.
  66.      '
  67.      ' This example then modifies the new object, triggering the code
  68.      ' in the Modified event.
  69.    
  70.     Dim points(0 To 9) As Double
  71.    
  72.     ' Define the 2D polyline points
  73.     points(0) = 1: points(1) = 1
  74.     points(2) = 1: points(3) = 2
  75.     points(4) = 2: points(5) = 2
  76.     points(6) = 3: points(7) = 2
  77.     points(8) = 4: points(9) = 4
  78.         
  79.     ' Create a light weight Polyline object in model space
  80.     '
  81.     ' * Note: We are returning the new PolyLine object into a Module
  82.     ' level variable.  This allows us to intercept events associated
  83.     ' with that particular object.
  84.     Set PLine = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
  85.    
  86.     ThisDrawing.Application.ZoomAll
  87.    
  88.     ' Modify object to trigger event.
  89.     '
  90.     ' * Note: The event code for the PolyLine modification will be triggered
  91.     ' before we move forward and refresh the view, so the line will not
  92.     ' appear red when the event message box is displayed
  93.     PLine.color = acRed
  94.     ThisDrawing.Regen acAllViewports
  95.    
  96. End Sub
  97. Private Sub PLine_Modified(ByVal pObject As AutoCAD.IAcadObject)
  98.     ' This example intercepts an object's Modified event.
  99.     '
  100.     ' This event is triggered when an object supporting this event is modified
  101.     '
  102.     ' To trigger this code: Modifiy an object connected to this event
  103.     ' * Note: By connected, we mean the object setup to intercept events using
  104.     ' the VBA WithEvents statement
  105.     ' Use the "pObject" variable to determine which object was modified
  106.     MsgBox "You just modified an object with an ID of: " & pObject.ObjectID
  107.    
  108. End Sub
  109. Sub test()
  110. Dim objPL As AcadLWPolyline
  111. Dim varPnt As Variant
  112. ThisDrawing.Utility.GetEntity objPL, varPnt
  113. objPL.ConstantWidth = 1
  114. End Sub
回复

使用道具 举报

0

主题

7

帖子

6

银币

初来乍到

Rank: 1

铜币
9
发表于 2007-10-24 14:58:22 | 显示全部楼层

嗨,鲍勃,我确实明白他想要什么,但我不知道怎么去;“我只是在抓吸管,”CM说,“ACAD怎么知道我什么时候按F8?”?我刚才说了怎么做
  1. If SendKeys = "{F8}"
  2. 'whatever code you want
  3. End If
我也说过我不'我不知道他需要什么
哦,好吧,我们可以'不要什么都有,对吗
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-7-6 08:26 , Processed in 0.503375 second(s), 59 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表