<?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: Boundary not working correctly in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/boundary-not-working-correctly/m-p/7340798#M116055</link>
    <description>&lt;P&gt;You are right&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/586759" target="_blank"&gt;gpcattaneo&lt;/A&gt;&amp;nbsp;!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for the delay in answering. I got mixed with other boundary related problems ("valid hatch boundary not found").&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had mistakenly&amp;nbsp;used &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(command "._zoom" "_c" p 3000) instead of&lt;/PRE&gt;&lt;PRE&gt;(if first (command "._zoom" "_c" p 3000))&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;With your solution, I got rid of the badly generated polygons. Tested your solution in various complicated drawings and passed. Still, would like to have a less temperamental boundary replacement command, one that does not depend on doing the right zooms. Is there any? Maybe in Civil Map?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
    <pubDate>Thu, 31 Aug 2017 01:33:10 GMT</pubDate>
    <dc:creator>scadcam</dc:creator>
    <dc:date>2017-08-31T01:33:10Z</dc:date>
    <item>
      <title>Boundary not working correctly</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/boundary-not-working-correctly/m-p/7320878#M116051</link>
      <description>&lt;P&gt;I have a program to calculate the area of different parcels. The program uses the text insertion point to get the boundary around this point and then calculates the area of the boundary's polygon.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(defun c:Areas (/ ssTexts apertura osmodo )&lt;BR /&gt;&amp;nbsp; (setvar "CMDECHO" 0)&lt;BR /&gt;&amp;nbsp; (setq osmodo (getvar "OSMODE") apertura (getvar "APERTURE"))&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; (setvar "OSMODE" 0)&lt;BR /&gt;&amp;nbsp; (setvar "APERTURE" 5)&lt;BR /&gt;&amp;nbsp; (setq ssTexts (ssget "_X" (list (cons 0 "TEXT"))))&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp; (getAreas ssTexts)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; (setvar "OSMODE" osmodo)&lt;BR /&gt;&amp;nbsp; (alert "******************** End ************************")&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;(defun getAreas (ss / i en atext pl len m2 eg pti &amp;nbsp;)&lt;BR /&gt;&amp;nbsp; (setq i 0 len (sslength ss))&lt;BR /&gt;&amp;nbsp; (print)&lt;BR /&gt;&amp;nbsp; (while (&amp;lt; i len)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;(setq en (ssname ss i))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;(setq atxt (cdr (assoc 1 (cdr (setq eg (entget en)))))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pti (cdr (assoc 10 eg))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;(princ (strcat "boundary of " atxt "[.."))&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;(setq pl (polygonAroundPoint pti)) ; crea poligono alrededor del punto de insercion de este texto&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;(if pl&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (progn&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(command "area" "O" pl)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(setq m2 (rtos (getvar "area") 2 3))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(princ m2)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;;(command "erase" pl "")&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;(setq i (1+ i))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;(princ "..]")&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;(print)&lt;BR /&gt;&amp;nbsp; &amp;nbsp;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;;;------------------------------------------------------------&lt;BR /&gt;;; Function to get the absolutely last entity in the database:&lt;BR /&gt;;;&lt;BR /&gt;(defun @entlast ( / e elast)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; (setq elast (entlast))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; (while (setq e (entnext elast))&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(setq elast e)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; )&lt;BR /&gt;&amp;nbsp; &amp;nbsp; elast&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;(defun polygonAroundPoint (p / elast ucs e)&lt;BR /&gt;&amp;nbsp; &amp;nbsp;(setq elast (@entlast))&lt;BR /&gt;&amp;nbsp; &amp;nbsp;(command "._zoom" "_c" p 3000)&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;(setq ucs (not (command "_.UCS" "_Origin" (getvar "viewctr"))))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; (if (and&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(not (command "_.boundary" "_A" "_I" "_N" "" "_O" "_P" "_B" "_E" "" (trans p 0 1) ""))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(setq ucs (command "_.UCS" "_P") e (entlast))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(or (not (equal e elast))(prompt " Failed to find polygon."))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;e&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;nil&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While testing this program with the annexed drawing, the polygon created for "4" is wrong. The polygon eliminates a peak in the lower right part of the parcel. I can´t explain this weird behaviour.&lt;/P&gt;&lt;P&gt;Anybody could help me ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2017 05:47:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/boundary-not-working-correctly/m-p/7320878#M116051</guid>
      <dc:creator>scadcam</dc:creator>
      <dc:date>2017-08-23T05:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: Boundary not working correctly</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/boundary-not-working-correctly/m-p/7321261#M116052</link>
      <description>&lt;P&gt;Try...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(defun c:Areas (/ ssTexts apertura osmodo )
    (setvar "CMDECHO" 0)
    (setq osmodo (getvar "OSMODE") apertura (getvar "APERTURE"))

    (setvar "OSMODE" 0)
    (setvar "APERTURE" 5)
    (setq ssTexts (ssget "_X" (list (cons 0 "TEXT"))))

    (getAreas ssTexts)

    (setvar "OSMODE" osmodo)
    (alert "******************** End ************************")
)


