Hi Fredrik,
I have not seen any such documentation explaining the max limit or the list of acceptable characters.
If you can provide a sample code to reproduce the "IndexOutofrange" exception, I can try it at my end and see what might be causing it.
Just to test the basic keywords with alphabets / numbers and "?", I tried this code snippet and it worked ok.
This code uses about 39 keywords and it worked ok.
public class TestJig : EntityJig
{
public TestJig() : base(new Autodesk.AutoCAD.DatabaseServices.DBPoint())
{
}
protected override SamplerStatus Sampler(JigPrompts prompts)
{
JigPromptPointOptions jigOpts = new JigPromptPointOptions();
jigOpts.UserInputControls = (UserInputControls.Accept3dCoordinates |
UserInputControls.NullResponseAccepted |
UserInputControls.NoNegativeResponseAccepted);
string msgAndKwds = "\nSpecify a point or [A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/?/0/1/2/3/4/5/6/7/8/9/10/11]: ";
string kwds = "Apple Box Cow Duck Eagle Fox Goat Hen Ink Jug Kangaroo Lion Moon Night Ox Peacock Quiet Rope Store Tank Umbrella Van Wax Xylophone Yak Zebra ?Help 00 10 20 30 40 50 60 70 80 90 100 110";
jigOpts.SetMessageAndKeywords(msgAndKwds, kwds);
PromptPointResult res = prompts.AcquirePoint(jigOpts);
if (res.Status == PromptStatus.Keyword)
{
Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage(String.Format("{0}Keyword : {1}", Environment.NewLine, res.StringResult));
return SamplerStatus.OK;
}
else if (res.Status == PromptStatus.OK)
{
return SamplerStatus.OK;
}
return SamplerStatus.Cancel;
}
protected override bool Update()
{
return true;
}
[CommandMethod("TestJig")]
public static void RunTestJig()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
TestJig jig = new TestJig();
while (true)
{
PromptResult res = ed.Drag(jig);
switch (res.Status)
{
case PromptStatus.OK:
break;
case PromptStatus.Keyword:
break;
case PromptStatus.None:
return;
default:
jig.Entity.Dispose();
return;
}
}
}
}
I am not sure what the upper limit is, but it might be confusing for the end-users if too many keywords are provided at once. You may want to accept a keyword and then provide another set of keywords based on the first input. For example : Accept the series name "M", "K" .... and then provide further keyword options such as "M10", "M20" if the keyword selected was "M".
Balaji
Developer Technical Services
Autodesk Developer Network