Hi,
I try to make a form with à list dot paired:
(("mscorlib.dll" . "2.0.0.0") ("AcdbMgd.dll" . "18.0.0.0"))
A simple form with 2 column and a windows not fix, expandable !
My problem how to transfert list to .net (VB) ?
Daniel OLIVES
(Sorry for my poor english a french user !)
Have you tried Dictionary(of string,string) or something else
Try this out
Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument Dim ed As Editor = doc.Editor Dim dict As Dictionary(Of String, String) = New Dictionary(Of String, String) dict.Add("mscorlib.dll", "2.0.0.0") dict.Add("AcdbMgd.dll", "18.0.0.0") For Each key As String In dict.Keys ed.WriteMessage(vbLf + "{0}" + vbTab + "{1}", key, dict(key)) Next
~'J'~
http://www.dotnetperls.com/keyvaluepair-vbnet
If I don't misunderstand, you build a LispFunction which an argument is dotted pair list, for example:
(foo '(("mscorlib.dll" . "2.0.0.0") ("AcdbMgd.dll" . "18.0.0.0")))
Your NET code will get the argument as a ResultBuffer (a collection of TypedValues). For the upper example the ResultBuffer will contain these TypedValues where the first item (TypeCode) is a value of the LispDataType enum.
For example, this LispFunction Method:
[LispFunction("foo")] public TypedValue foo(ResultBuffer resbuf) { Editor ed = AcAp.DocumentManager.MdiActiveDocument.Editor; if (resbuf == null) return new TypedValue((short)LispDataType.Nil); else { foreach (TypedValue tv in resbuf) { ed.WriteMessage("{0} : {1}\n", tv.TypeCode, tv.Value); } return new TypedValue((short)LispDataType.T_atom); } }
with (foo '(("mscorlib.dll" . "2.0.0.0") ("AcdbMgd.dll" . "18.0.0.0"))) will write on command line:
5016 : -1
5016 : -1
5005 : mscorlib.dll
5005 : 2.0.0.0
5018 : -1
5016 : -1
5005 : AcdbMgd.dll
5005 : 18.0.0.0
5018 : -1
5017 : -1
5016 => LispDataType.ListBegin
5005 => LispDataType.Text
5018 => LispDataType.DottedPair
5017 => LispDataTypeListEnd
Care, if your dotted pairs have a key/value corresponding to valid TypedValues (DxfCode and a corresponding value) it will be seen by .NET as a single TypedValue.
(foo '((0 . "INSERT") (10 0.0 0.0 0.0) (66 . 1)))
will print:
5016 : -1
0 : INSERT
10 : (0,0,0)
66 : 1
5017 : -1
I expect it helps. Feel free to post on a French speaking forum we both de more comfortable.