(defun getAreas (ss / i en atext pl len m2 eg pti )
    (setq i 0 len (sslength ss))
    (print)
    (command "_-VIEW" "_D" "INIZ")  
    (command "_-VIEW" "_S" "INIZ") 
    (while (&amp;lt; i len)
        (setq en (ssname ss i))
        (setq atxt (cdr (assoc 1 (cdr (setq eg (entget en)))))
              pti (cdr (assoc 10 eg))
        )
        (princ (strcat "boundary of " atxt "[.."))

        (setq first t) 
        (setq pl (polygonAroundPoint pti)) ; crea poligono alrededor del punto de insercion de este texto

        (if pl
            (progn
                (command "zoom" "_o" (entlast) "")
                (command "zoom" "0.9x" )
                (command "_erase" pl "")
                (setq first nil)
                (setq pl (polygonAroundPoint pti))
                (command "area" "O" pl)
                (setq m2 (rtos (getvar "area") 2 3))
                (princ m2)
               ;(command "erase" pl "")
            )
        )
        (setq i (1+ i))
        (princ "..]")
        (print)
    )
    (command "_-VIEW" "_R" "INIZ") 
    (command "_-VIEW" "_D" "INIZ") 
)



;;------------------------------------------------------------
;; Function to get the absolutely last entity in the database:
;;
(defun @entlast ( / e elast)
    (setq elast (entlast))
    (while (setq e (entnext elast)) 
    (setq elast e)
       )
    elast
)

(defun polygonAroundPoint (p / elast ucs e)
    (setq elast (@entlast))
    (if first (command "._zoom" "_c" p 3000))

    (setq ucs (not (command "_.UCS" "_Origin" (getvar "viewctr"))))
    (if (and
            (not (command "_.boundary" "_A" "_I" "_N" "" "_O" "_P" "_B" "_E" "" (trans p 0 1) ""))
            (setq ucs (command "_.UCS" "_P") e (entlast))
            (or (not (equal e elast))(prompt " Failed to find polygon."))
        )
        e
        nil
    )
)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2017 08:52:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/boundary-not-working-correctly/m-p/7321261#M116052</guid>
      <dc:creator>gpcattaneo</dc:creator>
      <dc:date>2017-08-23T08:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: Boundary not working correctly</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/boundary-not-working-correctly/m-p/7324157#M116053</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/586759" target="_self"&gt;gpcattaneo&lt;/A&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Tried your suggestion but does the same thing. The generated polygon for "4" is wrong (see attachment).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Still does not understand why is so difficult to have a boundary that works reliably without having to bother on zooming to some scale. Although the parcel is not so simple is not terribly irregular. The worst part is that you don´t know when is going to fail, so you have to review each single parcel.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm using Autocad 2014&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2017 00:49:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/boundary-not-working-correctly/m-p/7324157#M116053</guid>
      <dc:creator>scadcam</dc:creator>
      <dc:date>2017-08-24T00:49:44Z</dc:date>
    </item>
    <item>
      <title>Re: Boundary not working correctly</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/boundary-not-working-correctly/m-p/7325980#M116054</link>
      <description>&lt;P&gt;Work fine for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="588.gif" style="width: 640px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/393791i41DC8205F0EA2DBE/image-size/large?v=v2&amp;amp;px=999" role="button" title="588.gif" alt="588.gif" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2017 14:33:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/boundary-not-working-correctly/m-p/7325980#M116054</guid>
      <dc:creator>gpcattaneo</dc:creator>
      <dc:date>2017-08-24T14:33:21Z</dc:date>
    </item>
    <item>
      <title>Re: Boundary not working correctly</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/boundary-not-working-correctly/m-p/7340798#M116055</link>
      <description>&lt;P&gt;You are right&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/586759" target="_blank"&gt;gpcattaneo&lt;/A&gt;&amp;nbsp;!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for the delay in answering. I got mixed with other boundary related problems ("valid hatch boundary not found").&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had mistakenly&amp;nbsp;used &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(command "._zoom" "_c" p 3000) instead of&lt;/PRE&gt;&lt;PRE&gt;(if first (command "._zoom" "_c" p 3000))&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;With your solution, I got rid of the badly generated polygons. Tested your solution in various complicated drawings and passed. Still, would like to have a less temperamental boundary replacement command, one that does not depend on doing the right zooms. Is there any? Maybe in Civil Map?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 01:33:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/boundary-not-working-correctly/m-p/7340798#M116055</guid>
      <dc:creator>scadcam</dc:creator>
      <dc:date>2017-08-31T01:33:10Z</dc:date>
    </item>
  </channel>
</rss>

