.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

list dot paired to form

6 REPLIES 6
Reply
Message 1 of 7
dolives
658 Views, 6 Replies

list dot paired to form

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

6 REPLIES 6
Message 2 of 7
_gile
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
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 3 of 7
Hallex
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
Message 4 of 7
arcticad
in reply to: Hallex

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

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



(defun botsbuildbots() (botsbuildbots))
Message 5 of 7
dolives
in reply to: dolives

Hi,

Thank you very much !

Daniel OLIVES

Message 6 of 7
dolives
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

Message 7 of 7
_gile
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
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost