• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    .NET

    Reply
    Distinguished Contributor
    Posts: 202
    Registered: ‎09-04-2002

    list dot paired to form

    113 Views, 6 Replies
    04-18-2012 07:45 AM

    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 !)

    Please use plain text.
    *Expert Elite*
    Posts: 1,640
    Registered: ‎04-29-2006

    Re : list dot paired to form

    04-18-2012 08:33 AM in reply to: dolives

    Salut,

     

    Comment to code obtient-il cette liste, depuis un LISP ?

    How do your code get this list, from a LISP ?

    Gilles Chanteau
    Please use plain text.
    *Expert Elite*
    Hallex
    Posts: 1,338
    Registered: ‎10-08-2008

    Re: list dot paired to form

    04-18-2012 08:36 AM in reply to: dolives

    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'~

    _____________________________________
    C6309D9E0751D165D0934D0621DFF27919
    Please use plain text.
    *Expert Elite*
    arcticad
    Posts: 1,251
    Registered: ‎06-21-2004

    Re: list dot paired to form

    04-18-2012 08:50 AM in reply to: Hallex

    http://www.dotnetperls.com/keyvaluepair-vbnet

    ---------------------------



    “We don’t have a snowball’s chance in a blast furnace of surviving this attack unless every one of our units gets into the fight right now!”
    Please use plain text.
    Distinguished Contributor
    Posts: 202
    Registered: ‎09-04-2002

    Re: list dot paired to form

    04-19-2012 09:19 AM in reply to: dolives

    Hi,

    Thank you very much !

    Daniel OLIVES

    Please use plain text.
    Distinguished Contributor
    Posts: 202
    Registered: ‎09-04-2002

    Re : list dot paired to form

    04-19-2012 09:24 AM in reply to: _gile

    Hi Gile,

    Yes the list is create form lisp code, i try to just put it in a form i, dot net !

     

    daniel OLIVES

    Please use plain text.
    *Expert Elite*
    Posts: 1,640
    Registered: ‎04-29-2006

    Re : list dot paired to form

    04-19-2012 11:39 AM in reply to: dolives

    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.

    Gilles Chanteau
    Please use plain text.