Jump to content

CELL EDIT in a Table -Help


muthu123

Recommended Posts

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.

Link to comment
Share on other sites

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'~

Link to comment
Share on other sites

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'~

 

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...