zlg258369 发表于 2011-3-31 10:19:00

能让AUTOCAD 听话的程序

别人发了个说话的,我发个听话的。Imports Autodesk..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
   _
      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
只包含一个命令

该贴已经同步到
**** Hidden Message *****

nxy_918 发表于 2011-3-31 10:25:00

晕!!!!

kwok 发表于 2011-3-31 20:41:00

牛..............

no13bus 发表于 2011-4-5 11:37:00

利用spi类库

aziz 发表于 2011-10-25 10:19:00

一楼代码有错误

zlg258369 发表于 2011-10-26 11:47:00


在我这是没问题滴

cabinsummer 发表于 2011-10-26 20:37:00


有错误就指出在哪里,怎么改。

aziz 发表于 2011-10-31 11:56:00

不好意思,我看错了的。没装.NET
页: [1]
查看完整版本: 能让AUTOCAD 听话的程序