<?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 block clculate in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-clculate/m-p/9124182#M82224</link>
    <description>&lt;P&gt;I have a block with values T.L, I.L, H and D when H automatically calculates the difference between T.L and I.L&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I want D value to be dependent on H under the following conditions:&lt;BR /&gt;If H is less than 80 then D = 60&lt;BR /&gt;If H is between 80 and 125 then D = 80&lt;BR /&gt;If H is between 125 and 250 then D = 100&lt;BR /&gt;If H is greater than 250 then D = 125&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I do this? Would appreciate help..&lt;/P&gt;&lt;P&gt;Attached is the block I am working on.&lt;/P&gt;</description>
    <pubDate>Sun, 03 Nov 2019 12:32:13 GMT</pubDate>
    <dc:creator>dvir860</dc:creator>
    <dc:date>2019-11-03T12:32:13Z</dc:date>
    <item>
      <title>block clculate</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-clculate/m-p/9124182#M82224</link>
      <description>&lt;P&gt;I have a block with values T.L, I.L, H and D when H automatically calculates the difference between T.L and I.L&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I want D value to be dependent on H under the following conditions:&lt;BR /&gt;If H is less than 80 then D = 60&lt;BR /&gt;If H is between 80 and 125 then D = 80&lt;BR /&gt;If H is between 125 and 250 then D = 100&lt;BR /&gt;If H is greater than 250 then D = 125&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I do this? Would appreciate help..&lt;/P&gt;&lt;P&gt;Attached is the block I am working on.&lt;/P&gt;</description>
      <pubDate>Sun, 03 Nov 2019 12:32:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-clculate/m-p/9124182#M82224</guid>
      <dc:creator>dvir860</dc:creator>
      <dc:date>2019-11-03T12:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: block clculate</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-clculate/m-p/9124323#M82225</link>
      <description>&lt;P&gt;&lt;FONT color="#000000"&gt;(setq D&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;&amp;nbsp; (cond&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;&amp;nbsp; &amp;nbsp; ((&amp;lt; H 80) 60)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #666666; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ((&amp;lt; H 125) 80)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #666666; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ((&amp;lt; H 250) 100)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #666666; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (125)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #666666; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;&lt;FONT color="#000000"&gt;&amp;nbsp; )&lt;/FONT&gt;&lt;FONT color="#999999"&gt;; cond&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #666666; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;&lt;FONT color="#000000"&gt;)&lt;/FONT&gt;&lt;FONT color="#999999"&gt;; setq&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #666666; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;You need to decide whether a value of exactly 125 falls in the category of "between 80 and 125" or that of "between 125 and 250", that is, whether to use &lt;FONT color="#000000"&gt;(&amp;lt;=)&lt;/FONT&gt; functions instead of &lt;FONT color="#000000"&gt;(&amp;lt;)&lt;/FONT&gt;.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Nov 2019 15:05:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-clculate/m-p/9124323#M82225</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2019-11-03T15:05:15Z</dc:date>
    </item>
    <item>
      <title>Re: block clculate</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-clculate/m-p/9124395#M82226</link>
      <description>&lt;P&gt;Here try this...&lt;/P&gt;&lt;P&gt;I played with object reactor, and I used only &amp;lt; function in diesel expression... So load lisp and type : REACT... From that point until you finish session it should update D whenever H changes, just be sure to use REGEN command after modification...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(defun D:ObjReactor ( owner reactor lstename / h b a )
  (setq h (cdr (assoc 1 (entget (vlax-vla-object-&amp;gt;ename owner)))))
  (setq b (cdr (assoc 330 (entget (vlax-vla-object-&amp;gt;ename owner)))))
  (setq a b)
  (while (setq a (entnext a))
    (if (and (= (cdr (assoc 0 (entget a))) "ATTRIB") (= (cdr (assoc 2 (entget a))) "D"))
      (entupd (cdr (assoc -1 (entmod (subst (cons 1 (strcat "%%C" "%&amp;lt;$(if,$(&amp;lt;, " h ", 80),60,$(if,$(and, $(&amp;gt;, " h ", 80), $(&amp;lt;, " h ", 125)),80,$(if,$(and, $(&amp;gt;, " h ", 125), $(&amp;lt;, " h ", 250)),100,$(if, $(&amp;gt;, " h ", 250),125))))&amp;gt;%")) (assoc 1 (entget a)) (entget a))))))
    )
  )
  (entupd b)
  (princ)
)

(defun c:react ( / collectowners )

  (vl-load-com)

  (defun collectowners ( / ss bl a al )
    (setq ss (ssget "_X" '((0 . "INSERT") (66 . 1))))
    (setq bl (vl-remove-if-not '(lambda ( x ) (= (vla-get-effectivename (vlax-ename-&amp;gt;vla-object x)) "G_LABELD")) (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))))
    (foreach b bl
      (setq a b)
      (while (setq a (entnext a))
        (if (and (= (cdr (assoc 0 (entget a))) "ATTRIB") (= (cdr (assoc 2 (entget a))) "H"))
          (setq al (cons (cdr (assoc 5 (entget a))) al))
        )
      )
    )
    al
  )

  (vlr-remove-all)
  (setq *TheReactor* (vlr-object-reactor (mapcar 'vlax-ename-&amp;gt;vla-object (mapcar 'handent (collectowners))) "Object Reactor" '((:VLR-modified . D:ObjReactor))))
  (princ)
)&lt;/PRE&gt;&lt;P&gt;HTH., M.R.&lt;/P&gt;</description>
      <pubDate>Sun, 03 Nov 2019 16:36:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-clculate/m-p/9124395#M82226</guid>
      <dc:creator>marko_ribar</dc:creator>
      <dc:date>2019-11-03T16:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: block clculate</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-clculate/m-p/9127547#M82227</link>
      <description>&lt;P&gt;It doesn't work out with the 2 solutions shown in the comments above. What didn't I do right? What processes do I need to take for the solutions to work?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dvir&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2019 09:34:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-clculate/m-p/9127547#M82227</guid>
      <dc:creator>dvir860</dc:creator>
      <dc:date>2019-11-05T09:34:38Z</dc:date>
    </item>
    <item>
      <title>Re: block clculate</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-clculate/m-p/9127692#M82228</link>
      <description>&lt;P&gt;I've mod. it slightly... Like I said open DWG, load react.lsp, type REACT and then just type REGEN... It should update both H and D... Also when you want to change H and D, when you enter attedit by double clicking on block, when you change values of T.* attributes click on OK, not Apply... Then when CAD updates changes, just type REGEN again for D and H to update...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(defun D:ObjReactor ( owner reactor lstename / h b a )

  (vl-load-com)

  (setq h (cdr (assoc 1 (entget (vlax-vla-object-&amp;gt;ename owner)))))
  (setq b (cdr (assoc 330 (entget (vlax-vla-object-&amp;gt;ename owner)))))
  (setq a b)
  (while (setq a (entnext a))
    (if (and (= (cdr (assoc 0 (entget a))) "ATTRIB") (= (cdr (assoc 2 (entget a))) "D"))
      (entupd (cdr (assoc -1 (entmod (subst (cons 1 (strcat "%%C" "%&amp;lt;$(if,$(&amp;lt;, " h ", 80),60,$(if,$(&amp;lt;, " h ", 125),80,$(if,$(&amp;lt;, " h ", 250),100,125)))&amp;gt;%")) (assoc 1 (entget a)) (entget a))))))
    )
  )
  (entupd b)
  (vla-regen (vla-get-activedocument (vlax-get-acad-object)) acactiveviewport)
  (princ)
)

(defun c:react ( / collectowners )

  (vl-load-com)

  (defun collectowners ( / ss bl a al )
    (setq ss (ssget "_X" '((0 . "INSERT") (66 . 1))))
    (setq bl (vl-remove-if-not '(lambda ( x ) (= (vla-get-effectivename (vlax-ename-&amp;gt;vla-object x)) "G_LABELD")) (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))))
    (foreach b bl
      (setq a b)
      (while (setq a (entnext a))
        (if (and (= (cdr (assoc 0 (entget a))) "ATTRIB") (= (cdr (assoc 2 (entget a))) "H"))
          (setq al (cons (cdr (assoc 5 (entget a))) al))
        )
      )
    )
    al
  )

  (vlr-remove-all)
  (setq *TheReactor* (vlr-object-reactor (mapcar 'vlax-ename-&amp;gt;vla-object (mapcar 'handent (collectowners))) "Object Reactor" '((:VLR-modified . D:ObjReactor))))
  (princ)
)&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Nov 2019 10:39:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-clculate/m-p/9127692#M82228</guid>
      <dc:creator>marko_ribar</dc:creator>
      <dc:date>2019-11-05T10:39:42Z</dc:date>
    </item>
    <item>
      <title>Re: block clculate</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-clculate/m-p/9127770#M82229</link>
      <description>&lt;P&gt;It works well for me only when I have one block in drawing but doesn't work for me when I have more than one block. Is it possible to have the same for multiple blocks in one drawing?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2019 11:12:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-clculate/m-p/9127770#M82229</guid>
      <dc:creator>dvir860</dc:creator>
      <dc:date>2019-11-05T11:12:08Z</dc:date>
    </item>
    <item>
      <title>Re: block clculate</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-clculate/m-p/9128231#M82230</link>
      <description>&lt;P&gt;Here, try this mod... If you go through diesel or field expressions, CAD will crash...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(defun H:ObjReactor ( owner reactor lstename / h d b a )

  (vl-load-com)

  (setq h (cdr (assoc 1 (entget (vlax-vla-object-&amp;gt;ename owner)))))
  (setq d
    (cond
      ( (&amp;lt; (atof h) 80)
        60
      )
      ( (&amp;lt; (atof h) 125)
        80
      )
      ( (&amp;lt; (atof h) 250)
        100
      )
      ( t 125 )
    )
  )
  (setq b (cdr (assoc 330 (entget (vlax-vla-object-&amp;gt;ename owner)))))
  (setq a b)
  (while (setq a (entnext a))
    (if (and (= (cdr (assoc 0 (entget a))) "ATTRIB") (= (cdr (assoc 2 (entget a))) "D"))
      (entupd (cdr (assoc -1 (entmod (subst (cons 1 (strcat "%%C" (itoa d))) (assoc 1 (entget a)) (entget a))))))
    )
  )
  (princ)
)

(defun c:react ( / collectowners )

  (vl-load-com)

  (defun collectowners ( / ss bl a al )
    (setq ss (ssget "_X" '((0 . "INSERT") (66 . 1))))
    (setq bl (vl-remove-if-not '(lambda ( x ) (= (vla-get-effectivename (vlax-ename-&amp;gt;vla-object x)) "G_LABELD")) (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))))
    (foreach b bl
      (setq a b)
      (while (setq a (entnext a))
        (if (and (= (cdr (assoc 0 (entget a))) "ATTRIB") (= (cdr (assoc 2 (entget a))) "H"))
          (setq al (cons a al))
        )
      )
    )
    al
  )

  (vlr-remove-all)
  (setq *TheReactor* (vlr-object-reactor (mapcar 'vlax-ename-&amp;gt;vla-object (collectowners)) "Object Reactor" '((:VLR-modified . H:ObjReactor))))
  (princ)
)&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Nov 2019 14:21:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-clculate/m-p/9128231#M82230</guid>
      <dc:creator>marko_ribar</dc:creator>
      <dc:date>2019-11-05T14:21:40Z</dc:date>
    </item>
  </channel>
</rss>

