<?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: Lisp routine to draw a rectangle and hatch it in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/9670150#M71557</link>
    <description>&lt;P&gt;This worked great, I just had to tweak the layer names on my end (my fault). Is there a way write in the lisp routine to change the hatch to the pattern "solid"&lt;/P&gt;</description>
    <pubDate>Mon, 03 Aug 2020 15:47:36 GMT</pubDate>
    <dc:creator>Ajohnson0</dc:creator>
    <dc:date>2020-08-03T15:47:36Z</dc:date>
    <item>
      <title>Lisp routine to draw a rectangle and hatch it</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/9670021#M71555</link>
      <description>&lt;P&gt;I am looking to draw a column by using a lisp routing. I need it to put the border on a layer called column and the hatch on a layer called column hatch. I ideally would like to just be able to use the rectangle command and just draw a rectangle and have it automatically hatched. Could anyone here make a quick lisp routine? I am not very good at making my own and any help would be greatly appreciated&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2020 14:46:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/9670021#M71555</guid>
      <dc:creator>Ajohnson0</dc:creator>
      <dc:date>2020-08-03T14:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to draw a rectangle and hatch it</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/9670082#M71556</link>
      <description>&lt;P&gt;Just a quick one, as said...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun c:RecHatch ( / l)

  (setq l (getvar 'clayer))
  (command "_.layer" "_t" "column" "_m" "column" "")
  (command-s "_.rectang")
  (command "_.layer" "_t" "column hatch" "_m" "column hatch" "")
  (command "_.bhatch" "_s" "_l" "" "")
  (setvar 'clayer l)
  (princ)
  ) 
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2020 15:22:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/9670082#M71556</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2020-08-03T15:22:59Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to draw a rectangle and hatch it</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/9670150#M71557</link>
      <description>&lt;P&gt;This worked great, I just had to tweak the layer names on my end (my fault). Is there a way write in the lisp routine to change the hatch to the pattern "solid"&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2020 15:47:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/9670150#M71557</guid>
      <dc:creator>Ajohnson0</dc:creator>
      <dc:date>2020-08-03T15:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to draw a rectangle and hatch it</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/9670153#M71558</link>
      <description>&lt;P&gt;and to leave it open ended until I close the command so I can do multiple columns&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2020 15:48:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/9670153#M71558</guid>
      <dc:creator>Ajohnson0</dc:creator>
      <dc:date>2020-08-03T15:48:51Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to draw a rectangle and hatch it</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/9670158#M71559</link>
      <description>&lt;P&gt;Here's another that inserts a block:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:foo (/ a b c)
  ;; RJP » 2020-08-03
  (cond	((null (tblobjname "block" "_hatchedbox"))
	 (entmake '((0 . "BLOCK")
		    (100 . "AcDbEntity")
		    (67 . 0)
		    (8 . "0")
		    (100 . "AcDbBlockReference")
		    (2 . "_hatchedbox")
		    (10 0. 0. 0.)
		    (70 . 0)
		   )
	 )
	 (entmake '((0 . "HATCH")
		    (100 . "AcDbEntity")
		    (8 . "Column Hatch")
		    (62 . 254)
		    (440 . 33554559)
		    (100 . "AcDbHatch")
		    (10 0. 0. 0.)
		    (210 0. 0. 1.)
		    (2 . "SOLID")
		    (70 . 1)
		    (71 . 0)
		    (91 . 1)
		    (92 . 1)
		    (93 . 4)
		    (72 . 1)
		    (10 -0.5 0.5 0.)
		    (11 0.5 0.5 0.)
		    (72 . 1)
		    (10 0.5 0.5 0.)
		    (11 0.5 -0.5 0.)
		    (72 . 1)
		    (10 0.5 -0.5 0.)
		    (11 -0.5 -0.5 0.)
		    (72 . 1)
		    (10 -0.5 -0.5 0.)
		    (11 -0.5 0.5 0.)
		    (97 . 0)
		    (75 . 1)
		    (76 . 1)
		    (98 . 1)
		    (10 0. 0. 0.)
		    (450 . 0)
		    (451 . 0)
		    (460 . 0.)
		    (461 . 0.)
		    (452 . 0)
		    (462 . 0.)
		    (453 . 2)
		    (463 . 0.)
		    (63 . 5)
		    (421 . 255)
		    (463 . 1.)
		    (63 . 2)
		    (421 . 16776960)
		    (470 . "LINEAR")
		   )
	 )
	 (entmake '((0 . "LWPOLYLINE")
		    (100 . "AcDbEntity")
		    (67 . 0)
		    (8 . "Column")
		    (62 . 5)
		    (100 . "AcDbPolyline")
		    (90 . 4)
		    (70 . 129)
		    (43 . 0.)
		    (38 . 0.)
		    (39 . 0.)
		    (10 -0.5 0.5)
		    (40 . 0.)
		    (41 . 0.)
		    (42 . 0.)
		    (91 . 0)
		    (10 0.5 0.5)
		    (40 . 0.)
		    (41 . 0.)
		    (42 . 0.)
		    (91 . 0)
		    (10 0.5 -0.5)
		    (40 . 0.)
		    (41 . 0.)
		    (42 . 0.)
		    (91 . 0)
		    (10 -0.5 -0.5)
		    (40 . 0.)
		    (41 . 0.)
		    (42 . 0.)
		    (91 . 0)
		   )
	 )
	 (entmake '((0 . "ENDBLK") (100 . "AcDbBlockEnd") (8 . "0")))
	)
  )
  (while (and (setq a (getpoint "\nSpecify first corner point: "))
	      (setq b (getcorner a "\nSpecify other corner point: "))
	      (setq c (mapcar 'abs (mapcar '- a b)))
	 )
    (entmakex (list '(0 . "INSERT")
		    '(100 . "AcDbEntity")
		    '(8 . "Column")
		    '(100 . "AcDbBlockReference")
		    '(2 . "_hatchedbox")
		    (cons 10 (polar a (angle a b) (/ (distance a b) 2.)))
		    (cons 41 (car c))
		    (cons 42 (cadr c))
		    '(43 . 1.0)
		    '(50 . 0.0)
	      )
    )
  )
  (princ)
)&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 03 Aug 2020 15:51:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/9670158#M71559</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2020-08-03T15:51:31Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to draw a rectangle and hatch it</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/9670174#M71560</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1779365"&gt;@ВeekeeCZ&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6481001"&gt;@Ajohnson0&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1779365"&gt;@ВeekeeCZ&lt;/a&gt;&amp;nbsp;wrote:&lt;PRE&gt;.....&lt;BR /&gt;(command-s "_.rectang")&lt;BR /&gt;.....&lt;/PRE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I learned recently that this can actually cause a problem if the user exits the RECTANG command. If the user exits during the "command-s" call then the rest of the code still gets executed..&lt;/P&gt;&lt;P&gt;Which means, &lt;FONT color="#000000"&gt;&lt;STRONG&gt;this line will Still Hatch the Last item even if the user is trying to exit&lt;/STRONG&gt;&lt;/FONT&gt; your command..&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;PRE&gt;  (command "_.bhatch" "_s" "_l" "" "")&lt;/PRE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;This is probably not desired...&lt;/P&gt;&lt;P&gt;I &lt;U&gt;would not recommend this approach&lt;/U&gt; and am posting this to help spread the awareness.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;~DD&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2020 15:59:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/9670174#M71560</guid>
      <dc:creator>CodeDing</dc:creator>
      <dc:date>2020-08-03T15:59:17Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to draw a rectangle and hatch it</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/9670220#M71561</link>
      <description>&lt;P&gt;Here it is.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun c:RecHatch ( / l)

  (setq l (getvar 'clayer))
  (command "_.layer" "_t" "column hatch,column" "_m" "column hatch" "_m" "column" "")
  (command "_.rectang")
  (while (&amp;gt; (getvar 'cmdactive) 0) (command pause))
  (command "_.bhatch" "_s" "_l" "" "_p" "solid" "")
  (command "_.chprop" "_l" "" "_la" "column hatch" "")
  (while (setq pt (getpoint "\nSpecify first corner point: "))
    (command "_.rectang" "_none" pt pause)
    (command "_.bhatch" "_s" "_l" "" "_p" "solid" "")
    (command "_.chprop" "_l" "" "_la" "column hatch" ""))
  (setvar 'clayer l)
  (princ)
  ) 
&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Aug 2020 16:14:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/9670220#M71561</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2020-08-03T16:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to draw a rectangle and hatch it</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/9670892#M71562</link>
      <description>&lt;P&gt;If you want a dcl input for length and width this uses a library function Multi get vals.lsp to make a dcl on the fly. Just remove the dim stuff and add hatch.&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-inline" image-alt="screenshot235.png" style="width: 197px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/802852iA6ECBDE8FE82EC29/image-size/large?v=v2&amp;amp;px=999" role="button" title="screenshot235.png" alt="screenshot235.png" /&gt;&lt;/span&gt;&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>Mon, 03 Aug 2020 23:35:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/9670892#M71562</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2020-08-03T23:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to draw a rectangle and hatch it</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/10341980#M71563</link>
      <description>&lt;P&gt;what's the command of lisp plz.?&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 18:29:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/10341980#M71563</guid>
      <dc:creator>majed.eng86</dc:creator>
      <dc:date>2021-05-26T18:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to draw a rectangle and hatch it</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/10342413#M71564</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6091799"&gt;@majed.eng86&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;RecHatch&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 May 2021 21:16:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/10342413#M71564</guid>
      <dc:creator>devitg</dc:creator>
      <dc:date>2021-05-26T21:16:40Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to draw a rectangle and hatch it</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/11858993#M71565</link>
      <description>&lt;P&gt;Please update this lisp to have DCL for input width, length value, and after that save name block is (length x width) value, such as:&lt;/P&gt;&lt;P&gt;1- Input length value (mm) - on dialogue on screen CAD command: 500&lt;/P&gt;&lt;P&gt;2- Input width value (mm) - on dialogue on screen CAD command: 300&lt;/P&gt;&lt;P&gt;3-Select type hatch (on dialoge), such as solid hatch type&lt;/P&gt;&lt;P&gt;4- Result will be: Solid_500x300 is name of block&lt;/P&gt;&lt;P&gt;Thanks a lot&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2023 11:37:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/11858993#M71565</guid>
      <dc:creator>tanbqtb03</dc:creator>
      <dc:date>2023-03-30T11:37:19Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to draw a rectangle and hatch it</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/11865655#M71566</link>
      <description>&lt;P&gt;Did you try to use my multigetvals yourself, you load it and run 1 line of code, look into the top of code for examples.&lt;/P&gt;</description>
      <pubDate>Sun, 02 Apr 2023 03:20:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/11865655#M71566</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2023-04-02T03:20:53Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to draw a rectangle and hatch it</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/11870181#M71567</link>
      <description>&lt;P&gt;In my drawing this lisp will be make rectang with input length, width (height) and dim it. If I have any mistake please reguide me. Such as attatched image:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tanbqtb03_0-1680583485978.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1197657iEE19F7F6A0727EEA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tanbqtb03_0-1680583485978.png" alt="tanbqtb03_0-1680583485978.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please update this lisp to have DCL for input width, length value, and after that save name block is (length x width) value, such as:&lt;/P&gt;&lt;P&gt;1- Input length value (mm) - on dialogue on screen CAD command: 500 &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;==&amp;gt; OK&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2- Input width value (mm) - on dialogue on screen CAD command: 300 &lt;FONT color="#FF0000"&gt;==&amp;gt; OK&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;3-Select type hatch (on dialoge), such as solid hatch type&lt;/P&gt;&lt;P&gt;4- Result will be: Solid_500x300 is name of block&lt;/P&gt;&lt;P&gt;5- This lisp can be asking: Continuos with the same previous block (input value: number of blocks). If not, return for step 01 for another type block&lt;/P&gt;&lt;P&gt;Thanks alot&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2023 04:45:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/11870181#M71567</guid>
      <dc:creator>tanbqtb03</dc:creator>
      <dc:date>2023-04-04T04:45:48Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to draw a rectangle and hatch it</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/11870964#M71568</link>
      <description>&lt;P&gt;Like this look at the top of the code lots of examples.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(if (not AH:getvalsm)(load "Multi Getvals.lsp"))
(setq ans (AH:getvalsm (list "Enter values " "Length " 5 4 "500" "width" 5 4 "300" "Hatch pattern" 11 10 "Solid")))
(setq Len (atof (car ans)) wid (atof (cadr ans)) pat (caddr ans))&lt;/LI-CODE&gt;&lt;P&gt;if you looked in file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2023 10:00:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/11870964#M71568</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2023-04-04T10:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to draw a rectangle and hatch it</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/12770586#M71569</link>
      <description>&lt;P&gt;for some reason my set layer is not reverting back to what it was prior to executing this lisp.&amp;nbsp;&lt;/P&gt;&lt;P&gt;also, right now it asks me what angle i want and then for another point.&lt;/P&gt;&lt;P&gt;1) Is there a way to have it skip the second prompt (the one for a point)?&lt;/P&gt;&lt;P&gt;2) Is there a way to get it so that when it asks me for an angle i can put in "V" for (45) and "H" for (135)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(defun c:RecHatch ( / l)&lt;/P&gt;&lt;P&gt;(setq prevlayer (getvar 'clayer))&lt;BR /&gt;(command "_.layer" "_t" "ISE_Hatch,ISE_Outline BRG" "_m" "ISE_Hatch" "_m" "ISE_Outline BRG" "")&lt;BR /&gt;(command "_.rectang")&lt;BR /&gt;(while (&amp;gt; (getvar 'cmdactive) 0) (command pause))&lt;BR /&gt;(command "_.bhatch" "_s" "_l" "" "_p" "ansi31" "45")&lt;BR /&gt;(command "_.chprop" "_l" "" "_la" "ISE_Hatch" "")&lt;BR /&gt;(while (setq pt (getpoint "\nSpecify first corner point: "))&lt;BR /&gt;(command "_.rectang" "_none" pt pause)&lt;BR /&gt;(command "_.bhatch" "_s" "_l" "" "_p" "ansi31" "")&lt;BR /&gt;(command "_.chprop" "_l" "" "_la" "ISE_Hatch" ""))&lt;BR /&gt;(setvar 'clayer prevlayer)&lt;BR /&gt;(princ)&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2024 21:33:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/12770586#M71569</guid>
      <dc:creator>mbracciahubbard</dc:creator>
      <dc:date>2024-05-13T21:33:01Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to draw a rectangle and hatch it</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/12770781#M71570</link>
      <description>&lt;P&gt;The responses to the prompts in the BHATCH commands are incorrect.&amp;nbsp; You should run it manually at the command line, and note the sequence of what it asks for and in what order.&amp;nbsp; Do it within a&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt; (command) &lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;prompt:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;(command "_.bhatch")&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;to start it off and leave you in the command, because some commands work a little differently there than when just typed at the command line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Mostly, you don't account for the Scale prompt.&amp;nbsp; And you don't seem to have enough Enters to tell it you're done with various things.&amp;nbsp; Try [and study what's different about] this:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun c:RecHatch (/ prevlayer pt)
  (setq prevlayer (getvar 'clayer))
  (command
    "_.layer" "_t" "ISE_Hatch,ISE_Outline BRG" "_m" "ISE_Hatch" "_m" "ISE_Outline BRG" ""
    "_.rectang"
  )
  (while (&amp;gt; (getvar 'cmdactive) 0) (command pause)); finish rectangle
  (command
    "_.bhatch" "_s" "_l" "" "_p" "ansi31" "" "45" ""
    "_.chprop" "_l" "" "_la" "ISE_Hatch" ""
  )
  (while (setq pt (getpoint "\nSpecify first corner point or &amp;lt;exit&amp;gt;: "))
    (command
      "_.rectang" "_none" pt pause
      "_.bhatch" "_s" "_l" "" "_p" "ansi31" "" "" ""
      "_.chprop" "_l" "" "_la" "ISE_Hatch" ""
    )
  )
  (setvar 'clayer prevlayer)
  (princ)
)&lt;/LI-CODE&gt;
&lt;P&gt;But you probably &lt;EM&gt;should&lt;/EM&gt; say something about the scale, rather than just accepting the default as the above does.&amp;nbsp; Who knows what that might be at a given time?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, the first one seems to be just like the continuation of more after that.&amp;nbsp; Is there some reason it couldn't be within &lt;EM&gt;one&lt;/EM&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt; (while)&lt;/FONT&gt; &lt;/STRONG&gt;&lt;/FONT&gt;function -- just the followup repeating round, without the separate first round?&amp;nbsp; Is there supposed to be something different about the first one?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I would suggest you investigate using HATCH instead of BHATCH -- it seems more direct about it, to me.&amp;nbsp; And also the use of a&amp;nbsp;&lt;STRONG&gt;U&lt;/STRONG&gt;ser-specified pattern, so you can just &lt;EM&gt;tell it directly&lt;/EM&gt; the line spacing and angle you want, instead of monkeying around with how ANSI31 is defined and compensating from there.&amp;nbsp; It's silly to tell it to use ANSI31 &lt;EM&gt;at 45° to get your lines vertical&lt;/EM&gt; -- with a User-defined pattern, you can tell it 90° outright.&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 00:11:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/12770781#M71570</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2024-05-14T00:11:01Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to draw a rectangle and hatch it</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/12771162#M71571</link>
      <description>&lt;P&gt;A update to previous code, download the Multi getvals.lsp.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SeaHaven_0-1715662749248.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1361700i09111F0968CE53A3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SeaHaven_0-1715662749248.png" alt="SeaHaven_0-1715662749248.png" /&gt;&lt;/span&gt;&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;; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/td-p/9670021
; Simle draw rectang and hatch

(defun c:wow ( / ans len wid ang hsc pat)

(if (not AH:getvalsm)(load "Multi Getvals.lsp"))

(if (= pat nil)(setq pat "Solid"))
(if (= len nil)(setq len 500))
(if (= wid nil)(setq wid 250))
; add more defaults use rtos 

(while (setq pt (getpoint "\nPick lower left point Enter to exit "))

(setq ans (AH:getvalsm (list "Enter values " "Length " 5 4 (rtos len 2 1) "width" 5 4 (rtos wid 2 1) "Hatch pattern" 11 10 pat "Hatch angle " 5 4 "0" "hatch scale " 5 4 "1")))
(setq Len (atof (nth 0 ans)) wid (atof (nth 1 ans)) pat (nth 2 ans) ang (atof (nth 3 ans)) hsc (atof (nth 4 ans)))

(command "_.layer" "_t" "column hatch,column" "_m" "column hatch" "_m" "column" "")

(command "rectang" pt (mapcar '+ pt (list len wid 0.0)))
(setvar 'hpname pat)
(setvar 'clayer "column hatch")
(if (= pat "Solid")
  (command "_.hatch" "S" (entlast) "" "")
  (command "_.hatch" "P" "" hsc ang "S" (entlast) "" "")
)
)
(princ)
)
(c:wow)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For me would add a CHKLAY function that checks does layer exist if not make it and set color and linetype etc.&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 01:17:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/12771162#M71571</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2024-05-15T01:17:21Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to draw a rectangle and hatch it</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/12772551#M71572</link>
      <description>Ok this works perfectly for me! i'm new to lisps and have zero coding background so i'm going to study the difference here and try to figure this all out. thank you!</description>
      <pubDate>Tue, 14 May 2024 14:38:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/12772551#M71572</guid>
      <dc:creator>mbracciahubbard</dc:creator>
      <dc:date>2024-05-14T14:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to draw a rectangle and hatch it</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/12773029#M71573</link>
      <description>&lt;P&gt;Here's a snazzier version, using some of what I suggested earlier [User-specified pattern, direct input on spacing and angle], and with enhancements like ensuring the Layer gets reset even if ended with ESCape [unlike my earlier one, which needed Enter/space to end it to have the Layer reset], Undo begin/end wrapping, and remembering your choices and offering them as defaults.&amp;nbsp; See comments at the top of the file.&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 17:44:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/12773029#M71573</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2024-05-14T17:44:27Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to draw a rectangle and hatch it</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/12847719#M71574</link>
      <description>&lt;P&gt;any idea on how i can edit this code so that the hatch scale is always 32? i don't want it to prompt me, i just want it set to 32&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 19:55:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-draw-a-rectangle-and-hatch-it/m-p/12847719#M71574</guid>
      <dc:creator>mbracciahubbard</dc:creator>
      <dc:date>2024-06-18T19:55:28Z</dc:date>
    </item>
  </channel>
</rss>

