<?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: Auto draw multiple rectangles in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12630466#M16629</link>
    <description>&lt;P&gt;Its a simple task. but provide data how to create this rectangles i.e. what you have:&lt;/P&gt;
&lt;P&gt;centerpoint, width, height or what else.&amp;nbsp; Create small sample txt&lt;/P&gt;</description>
    <pubDate>Sun, 10 Mar 2024 15:59:26 GMT</pubDate>
    <dc:creator>hak_vz</dc:creator>
    <dc:date>2024-03-10T15:59:26Z</dc:date>
    <item>
      <title>Auto draw multiple rectangles</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12629624#M16623</link>
      <description>&lt;P&gt;I have over 300 manholes and valve pits to draw, and I have their center coordinates and dimensions. How best can I automate this process?&lt;/P&gt;</description>
      <pubDate>Sat, 09 Mar 2024 23:13:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12629624#M16623</guid>
      <dc:creator>kilama1331</dc:creator>
      <dc:date>2024-03-09T23:13:22Z</dc:date>
    </item>
    <item>
      <title>Re: Auto draw multiple rectangles</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12629635#M16624</link>
      <description>&lt;P&gt;In what form do you "have" the information?&lt;/P&gt;</description>
      <pubDate>Sat, 09 Mar 2024 23:24:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12629635#M16624</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2024-03-09T23:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: Auto draw multiple rectangles</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12629638#M16625</link>
      <description>&lt;P&gt;In PDF but I can extract to excel.&lt;/P&gt;</description>
      <pubDate>Sat, 09 Mar 2024 23:27:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12629638#M16625</guid>
      <dc:creator>kilama1331</dc:creator>
      <dc:date>2024-03-09T23:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: Auto draw multiple rectangles</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12629649#M16626</link>
      <description>&lt;P&gt;If you can get it into an Excel file in &lt;STRONG&gt;.csv&lt;/STRONG&gt; format, AutoLisp code can open and read lines from that, and separate the pieces of information around the comma separators, and draw rectangles.&amp;nbsp; That assumes that every line contains information in the same way, i.e. the pieces [center coordinates, sizes] are in the same order.&amp;nbsp; Are the rectangles always to be oriented orthogonally?&amp;nbsp; If not, presumably there's more information contained than what you've mentioned so far.&lt;/P&gt;</description>
      <pubDate>Sat, 09 Mar 2024 23:40:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12629649#M16626</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2024-03-09T23:40:33Z</dc:date>
    </item>
    <item>
      <title>Re: Auto draw multiple rectangles</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12629888#M16627</link>
      <description>&lt;P&gt;If survey field data then yes angle will be a problem, but there is today another post about rotate a block to a close by pline.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The other suggestion is can read direct from Excel no need for a csv.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Really need a Excel, a before dwg and an after.&lt;/P&gt;</description>
      <pubDate>Sun, 10 Mar 2024 05:10:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12629888#M16627</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2024-03-10T05:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: Auto draw multiple rectangles</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12630364#M16628</link>
      <description>All are orthogonal</description>
      <pubDate>Sun, 10 Mar 2024 14:18:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12630364#M16628</guid>
      <dc:creator>kilama1331</dc:creator>
      <dc:date>2024-03-10T14:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: Auto draw multiple rectangles</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12630466#M16629</link>
      <description>&lt;P&gt;Its a simple task. but provide data how to create this rectangles i.e. what you have:&lt;/P&gt;
&lt;P&gt;centerpoint, width, height or what else.&amp;nbsp; Create small sample txt&lt;/P&gt;</description>
      <pubDate>Sun, 10 Mar 2024 15:59:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12630466#M16629</guid>
      <dc:creator>hak_vz</dc:creator>
      <dc:date>2024-03-10T15:59:26Z</dc:date>
    </item>
    <item>
      <title>Re: Auto draw multiple rectangles</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12651034#M16630</link>
      <description>&lt;P&gt;Sorry for the late response&lt;BR /&gt;&lt;BR /&gt;The responses seem to agree that it is possible, but none spell out how I can achieve it.&lt;BR /&gt;I have the center coordinate, the dimensions of the manhole, and the thickness&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2024 14:49:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12651034#M16630</guid>
      <dc:creator>Emmanuel_Kilama</dc:creator>
      <dc:date>2024-03-19T14:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: Auto draw multiple rectangles</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12651506#M16631</link>
      <description>&lt;P&gt;1) you have .txt file with manholes positions and dimensions&lt;/P&gt;
