能让AUTOCAD 听话的程序
本帖最后由 zlg258369 于 2011-4-1 22:09 编辑别人发了个说话的,我发个听话的。Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Public Class wenzibiaozhu
Dim WithEvents RC As SpeechLib.SpSharedRecoContext
Dim myGrammar As SpeechLib.ISpeechRecoGrammar
Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
<CommandMethod("TH")> _
Public Sub Ting()
On Error Resume Next
RC = New SpeechLib.SpSharedRecoContextClass
myGrammar = RC.CreateGrammar
Dim hostName As String = System.Reflection.Assembly.GetExecutingAssembly().Location
Dim str As String = hostName.Substring(0, hostName.LastIndexOf(‘\’))
myGrammar.CmdLoadFromFile(str & "\command.xml", SpeechLib.SpeechLoadOption.SLODynamic)
myGrammar.DictationSetState(SpeechLib.SpeechRuleState.SGDSActive)
End Sub
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
Select Case Result.PhraseInfo.GetText
Case "镜像"
acDoc.SendStringToExecute("_mirror ", True, False, False)
Case Else
MsgBox("你说的是" & Result.PhraseInfo.GetText & ",再说一遍!")
End Select
End Sub
End Class
只包含一个命令
http://bbs.mjtd.com/xwb/images/bgimg/icon_logo.png 该贴已经同步到 zlg258369的微博
晕!!!! 牛.............. 利用spi类库 一楼代码有错误 aziz 发表于 2011-10-25 10:19 static/image/common/back.gif
一楼代码有错误
在我这是没问题滴
aziz 发表于 2011-10-25 10:19 static/image/common/back.gif
一楼代码有错误
有错误就指出在哪里,怎么改。 不好意思,我看错了的。没装.NET
页:
[1]