Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Adding Units and Tagged Rows to the Table

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
k005
381 Views, 8 Replies

Adding Units and Tagged Rows to the Table

k005
Advisor
Advisor

Hello friends.


I have a painting. (before) length and area units are missing from this table. Also the field and length line/label is missing.

How can we add these?


* desired (after)

 

Thanks in advance to the helpful friend.

0 Likes

Adding Units and Tagged Rows to the Table

Hello friends.


I have a painting. (before) length and area units are missing from this table. Also the field and length line/label is missing.

How can we add these?


* desired (after)

 

Thanks in advance to the helpful friend.

8 REPLIES 8
Message 2 of 9
Sea-Haven
in reply to: k005

Sea-Haven
Mentor
Mentor

The best solution for this is to create the table correctly not edit it, so provide a true sample dwg and code matching your desired table result can be provided. Need what are Bolge_1 objects ?

0 Likes

The best solution for this is to create the table correctly not edit it, so provide a true sample dwg and code matching your desired table result can be provided. Need what are Bolge_1 objects ?

Message 3 of 9
k005
in reply to: Sea-Haven

k005
Advisor
Advisor

No, I just want to add Unit labels and rows. So, as it appears in the after part...

 

* Table row heights may be the same... or the new row to be added may be slightly higher than the others...

 

0 Likes

No, I just want to add Unit labels and rows. So, as it appears in the after part...

 

* Table row heights may be the same... or the new row to be added may be slightly higher than the others...

 

Message 4 of 9
komondormrex
in reply to: k005

komondormrex
Advisor
Advisor
Accepted solution

hey you there,

check the code below

(defun c:correct_table (/ table_object rows_number columns_number add_columns add_units color row column)
	(setq table_object (vlax-ename->vla-object (car (entsel "\nPick a table to correct: ")))
		  rows_number (vla-get-rows table_object)
		  columns_number (vla-get-rows table_object)
		  add_columns '("KISIM" "ALAN" "UZUNLUK")
		  add_units '("" "m\\U+00B2" "m")
		  color (vla-getcellgridcolor table_object 0 1 actopmask)
		  row 1
		  column -1
	)
	(vla-put-regeneratetablesuppressed table_object :vlax-true)
	(vla-insertrows table_object 1 19 1)
	(vla-setcolumnwidth table_object 2 45)
	(repeat 3
		(vla-setcellgridcolor table_object row (setq column (1+ column)) actopmask color)
		(vla-setcellgridcolor table_object row column acleftmask color)
		(vla-setcellgridcolor table_object row column acbottommask color)
		(vla-setcellgridcolor table_object row column acrightmask color)
		(vla-setcellvalue table_object row column (nth column add_columns))
		(vla-setcelltextheight table_object row column 6)
		(vla-setcontentcolor2 table_object row column 0 (vla-getcontentcolor2 table_object 0 0 0))
		(vla-setcellalignment table_object row column acmiddlecenter)
	)
	(repeat (1- rows_number)
		(setq column 0)
		(setq row (1+ row))
		(repeat 2
			(vla-setcellvalue table_object row (setq column (1+ column)) 
							 (strcat (vlax-variant-value (vla-getcellvalue table_object row column)) " " (nth column add_units))
			)
		)
	)
	(vla-put-regeneratetablesuppressed table_object :vlax-false)
	(princ)
)

hey you there,

check the code below

(defun c:correct_table (/ table_object rows_number columns_number add_columns add_units color row column)
	(setq table_object (vlax-ename->vla-object (car (entsel "\nPick a table to correct: ")))
		  rows_number (vla-get-rows table_object)
		  columns_number (vla-get-rows table_object)
		  add_columns '("KISIM" "ALAN" "UZUNLUK")
		  add_units '("" "m\\U+00B2" "m")
		  color (vla-getcellgridcolor table_object 0 1 actopmask)
		  row 1
		  column -1
	)
	(vla-put-regeneratetablesuppressed table_object :vlax-true)
	(vla-insertrows table_object 1 19 1)
	(vla-setcolumnwidth table_object 2 45)
	(repeat 3
		(vla-setcellgridcolor table_object row (setq column (1+ column)) actopmask color)
		(vla-setcellgridcolor table_object row column acleftmask color)
		(vla-setcellgridcolor table_object row column acbottommask color)
		(vla-setcellgridcolor table_object row column acrightmask color)
		(vla-setcellvalue table_object row column (nth column add_columns))
		(vla-setcelltextheight table_object row column 6)
		(vla-setcontentcolor2 table_object row column 0 (vla-getcontentcolor2 table_object 0 0 0))
		(vla-setcellalignment table_object row column acmiddlecenter)
	)
	(repeat (1- rows_number)
		(setq column 0)
		(setq row (1+ row))
		(repeat 2
			(vla-setcellvalue table_object row (setq column (1+ column)) 
							 (strcat (vlax-variant-value (vla-getcellvalue table_object row column)) " " (nth column add_units))
			)
		)
	)
	(vla-put-regeneratetablesuppressed table_object :vlax-false)
	(princ)
)
Message 5 of 9
k005
in reply to: komondormrex

k005
Advisor
Advisor

Thank you very much. Ok. Thank you.


* Can we also have a small division operation done? If it's not too difficult...

 

 

In the Total section divide Total area 10000 by Total length 100.

 

* Or we can collect directly from the Table. In order for the fraction to be the same...


I am adding a sample dwg.

 

 

 

 

0 Likes

Thank you very much. Ok. Thank you.


* Can we also have a small division operation done? If it's not too difficult...

 

 

In the Total section divide Total area 10000 by Total length 100.

 

* Or we can collect directly from the Table. In order for the fraction to be the same...


I am adding a sample dwg.

 

 

 

 

Message 6 of 9
Sea-Haven
in reply to: k005

Sea-Haven
Mentor
Mentor

Again why fix table provide a dwg that has Bolge objects and make a table correct 1st go. Including /1000 & /100

0 Likes

Again why fix table provide a dwg that has Bolge objects and make a table correct 1st go. Including /1000 & /100

Message 7 of 9
k005
in reply to: Sea-Haven

k005
Advisor
Advisor

The first time it was actually supposed to be 1000 and 100 episodes. I missed this point... sorry...

0 Likes

The first time it was actually supposed to be 1000 and 100 episodes. I missed this point... sorry...

Message 8 of 9
komondormrex
in reply to: k005

komondormrex
Advisor
Advisor
Accepted solution

sure,

(defun c:correct_table (/ table_object rows_number columns_number add_columns add_units color row column)
	(setq table_object (vlax-ename->vla-object (car (entsel "\nPick a table to correct: ")))
		  rows_number (vla-get-rows table_object)
		  columns_number (vla-get-rows table_object)
		  add_columns '("KISIM" "ALAN" "UZUNLUK")
		  add_units '("" "m\\U+00B2" "m")
		  color (vla-getcellgridcolor table_object 0 1 actopmask)
		  row 1
		  column -1
	)
	(vla-put-regeneratetablesuppressed table_object :vlax-true)
	(vla-insertrows table_object 1 19 1)
	(vla-setcolumnwidth table_object 2 45)
	(repeat 3
		(vla-setcellgridcolor table_object row (setq column (1+ column)) actopmask color)
		(vla-setcellgridcolor table_object row column acleftmask color)
		(vla-setcellgridcolor table_object row column acbottommask color)
		(vla-setcellgridcolor table_object row column acrightmask color)
		(vla-setcellvalue table_object row column (nth column add_columns))
		(vla-setcelltextheight table_object row column 6)
		(vla-setcontentcolor2 table_object row column 0 (vla-getcontentcolor2 table_object 0 0 0))
		(vla-setcellalignment table_object row column acmiddlecenter)
	)
	(repeat (1- rows_number)
		(setq column 0)
		(setq row (1+ row))
		(repeat 2
			(vla-setcellvalue table_object row (setq column (1+ column))
							 (strcat (vlax-variant-value (vla-getcellvalue table_object row column)) " " (nth column add_units))
			)
		)
	)
	(if (= "TOTAL:" (vlax-variant-value (vla-getcellvalue table_object row 0)))
		(progn
			(vla-setcellvalue table_object row 1 (strcat (rtos (* (atof (vlax-variant-value (vla-getcellvalue table_object row 1))) 1e-4) 2 2) " m\\U+00B2"))
			(vla-setcellvalue table_object row 2 (strcat (rtos (* (atof (vlax-variant-value (vla-getcellvalue table_object row 2))) 1e-2) 2 2) " m"))
		)
	)
	(vla-put-regeneratetablesuppressed table_object :vlax-false)
	(princ)
)

sure,

(defun c:correct_table (/ table_object rows_number columns_number add_columns add_units color row column)
	(setq table_object (vlax-ename->vla-object (car (entsel "\nPick a table to correct: ")))
		  rows_number (vla-get-rows table_object)
		  columns_number (vla-get-rows table_object)
		  add_columns '("KISIM" "ALAN" "UZUNLUK")
		  add_units '("" "m\\U+00B2" "m")
		  color (vla-getcellgridcolor table_object 0 1 actopmask)
		  row 1
		  column -1
	)
	(vla-put-regeneratetablesuppressed table_object :vlax-true)
	(vla-insertrows table_object 1 19 1)
	(vla-setcolumnwidth table_object 2 45)
	(repeat 3
		(vla-setcellgridcolor table_object row (setq column (1+ column)) actopmask color)
		(vla-setcellgridcolor table_object row column acleftmask color)
		(vla-setcellgridcolor table_object row column acbottommask color)
		(vla-setcellgridcolor table_object row column acrightmask color)
		(vla-setcellvalue table_object row column (nth column add_columns))
		(vla-setcelltextheight table_object row column 6)
		(vla-setcontentcolor2 table_object row column 0 (vla-getcontentcolor2 table_object 0 0 0))
		(vla-setcellalignment table_object row column acmiddlecenter)
	)
	(repeat (1- rows_number)
		(setq column 0)
		(setq row (1+ row))
		(repeat 2
			(vla-setcellvalue table_object row (setq column (1+ column))
							 (strcat (vlax-variant-value (vla-getcellvalue table_object row column)) " " (nth column add_units))
			)
		)
	)
	(if (= "TOTAL:" (vlax-variant-value (vla-getcellvalue table_object row 0)))
		(progn
			(vla-setcellvalue table_object row 1 (strcat (rtos (* (atof (vlax-variant-value (vla-getcellvalue table_object row 1))) 1e-4) 2 2) " m\\U+00B2"))
			(vla-setcellvalue table_object row 2 (strcat (rtos (* (atof (vlax-variant-value (vla-getcellvalue table_object row 2))) 1e-2) 2 2) " m"))
		)
	)
	(vla-put-regeneratetablesuppressed table_object :vlax-false)
	(princ)
)
Message 9 of 9
k005
in reply to: komondormrex

k005
Advisor
Advisor

It's just perfect !. Thank you very much. 🤗

0 Likes

It's just perfect !. Thank you very much. 🤗

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report