Akash Posted October 16, 2019 Share Posted October 16, 2019 Hi all, I have to merge multiple tables and need to form the resultant table as shown in the attached DWG. First two columns for the resultant table must be same and the third column gets added as per taking reference of first two columns. Thanks in advance . TableMerge-Example.dwg Quote Link to comment Share on other sites More sharing options...
devitg Posted October 16, 2019 Share Posted October 16, 2019 Will it be only such lines ?? Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 16, 2019 Share Posted October 16, 2019 No code but copy lot1 table and add columns by pick other tables and which column to join in this approach would allow a more universal answer and allow for say 1 2 or 3 column add. (vla-InsertRows obj2 rownum (vla-GetRowHeight obj2 (- rownum 1)) 1) should be same for Columns Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 17, 2019 Share Posted October 17, 2019 Had a play then realised going in wrong direction, need suppress heading added. But method is there copy one of the tables use as master, pick the 1st value in left column 3rd row down keep repeating. ; add columns from one table to another ; make multi tables into 1 ; By Alan H Oct 2019 info@alanh.com.au (defun c:mrgtab ( / pbj pbj2 x col col2 colwid ent col2ac row pt pick lwrleft urright lst ss) (setq oldsnap (getvar 'osmode)) (setq obj (vlax-ename->vla-object (car (entsel "Pick master table")))) (setq row (vla-get-Rows obj)) (setq col (vla-get-Columns obj)) (setq colwid (vla-getcolumnwidth obj (- col 1))) (setvar 'osmode 0) (while (setq pt (getpoint "\nSelect top Cell for column values in other table: ")) (setq pick (vlax-3d-point pt)) (vla-InsertColumns obj col (vla-getcolumnwidth obj (- col 1)) 1) (setq row2 (vla-get-Rows obj)) (setq col (+ col 1)) (setq lwrleft (polar pt (* pi 1.25) 2)) (setq uprright (polar pt (* pi 0.25) 2)) (setq vector (vlax-3D-point (trans (getvar 'viewdir) 1 0))) (setq SS (ssget "C" lwrleft uprright (list (cons 0 "ACAD_TABLE")))) (setq Obj2 (vlax-ename->vla-object (ssname SS 0))) (if (= (vla-hittest Obj2 pick vector 'rown 'coln) :vlax-true) (setq lst (list rown coln)) ) (setq col2 (nth 1 lst)) (setq rowst (nth 0 lst)) (setq x rowst) (repeat (- row2 rowst ) (setq txt (vla-getText Obj2 x col2 )) (vla-SetText Obj x (- col 1) txt) (setq x (+ x 1)) ) ) ) (c:mrgtab) 1 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 17, 2019 Share Posted October 17, 2019 Had another go start with this have to go know no time. Delete columns as code adds. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.