&lt;P&gt;row in data is&lt;/P&gt;
&lt;P&gt;x,y,width,height, thickness&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;let say&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;100,100,150,150,25
500,500,150,150,25
300,300,150,150,25
1000,1000,150,150,25
1200,1200,150,150,25&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) Here is a list that creates manholes&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(defun c:kilama (/ *error* string_to_list f file1 redak x y w h d dx dy p1 p2)

	(defun *error* ()
		(setvar 'cmdecho 1)
		(close file1)
	)
	(defun string_to_list ( str del / pos )
        (if (setq pos (vl-string-search del str))
            (cons (substr str 1 pos) (string_to_list (substr str (+ pos 1 (strlen del))) del))
            (list str)
        )
    )  
	(setvar 'cmdecho 0)
	(setq f (getfiled "Open File" (getvar "dwgprefix") "txt" 2))
	(setq file1 (open f "r"))
	(while (setq redak (read-line file1))
		(mapcar 'set '(x y w h d) (mapcar 'atof (string_to_list redak ",")))
		(setq dx (* 0.5 w) dy (* 0.5 h))
		(setq p1 (mapcar '- (list x y) (list dx dy)))
		(setq p2 (mapcar '+ (list x y) (list dx dy)))
		(command "_.rectangle" p1 p2)
		(command "_.offset" d (entlast) (list x y) "")	
	)
	(close file1)
	(command "_.zoom" "e")
	(setvar 'cmdecho 1)
	(princ)
)&lt;/LI-CODE&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;As a result you receive&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Screenshot 2024-03-19 183324.png" style="width: 300px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1339148i0FA2C96C678B9832/image-size/small?v=v2&amp;amp;px=200" role="button" title="Screenshot 2024-03-19 183324.png" alt="Screenshot 2024-03-19 183324.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2024 17:37:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12651506#M16631</guid>
      <dc:creator>hak_vz</dc:creator>
      <dc:date>2024-03-19T17:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: Auto draw multiple rectangles</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12652434#M16632</link>
      <description>&lt;P&gt;When we ask for say a Excel its to help you, Hak_vz has provided an answer but is frustrating when you have to redo code when it does not match real data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So please post a Excel. Yes can read the Excel direct.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2024 03:39:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12652434#M16632</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2024-03-20T03:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: Auto draw multiple rectangles</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12795219#M16633</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;BR /&gt;Here is an example of the data i would like to draw.&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2024 11:00:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12795219#M16633</guid>
      <dc:creator>Emmanuel_Kilama</dc:creator>
      <dc:date>2024-05-24T11:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: Auto draw multiple rectangles</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12795367#M16634</link>
      <description>&lt;P&gt;That doesn't contain enough information.&amp;nbsp; Isn't it pretty obvious what is lacking?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF6600"&gt;&lt;STRONG&gt;EDIT:&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp; I think we can assume that A &amp;amp; B are plan dimensions, but are they inside or outside?&amp;nbsp; That is, if T is wall thickness, is that outward [my assumption] or inward from the A &amp;amp; B size?&amp;nbsp; Are A &amp;amp; B ever &lt;EM&gt;different&lt;/EM&gt; from each other?&amp;nbsp; If so, which is in the Easting direction and which is in the Northing direction?&amp;nbsp; And the answer to that depends on them always being oriented &lt;EM&gt;orthogonally&lt;/EM&gt;, but I can't imagine that's always the case -- I don't see anything that could be a rotation.&amp;nbsp; Or are they [not as this topic discusses, but &lt;EM&gt;could&lt;/EM&gt; they be] &lt;EM&gt;circular&lt;/EM&gt;, in which case maybe rotation wouldn't matter?&amp;nbsp; And it looks like H is Height from TOC [Top Of C...?] to BTM, but what is FGL?&amp;nbsp; Do we care for this purpose?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A simple diagram showing what the dimensions refer to would answer all questions.&lt;/P&gt;</description>
      <pubDate>Sat, 25 May 2024 12:02:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12795367#M16634</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2024-05-25T12:02:29Z</dc:date>
    </item>
    <item>
      <title>Re: Auto draw multiple rectangles</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12797082#M16635</link>
      <description>&lt;P&gt;There is enough information. You have MH-O1, a X &amp;amp; Y, and the manhole is AxB in size.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Its late now maybe tomorrow will do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 May 2024 08:57:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12797082#M16635</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2024-05-25T08:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: Auto draw multiple rectangles</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12799175#M16636</link>
      <description>&lt;P&gt;Try this matches your Excel, expects a block called MH01, which is a rectang 1.0x1.0 as a size ie 1000mm =1 metre. So for every manhole name need a block that fits in a 1x1 size. With insertion at midpoint.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just open your Excel and then run program.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/td-p/12629624
; read excel and draw rectangs at X&amp;amp;Y and size.

(defun c:manholes ( / rows maxrow scx scy d1 d2)

(defun getrangexl ( / lst UR CR RADD )
  (setq lst '())
  (setq UR (vlax-get-property  (vlax-get-property myxl "ActiveSheet") "UsedRange"))
  (setq CR (vlax-get-property UR "CurrentRegion"))
  (setq RADD (vlax-get-property CR "Address"))
  (setq cnt (vlax-get-property CR  "Count"))
  (setq lst (_csv-&amp;gt;lst58 radd))
  (setq st (vl-string-subst "" "$" (vl-string-subst "" "$" (nth 0 lst) )))
  (setq end (vl-string-subst "" "$" (vl-string-subst "" "$" (nth 1 lst) )))
  (setq st  (columnrow st))
  (setq end  (columnrow end))
)
; ColumnRow - Returns a list of the Column and Row number
; Function By: Gilles Chanteau from Marseille, France
; Arguments: 1
;   Cell$ = Cell ID
; Syntax example: (ColumnRow "ABC987") = '(731 987)
;default to "A1" if there's a problem
;-------------------------------------------------------------------------------
(defun ColumnRow (Cell$ / Column$ Char$ Row#)
  (setq Column$ "")
  (while (&amp;lt; 64 (ascii (setq Char$ (strcase (substr Cell$ 1 1)))) 91)
    (setq Column$ (strcat Column$ Char$)
          Cell$ (substr Cell$ 2)
    )
  )
  (if (and (/= Column$ "") (numberp (setq Row# (read Cell$))))
    (list (Alpha2Number Column$) Row#)
    '(1 1)
  )
)
; Alpha2Number - Converts Alpha string into Number
; Function By: Gilles Chanteau from Marseille, France
; Arguments: 1
;   Str$ = String to convert
; Syntax example: (Alpha2Number "ABC") = 731
;-------------------------------------------------------------------------------
(defun Alpha2Number (Str$ / Num#)
  (if (= 0 (setq Num# (strlen Str$)))
    0
    (+ (* (- (ascii (strcase (substr Str$ 1 1))) 64) (expt 26 (1- Num#)))
       (Alpha2Number (substr Str$ 2))
    )
  )
)

; thanks to Lee-mac for this defun 
; www.lee-mac.com
; 44 is comma 9 is tab 34 is space 58 is colon
(defun _csv-&amp;gt;lst58 ( str / pos )
	(if (setq pos (vl-string-position 58 str))
		(cons (substr str 1 pos) (_csv-&amp;gt;lst58 (substr str (+ pos 2))))
		(list str)
    )
)
;;	Thanks to fixo			;;
(defun getcell2 (row column / )
(setq cells (vlax-get-property  (vlax-get-property myxl "ActiveSheet") "Cells"))
(setq cell (vlax-get (vlax-variant-value  (vlax-get-property cells "Item" row column)) 'value))
)

(setq myxl (vlax-get-object "Excel.Application"))
 
(vla-put-visible myXL :vlax-true)
(vlax-put-property myxl 'ScreenUpdating :vlax-true)
(vlax-put-property myXL 'DisplayAlerts :vlax-true)

(setq rows 3)
(setq maxrow (- (cadr end) 2))

(repeat maxrow
(setq MH (getcell2 rows 2)
  X (getcell2 rows 3)
  Y (getcell2 rows 4)
  d1 (getcell2 rows 5)
  d2 (getcell2 rows 6)
)

(setq scx (/ d1 1000000.) scY (/ d2 1000.))

(command "-insert" mh (list x y) scx scy 0.0)

(setq rows (1+ rows))
)

(princ)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Re thickness most manholes if concrete are like 75-150 thick so just having 2 rectangs as block is fine. This still graphically indicates a wall thickness. The pit schedule implies the thickness.&lt;/P&gt;</description>
      <pubDate>Mon, 27 May 2024 04:05:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-draw-multiple-rectangles/m-p/12799175#M16636</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2024-05-27T04:05:53Z</dc:date>
    </item>
  </channel>
</rss>

