Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

List to Data_Table

3 REPLIES 3
Reply
Message 1 of 4
ranjith0326
323 Views, 3 Replies

List to Data_Table

Greetings...

 

Is there any possible to convert a list to Data_table.(Purpose is to use query )

 

Sample_list : 

(setq sample_list (list (list "Name" "Age" "DOB")
(list "Ran" "25" "15-03-1988")
(list "Jith" "26" "18-03-1998")
(list "Kumar" "27" "10-03-1978")))

 

 

 

Regards,

R.Ranjith
3 REPLIES 3
Message 2 of 4
pbejse
in reply to: ranjith0326


@ranjith0326 wrote:

Greetings...

 

Is there any possible to convert a list to Data_table.(Purpose is to use query )

 


Create or query?

 

To create a table

 

(defun c:demo ( / sample_list ht i p data_table)
  (setq sample_list
         '(("Name" "Age" "DOB")
           ("Ran" "25" "15-03-1988")
           ("Jith" "26" "18-03-1998")
           ("Kumar" "27" "10-03-1978")
          )
  )
  (setq ht (cdr (assoc 40 (tblsearch "Style" (getvar 'Textstyle))))
        ht (if (zerop ht)
             1
             (* ht 5)
           )
  )
  (if (setq i 0
            p (getpoint "\nTable Location :")
      )
    (progn (setq Data_table
                  (vlax-invoke
                    (vlax-get (vla-get-ActiveLayout (vla-get-activedocument (vlax-get-acad-object))) 'Block)
                    'AddTable
                    p
                    (1+ (length sample_list))
                    3
                    (* ht 0.35)
                    (* ht 4)
                  )
           )
           (vla-settext Data_table 0 0 "Data Sheet")
           (foreach itm sample_list
             (setq i (1+ i))
             (mapcar '(lambda (d n) (vla-settext Data_table i n d)) itm '(0 1 2))
           )
    )
  )(princ)
)

 

For Query, how would want it? 

 

 

Message 3 of 4
ranjith0326
in reply to: pbejse

Dear 

Regards,

R.Ranjith
Message 4 of 4
hgasty1001
in reply to: ranjith0326

Hi,

 

Check in the AutoCAD' sample folder CAO, it has a sample lisp to test the CAO typelib. Also check this link: http://www.jtbworld.com/lisp/CAO%20templates.htm.

 

Gaston Nunez  

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

Post to forums  

Autodesk Design & Make Report

”Boost