明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2140|回复: 7

[资源] 能让AUTOCAD 听话的程序

[复制链接]
发表于 2011-3-31 10:19 | 显示全部楼层 |阅读模式
本帖最后由 zlg258369 于 2011-4-1 22:09 编辑

别人发了个说话的,我发个听话的。
  1. Imports Autodesk.AutoCAD.Runtime
  2. Imports Autodesk.AutoCAD.ApplicationServices
  3. Imports Autodesk.AutoCAD.DatabaseServices


  4. Public Class wenzibiaozhu

  5.     Dim WithEvents RC As SpeechLib.SpSharedRecoContext
  6.     Dim myGrammar As SpeechLib.ISpeechRecoGrammar
  7.     Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument

  8.     <CommandMethod("TH")> _
  9.         Public Sub Ting()

  10.         On Error Resume Next
  11.         RC = New SpeechLib.SpSharedRecoContextClass
  12.         myGrammar = RC.CreateGrammar
  13.         Dim hostName As String = System.Reflection.Assembly.GetExecutingAssembly().Location
  14.         Dim str As String = hostName.Substring(0, hostName.LastIndexOf(‘\’))

  15.         myGrammar.CmdLoadFromFile(str & "\command.xml", SpeechLib.SpeechLoadOption.SLODynamic)
  16.         myGrammar.DictationSetState(SpeechLib.SpeechRuleState.SGDSActive)

  17.     End Sub

  18.     Private Sub RC_Recognition1(ByVal StreamNumber As Integer, ByVal StreamPosition As Object, ByVal RecognitionType As SpeechLib.SpeechRecognitionType, ByVal Result As SpeechLib.ISpeechRecoResult) Handles RC.Recognition

  19.         Select Case Result.PhraseInfo.GetText
  20.             Case "镜像"
  21.                 acDoc.SendStringToExecute("_mirror ", True, False, False)

  22.             Case Else

  23.                 MsgBox("你说的是" & Result.PhraseInfo.GetText & ",再说一遍!")

  24.         End Select
  25.     End Sub

  26. End Class


只包含一个命令


该贴已经同步到 zlg258369的微博

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2011-3-31 10:25 | 显示全部楼层
晕!!!!
发表于 2011-3-31 20:41 | 显示全部楼层
牛..............
发表于 2011-4-5 11:37 | 显示全部楼层
利用spi类库
发表于 2011-10-25 10:19 | 显示全部楼层
一楼代码有错误
 楼主| 发表于 2011-10-26 11:47 | 显示全部楼层
aziz 发表于 2011-10-25 10:19
一楼代码有错误

在我这是没问题滴
发表于 2011-10-26 20:37 | 显示全部楼层
aziz 发表于 2011-10-25 10:19
一楼代码有错误

有错误就指出在哪里,怎么改。
发表于 2011-10-31 11:56 | 显示全部楼层
不好意思,我看错了的。没装.NET
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-18 21:50 , Processed in 0.352197 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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