muthu123 Posted May 6, 2010 Share Posted May 6, 2010 Dear friends, Is it possible to update a cell automatically based on the text edit of one cell. Ex. If we edit the part in the follwing sample table, the description cell should have the corresponding size of the part. PART Description CL-01 "PL5X80X155" CL-02 "PL6X80X180" Help will be highly appriciatable. Yours, Muthu. Quote Link to comment Share on other sites More sharing options...
fixo Posted May 6, 2010 Share Posted May 6, 2010 Dear friends, Is it possible to update a cell automatically based on the text edit of one cell. Ex. If we edit the part in the follwing sample table, the description cell should have the corresponding size of the part. PART Description CL-01 "PL5X80X155" CL-02 "PL6X80X180" Help will be highly appriciatable. Yours, Muthu. Here is quick and dirty example test it just after you would finished to edit the desired cells (defun C:demo(/ columns pair part_list row rows table_ent table_obj) ;; change your part list here: (setq part_list (list (cons "CL-01" "PL5X80X155") (cons "CL-02" "PL6X80X180") (cons "CL-03" "PL7X80X200") (cons "CL-04" "PL8X80X240") (cons "CL-05" "PL9X80X300") ) ) (setq table_ent (entsel "\nSelect table >> ")) (setq table_obj (vlax-ename->vla-object (car table_ent))) (setq rows (vlax-get-property table_obj 'Rows)) (setq columns (vlax-get-property table_obj 'Columns)) (setq row 0) (if (eq :vlax-false (vla-get-titlesuppressed table_obj)) (progn (setq row (1+ row)) (setq rows (1- rows))) ) (if (eq :vlax-false (vla-get-headersuppressed table_obj)) (progn (setq row (1+ row)) (setq rows (1- rows))) ) (repeat rows (if (setq pair (assoc (vla-gettext table_obj row 0) part_list)) (vla-settext table_obj row 1 (cdr pair))) (setq row (1+ row)) ) (vla-update table_obj) (princ) ) (vl-load-com) ~'J'~ Quote Link to comment Share on other sites More sharing options...
muthu123 Posted May 6, 2010 Author Share Posted May 6, 2010 Here is quick and dirty exampletest it just after you would finished to edit the desired cells (defun C:demo(/ columns pair part_list row rows table_ent table_obj) ;; change your part list here: (setq part_list (list (cons "CL-01" "PL5X80X155") (cons "CL-02" "PL6X80X180") (cons "CL-03" "PL7X80X200") (cons "CL-04" "PL8X80X240") (cons "CL-05" "PL9X80X300") ) ) (setq table_ent (entsel "\nSelect table >> ")) (setq table_obj (vlax-ename->vla-object (car table_ent))) (setq rows (vlax-get-property table_obj 'Rows)) (setq columns (vlax-get-property table_obj 'Columns)) (setq row 0) (if (eq :vlax-false (vla-get-titlesuppressed table_obj)) (progn (setq row (1+ row)) (setq rows (1- rows))) ) (if (eq :vlax-false (vla-get-headersuppressed table_obj)) (progn (setq row (1+ row)) (setq rows (1- rows))) ) (repeat rows (if (setq pair (assoc (vla-gettext table_obj row 0) part_list)) (vla-settext table_obj row 1 (cdr pair))) (setq row (1+ row)) ) (vla-update table_obj) (princ) ) (vl-load-com) ~'J'~ Dear fixo, Thank you so much. Instead of calling separate function, how can we assign this function to that same cell to update automatically depends of the part list. Quote Link to comment Share on other sites More sharing options...
fixo Posted May 6, 2010 Share Posted May 6, 2010 Search forum how to use vlr-object-reactor I have not have an experience with this thing ~'J'~ 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.