TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: HasanCAD 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?
(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
-
Quick and crude...
(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))
)
)
-
table is ok but empty
-
Based on the information provided, it's as full as it can be.
-
:-)
-
Based on the information provided, it's as full as it can be.
:-D
-
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
(defun *error* (msg)
(tbleInsert)
(princ))
table
(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
-
Why call it in the error function?
-
Why call it in the error function?
This idea came to my mind.
OK, How to stop the loop then call the table?
-
You need to have a test expression that evaluates to nil when you wish the loop to end.