muthu123 发表于 2022-7-6 11:13:27

Table Extraction -Pls help

Dear friends,
 
Please refer the attached drawing with table. How can i convert all the part description under the column "DESCRIPTION" to a list. Then i can calculate weight and put it the Weight Column.
 
Please help.
 
yours,
Muthu.
table.dwg

fixo 发表于 2022-7-6 11:24:53

What is the formula to calculate weight by description?
 
~'J'~

muthu123 发表于 2022-7-6 11:30:13

 
I have a function to calculate the wt for a given description and it will return the weight.
 
Ex.(cal_wt_part "5X150X6500") it will return
4.875.
 
But i have to know that where i can place this value and how can i get the row and column number of the Description cells.
 
Yours,
Muthu.

fixo 发表于 2022-7-6 11:39:41

Ok, if you won't to show your secret formula so do it by yourself
I'm busy today
 

(if(setq sset (ssget "+.:S:L" '((0 . "ACAD_TABLE"))))(progn(setq atable (vlax-ename->vla-object (ssname sset 0)))(setq column 2 row 2)(while (< row 9)(setq lst(cons (vla-gettext atable row column) lst))(setq row (1+ row)))))(setq lst (reverse lst))
 
~'J'~

muthu123 发表于 2022-7-6 11:47:11

 
I thing u misunderstand me. Actually we have so many types of descrptions and standard parts and weigts.So it is a big function to calculate weight. Anyhow i will attach the files for your reference.
 
;;fuction is
(wt_cal_single_desc sk_part sk_mark sk_part_quantity)
;; arguments sk_part - Description such as "5X150X6100", "S-CL01", "IPEA200X6500" etc...
;;sk_mark - Piecemark such as "OF-1" IF-1" "HR-1" "EP-1" etc...
 
;;; sk_part_quantity - aty of the qty column.
 
Thank you so much for your reply.
 
Your Sincerly,
Muthu.
TOOL.zip

fixo 发表于 2022-7-6 11:57:57

 
We have a Victory Day today
 
I could help you tomorrow only
 
~'J'~

muthu123 发表于 2022-7-6 12:02:03

 
No problem.

fixo 发表于 2022-7-6 12:09:35

Unfortunatelly I can't test the code below
because of my AutoCAD is crashed at all
Here is just a quick and dirty that partially was written from memory

(defun get_wt_by_desc (desc)(cond      ((= "6X300-500X5546" desc) 104.49)   ((= "10x0-95x142" desc)1.06)   ((= "10x0-80x80"desc) 0.25)   ((= "5X80X180"desc) 1.70)   ((= "6X150X5546"desc) 39.18)   ((= "6X150X5550"desc) 39.21)   ((= "16x200x652"desc) 16.38)   )   )(defun C:RECALC (/ atable column descript en ent lst row rows sset total wt)(vl-load-com) (setq sset (ssget "+.:S:N" '((0 . "ACAD_TABLE"))))   (setq atable (vlax-ename->vla-object (ssname sset 0)))   (vla-put-regeneratetablesuppressed atable :vlax-true)      (setq column 2 row 3 total 0.0 rows (vla-get-rows atable))   (while (/= row rows)   (setq descript(vlax-variant-value (vla-getvalue atable row column 0)))   (if (setq wt (get_wt_by_desc descript)); (setq row 0);;here may be the wrong part (change by yourself): (while (wcmatch (vla-gettext atable row column) "*WEIGHT SUM*" )   (setq row (1+ row))   )   (vla-settext atable row (1+ column) (rtos total 2 2))   (vla-put-regeneratetablesuppressed atable :vlax-false) (princ) )
 
~'J'~

muthu123 发表于 2022-7-6 12:16:37

 
Thank you So much.
 
Can you explain the selection method "+.:S:N"?
 
And do you have any other methods?
 
Yours
Muthu.
页: [1]
查看完整版本: Table Extraction -Pls help