Follow

LISP, VBA, The Keyword Acquisition Of .NET

Updated : 2017-02-02 02:28:58 UTC

Applicable Products : IJCAD 2015 / 2016

Since the dynamic input support, keyword list of GetKeywaord such as Lisp of initget and VBA / .NET, which is to change the specification as enclosed in square brackets [], parentheses () can not be used.

The following is a sample of each language.

VB.NET

Imports GrxCAD.ApplicationServices
Imports GrxCAD.EditorInput
Imports GrxCAD.Runtime

<CommandMethod("GETKEYWORDTEST")>
Public Sub GetKeywordTest()
    Dim icDoc As Document = Application.DocumentManager.MdiActiveDocument
    Dim icEd As Editor = icDoc.Editor
    Dim pmtKeyOpt As New PromptKeywordOptions(vbCrLf + _
"Options [(T)est/(S)ample]", "Test Sample") pmtKeyOpt.AllowNone = True pmtKeyOpt.Keywords.Default = "Test" Dim pmtKeyRes As PromptResult = icEd.GetKeywords(pmtKeyOpt) If pmtKeyRes.Status = PromptStatus.OK Then icEd.WriteMessage(vbCrLf + pmtKeyRes.StringResult) End If End Sub

 

C#

using GrxCAD.ApplicationServices;
using GrxCAD.EditorInput;
using GrxCAD.Runtime;

[CommandMethod("GETKEYWORDTEST")]
public void GetKeywordTest()
{
    Document icDoc = Application.DocumentManager.MdiActiveDocument;
    Editor icEd = icDoc.Editor;

    PromptKeywordOptions pmtKeyOpt = new PromptKeywordOptions(
"\nOptions [(T)est/(S)ample]", "Test Sample"); pmtKeyOpt.AllowNone = true; pmtKeyOpt.Keywords.Default = "Test"; PromptResult pmtKeyRes = icEd.GetKeywords(pmtKeyOpt); if (pmtKeyRes.Status == PromptStatus.OK) { icEd.WriteMessage("\n" + pmtKeyRes.StringResult); } }

 

VBA

Public Sub GetKeywordTest()
    On Error Resume Next
    Call Utility.InitializeUserInput(0, "Test Sample")

     Dim res As String
     res = Utility.GetKeyword(vbCrLf + "Options [(T)est/(S)ample]:")
     If Err Then
         MsgBox Err.Description & "(" & Err.Number & ")"
         Exit Sub
     End If
     Utility.Prompt res
End Sub

 

LISP

(defun C:GETKYEWORDTEST ( / res )
  (initget 0 "Sample Test")
  (setq res (getkword "\nOptions [(S)ample/(T)est] : "))
  (print res)
  (princ)
)

S at the time of input and returns to the case of the T, _s, _sa, _sam ... and _t, _te, the "Test" Ya "Sample" in the case of _tes.

 

※ In the case of LIPS and VBA: If put at the end, the message at the time of start-up command: do not appear.

If not put: the messages displayed on the command line: is not displayed.

When attached: the messages displayed on the command line: is displayed.

 

 
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments