<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: remove formulas from tables in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/remove-formulas-from-tables/m-p/8779178#M88878</link>
    <description>&lt;P&gt;I mean clearing the formulas in cells and replacing them with the results of the former formulas in the cells.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For instance a formula in Table 2 cell A1 is =Table1!A2 and it results "1" while the value of the cell in Table1 cell A2 is 1.&lt;/P&gt;
&lt;P&gt;I'd like to transform the contents of Table 2 cell A1 to "1" to replace the formula with value.&lt;/P&gt;
&lt;P&gt;Somewhat one would do in MS Excel when exporting a table and not willing to show the formulas but values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reason it would be needed is that referenced tables the values are linked from, are deleted during a file export procedure and we get # symbols in the cells.&lt;/P&gt;</description>
    <pubDate>Wed, 08 May 2019 19:43:01 GMT</pubDate>
    <dc:creator>robert06</dc:creator>
    <dc:date>2019-05-08T19:43:01Z</dc:date>
    <item>
      <title>remove formulas from tables</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/remove-formulas-from-tables/m-p/8775827#M88876</link>
      <description>&lt;P&gt;I'm looking for a way to automate removing formulas from autocad tables, replacing the contents with values.&lt;/P&gt;
&lt;P&gt;A way would be exploding the tables upon export, but maybe there's a smarter solution?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2019 14:14:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/remove-formulas-from-tables/m-p/8775827#M88876</guid>
      <dc:creator>robert06</dc:creator>
      <dc:date>2019-05-07T14:14:57Z</dc:date>
    </item>
    <item>
      <title>Re: remove formulas from tables</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/remove-formulas-from-tables/m-p/8778614#M88877</link>
      <description>Can you post an example DWG file with the table with formulas on one side and the desired result next to it at explains what the "value" being used is?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 08 May 2019 15:56:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/remove-formulas-from-tables/m-p/8778614#M88877</guid>
      <dc:creator>pendean</dc:creator>
      <dc:date>2019-05-08T15:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: remove formulas from tables</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/remove-formulas-from-tables/m-p/8779178#M88878</link>
      <description>&lt;P&gt;I mean clearing the formulas in cells and replacing them with the results of the former formulas in the cells.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For instance a formula in Table 2 cell A1 is =Table1!A2 and it results "1" while the value of the cell in Table1 cell A2 is 1.&lt;/P&gt;
&lt;P&gt;I'd like to transform the contents of Table 2 cell A1 to "1" to replace the formula with value.&lt;/P&gt;
&lt;P&gt;Somewhat one would do in MS Excel when exporting a table and not willing to show the formulas but values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reason it would be needed is that referenced tables the values are linked from, are deleted during a file export procedure and we get # symbols in the cells.&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2019 19:43:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/remove-formulas-from-tables/m-p/8779178#M88878</guid>
      <dc:creator>robert06</dc:creator>
      <dc:date>2019-05-08T19:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: remove formulas from tables</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/remove-formulas-from-tables/m-p/8782080#M88879</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/275621"&gt;@robert06&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As Pendean said, an example would be best so that we can help come to a solution. Without an example, your explanations can still be somewhat vague and everything provided to you will be guesswork.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's my shot at it:&lt;/P&gt;
&lt;PRE&gt;(defun c:F2V ( / tbl r c rCnt cCnt)
&lt;FONT color="#FF9900"&gt;;Formulas to Values&lt;/FONT&gt;
(vl-load-com)
&lt;FONT color="#FF9900"&gt;;get table&lt;/FONT&gt;
(setq tbl nil)
(while (not tbl)
  (if (setq tbl (car (entsel "\nSelect Table: ")))
    (if (not (eq "ACAD_TABLE" (cdr (assoc 0 (entget tbl)))))
      (progn (prompt "...not a table.") (setq tbl nil))
      (prompt "...successful selection.")
    )&lt;FONT color="#33CCCC"&gt;;if&lt;/FONT&gt;
    (prompt "...nothing selected.")
  )&lt;FONT color="#33CCCC"&gt;;if&lt;/FONT&gt;
)&lt;FONT color="#33CCCC"&gt;;while&lt;/FONT&gt;
&lt;FONT color="#FF9900"&gt;;prep for loop&lt;/FONT&gt;
(setq r (getpropertyvalue tbl "NumRows"))
(setq cCnt 0 c (getpropertyvalue tbl "NumColumns"))
(setq tbl (vlax-ename-&amp;gt;vla-object tbl))
&lt;FONT color="#FF9900"&gt;;set cells to values without formulas&lt;/FONT&gt;
(repeat c
  (setq rCnt 0)
  (repeat r
    (vla-setcellvalue tbl rCnt cCnt (vla-getcellvalue tbl rCnt cCnt))
    (setq rCnt (1+ rCnt))
  )&lt;FONT color="#33CCCC"&gt;;repeat r&lt;/FONT&gt;
  (setq cCnt (1+ cCnt))
)&lt;FONT color="#33CCCC"&gt;;repeat c&lt;/FONT&gt;
&lt;FONT color="#FF9900"&gt;;finish&lt;/FONT&gt;
(prompt "\n---F2V COMPLETE---")
(princ)
)&lt;FONT color="#33CCCC"&gt;;defun&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;~DD&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 21:58:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/remove-formulas-from-tables/m-p/8782080#M88879</guid>
      <dc:creator>CodeDing</dc:creator>
      <dc:date>2019-05-09T21:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: remove formulas from tables</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/remove-formulas-from-tables/m-p/8782556#M88880</link>
      <description>&lt;P&gt;Ok, sorry, it would had been probably more clear if i had mentioned converting the fields in cells to text, not just formulas in the fields. Attached a sample drawing now.&lt;/P&gt;
&lt;P&gt;But, you got it right, the lisp does what was intended, thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To go on, I'm not sure how to automate the selection (setq tbl (car (entsel "\nSelect Table: ")))&amp;nbsp;&lt;SPAN style="font-family: inherit;"&gt;to run for all tables in drawing&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(if (setq ss (ssget "_X" '((0 . "ACAD_TABLE"))))&lt;BR /&gt;(progn&lt;BR /&gt;(setq sslen ((sslength ss))&lt;BR /&gt;(repeat (..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 07:00:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/remove-formulas-from-tables/m-p/8782556#M88880</guid>
      <dc:creator>robert06</dc:creator>
      <dc:date>2019-05-10T07:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: remove formulas from tables</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/remove-formulas-from-tables/m-p/8783372#M88881</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/275621"&gt;@robert06&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for the dwg. Here is a way to implement for all tables in dwg:&lt;/P&gt;
&lt;PRE&gt;(defun c:F2V ( / ss tbl r c rCnt cCnt)
&lt;FONT color="#FF9900"&gt;;Formulas to Values&lt;/FONT&gt;
(vl-load-com)
&lt;FONT color="#FF9900"&gt;;get tables, exit if none&lt;/FONT&gt;
(setq ss nil)
(if (not (setq ss (ssget "_X" '((0 . "ACAD_TABLE")))))
  (progn (prompt "\nNo tables found...") (exit))
)&lt;FONT color="#33CCCC"&gt;;if&lt;/FONT&gt;
&lt;FONT color="#FF9900"&gt;;prep for loop&lt;/FONT&gt;
(setq len (sslength ss) cnt len)
&lt;FONT color="#FF9900"&gt;;set cells to values without formulas&lt;/FONT&gt;
(repeat len
  (setq tbl (ssname ss (setq cnt (1- cnt))))
  (setq r (getpropertyvalue tbl "NumRows"))
  (setq cCnt 0 c (getpropertyvalue tbl "NumColumns"))
  (setq tbl (vlax-ename-&amp;gt;vla-object tbl))
  (repeat c
    (setq rCnt 0)
    (repeat r
      (vla-setcellvalue tbl rCnt cCnt (vla-getcellvalue tbl rCnt cCnt))
      (setq rCnt (1+ rCnt))
    )&lt;FONT color="#33CCCC"&gt;;repeat r&lt;/FONT&gt;
    (setq cCnt (1+ cCnt))
  )&lt;FONT color="#33CCCC"&gt;;repeat c&lt;/FONT&gt;
)&lt;FONT color="#33CCCC"&gt;;repeat len&lt;/FONT&gt;
&lt;FONT color="#FF9900"&gt;;finish&lt;BR /&gt;&lt;/FONT&gt;(setq ss nil)&lt;FONT color="#33CCCC"&gt;;i like to reset my selection sets&lt;/FONT&gt;
(prompt "\n---F2V COMPLETE---")
(princ)
)&lt;FONT color="#33CCCC"&gt;;defun&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;~DD&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 13:43:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/remove-formulas-from-tables/m-p/8783372#M88881</guid>
      <dc:creator>CodeDing</dc:creator>
      <dc:date>2019-05-10T13:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: remove formulas from tables</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/remove-formulas-from-tables/m-p/8786430#M88882</link>
      <description>&lt;P&gt;Just great, many thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2019 05:43:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/remove-formulas-from-tables/m-p/8786430#M88882</guid>
      <dc:creator>robert06</dc:creator>
      <dc:date>2019-05-13T05:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: remove formulas from tables</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/remove-formulas-from-tables/m-p/10554102#M88883</link>
      <description>brother can you please help me out, how to use this above given code, to remove formulas from tables</description>
      <pubDate>Wed, 18 Aug 2021 08:17:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/remove-formulas-from-tables/m-p/10554102#M88883</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-08-18T08:17:12Z</dc:date>
    </item>
  </channel>
</rss>

