insert lisp formula on existing table drawing. how to inser formula on row 3 or 4!?

insert lisp formula on existing table drawing. how to inser formula on row 3 or 4!?

Anonymous
Not applicable
543 Views
2 Replies
Message 1 of 3

insert lisp formula on existing table drawing. how to inser formula on row 3 or 4!?

Anonymous
Not applicable
  
;Insert table
(defun insert_table (lst pct / tab row col ht i n space)
  (setq space (vlax-get acDoc (if (= 1 (getvar 'cvport)) 'PaperSpace 'ModelSpace))
        ht  (/ 2.5 (cond ((getvar 'cannoscalevalue)) (1.0)))
        pct (trans pct 1 0)
        n   (trans '(1 0 0) 1 0 T)
		;4 linhas em (+ 4 (length lst)
        tab (setq tab (vla-addtable space (vlax-3d-point pct) (+ 4 (length lst)) (length (car lst)) (* 2.5 ht) ht))
        )
  (vlax-put tab 'direction n)
  
  (mapcar
    (function
      (lambda (rowType)
        (vla-SetTextStyle  tab rowType (getvar 'textstyle))
        (vla-SetTextHeight tab rowType ht)
      )
    )
   '(2 4 1)
  )
  
  
  (vla-put-HorzCellMargin tab (* 0.14 ht))
  (vla-put-VertCellMargin tab (* 0.14 ht))

  (setq lst (cons (mapcar '(lambda (a) (strcat "Col" (itoa (1+ (vl-position a (car lst)))))) (car lst)) lst))

  (setq i 0)
  (foreach col (apply 'mapcar (cons 'list lst))
    (vla-SetColumnWidth tab i
      (apply
        'max
        (mapcar
          '(lambda (x)
             ((lambda (txb) (+ (abs (- (caadr txb) (caar txb))) (* 2.0 ht)))
              (textbox (list (cons 1 (vl-princ-to-string x)) (cons 7 (getvar 'textstyle)) (cons 40 ht)))
              )
             )
          col
          )
        )
      )
    (setq i (1+ i))
    )
  
  (setq lst (cons '("Total Lenght / Upper Thread & Lower Thread") lst))
   
  (setq row 0)
	  (foreach r lst
			(setq col 0 )
			(vla-SetRowHeight tab row (* 1.5 ht))
				(foreach c r
				  (vla-SetText tab row col (if (numberp c) (rtos c) (vl-princ-to-string c)))				  
				  (setq col (1+ col))
				  )
			(setq row (1+ row))	
			do(print upper)
			do(print lower)
		)
	
	
	
  )
0 Likes
544 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

how can i insert in main function in "l" the upper and lower value !? 

0 Likes
Message 3 of 3

pbejse
Mentor
Mentor

The code on its own doesnt tell us much, 

to quote @devitg

 

Hi @Anonymous  , For better understanding, and maybe get further help, please upload such sample.dwg   and the way you need  results. 

 

 

 

0 Likes