Author Topic: How to but this list in a table  (Read 4498 times)

0 Members and 1 Guest are viewing this topic.

HasanCAD

  • Swamp Rat
  • Posts: 1422
How to but this list in a table
« on: April 13, 2010, 02:08:35 PM »
Hi all

I have a list and want to but it in a table

How is this?

Code: [Select]
(setq curStr (strcase (strcat num:Pref(itoa num:Num)num:Suf)))  ; point number in sequence
(setq Tbl:ins (getpoint "\nPick Table insertion point "))       ; table insertion point
(setq tLst (list (1 0 "Point")   ; 1st column  has athe point number
(1 1 "X")       ; 2nd
                 (1 2 "Y")       ; 3rd
                 (1 3 "Remarks") ; 4th
                 )       ;I dont know if this list strucutre correct or not.
       )                 ; end setq
« Last Edit: April 13, 2010, 02:11:42 PM by asos2000 »

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: How to but this list in a table
« Reply #1 on: April 13, 2010, 03:16:07 PM »
Quick and crude...

Code: [Select]
(or *AcadDoc* (setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object))))
(and (setq p (getpoint "\nTable placement point: "))
     (setq tab (vla-AddTable
                 (if (or (eq acmodelspace (vla-get-activespace *AcadDoc*))
                         (eq :vlax-true (vla-get-mspace *AcadDoc*))
                     ) ;_ or
                   (vla-get-modelspace *AcadDoc*)
                   (vla-get-paperspace *AcadDoc*)
                 )
                 (vlax-3d-point p)
                 4
                 4
                 5.
                 5.
               )
     )
     (foreach x (list '(1 0 "Point")
                      '(1 1 "X")
                      '(1 2 "Y")
                      '(1 3 "Remarks")
                )
       (vla-SetText tab (car x) (cadr x) (caddr x))
     )
)
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

HasanCAD

  • Swamp Rat
  • Posts: 1422
Re: How to but this list in a table
« Reply #2 on: April 20, 2010, 07:41:28 AM »
table is ok but empty

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: How to but this list in a table
« Reply #3 on: April 20, 2010, 08:13:14 AM »
Based on the information provided, it's as full as it can be.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: How to but this list in a table
« Reply #4 on: April 20, 2010, 08:15:00 AM »

 :-)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: How to but this list in a table
« Reply #5 on: April 20, 2010, 08:18:27 AM »
Based on the information provided, it's as full as it can be.

 :-D

HasanCAD

  • Swamp Rat
  • Posts: 1422
Re: How to but this list in a table
« Reply #6 on: April 20, 2010, 09:13:33 AM »
I cant get the relation between the picked points and the text inserted in table
when table added inside the loop each time picked point creats a table

I created the table as a function and this function called in error function

Code: [Select]
(defun *error* (msg)
    (tbleInsert)
    (princ))

table
Code: [Select]
(setq Pnt:Lst (cons(list (curStr (car NumPnt) (cadr NumPnt))) Pnt:Lst))

(defun tbleInsert ()
(and ;(setq p (getpoint "\nTable placement point: "))
     (setq tab (vla-AddTable
                 (if (or (eq acmodelspace (vla-get-activespace *AcadDoc*)) (eq :vlax-true (vla-get-mspace *AcadDoc*))) ;_ or
                   (vla-get-modelspace *AcadDoc*) (vla-get-paperspace *AcadDoc*)) ;if
                 (vlax-3d-point Tbl:ins) (1+ num:Num) 4 (* 10 (getvar "DIMTXT")) (* 10 (getvar "DIMTXT"))))
     (foreach tLst (list '(0 0 "Coordenate")
      '(1 0 "Point")
                      '(1 1 "X")
                      '(1 2 "Y")
                      '(1 3 "Remarks")
                )
       (vla-SetText tab (car tLst) (cadr tLst) (caddr x))
     )
)
)

Thanks

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: How to but this list in a table
« Reply #7 on: April 20, 2010, 09:15:29 AM »
Why call it in the error function?


HasanCAD

  • Swamp Rat
  • Posts: 1422
Re: How to but this list in a table
« Reply #8 on: April 20, 2010, 12:37:09 PM »
Why call it in the error function?



This idea came to my mind.
OK, How to stop the loop then call the table?

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: How to but this list in a table
« Reply #9 on: April 20, 2010, 03:20:31 PM »
You need to have a test expression that evaluates to nil when you wish the loop to end.