Active Contributor
Posts: 35
Registered: ‎05-23-2012
Message 1 of 2 (169 Views)

Mysterious Case about "GetKeywords"

169 Views, 1 Replies
08-20-2012 09:53 PM

 MPlot(Mypointlist, Mnamestr, Mpoint3dL)
                    ' MsgBox(Realplot & "--" & iStep & "---" & Mss.Count)
                    ' Pause(5)
                    If Not Realplot Then
                        If iStep < Mss.Count Or (iStep = Mss.Count And Listdwg.Count > 0) Then

                            Dim pKeyOpts As PromptKeywordOptions = New PromptKeywordOptions("")
                            pKeyOpts.Message = vbLf & "是否预览下一张? "
                            pKeyOpts.Keywords.Default = "Y(是)"
                            pKeyOpts.AllowNone = True
                            ' MsgBox("ddd")
                            Dim pKeyRes As PromptResult = ed.GetKeywords(pKeyOpts)
                            ' MsgBox("ddd")
                            Dim Mopstr As String = pKeyRes.StringResult
                            If Mopstr = "" Then Mopstr = "N(否)"
                            If Mopstr = "N(否)" Then
                                Previewnext = False
                                Exit For
                                Previewnext = True
                            End If

                        End If
                    End If
                    PBar.Value = iStep
                    Label3.Text = (PBar.Value / PBar.Maximum).ToString("#0%", CultureInfo.InvariantCulture)
            Catch ex As Exception
                Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog(ex.Message & vbCr & ex.StackTrace & vbCrLf & "程序出错请联系作者!")
            End Try

Above is the  small part of my code. The code work well in the CAD 2008 , Well ,in the CAD2012

                            ' MsgBox("ddd")
                            Dim pKeyRes As PromptResult = ed.GetKeywords(pKeyOpts)
                            ' MsgBox("ddd")

this code just doesn't work. In fact it worked but  Canceled by the CADself !! Just like I put in the ESC key!   It doesn't stop to let you choose Y or N just be Canceled , It's so weird!!   I  Get the code out of my programm and debug the part code alone It just work well !  

  All the code works well in the CAD2008!  Just CAD2012, do you have run into the same problem ? Can you give some suggtions? Thank you !

ADN Support Specialist
Posts: 715
Registered: ‎03-21-2011
Message 2 of 2 (104 Views)

Re: Mysterious Case about "GetKeywords"

08-28-2012 06:48 AM in reply to: huaxiamengqing



Such automatic cancelling of input or commands is usually associated with fiber switching in AutoCAD.

Fibers are being removed in a phased manner in AutoCAD in the recent releases and this could be reason for the same code to work in AC 2008 while it does not in AC 2012. 


Can you please provide us a sample buildable project that has the same structure of your application ?

For example, how is the code snippet that you have shown get called in your actual app and so on ?


This will help us reproduce the issue and try and find another way to get the whole thing working.


Also, you may try creating a command out of the code that you have shown and then invoke it using "SendStringToExecute" in your main application.


Also, is it specific to the use of chinese characters ? From the description that you provided, I guess it is not.






Developer Technical Services
Autodesk Developer Network

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.