<?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: Looking for help with a formula to evenly divide &amp;quot;lites&amp;quot; in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/looking-for-help-with-drawing-diamond-patterns-with-lisp/m-p/11490359#M39623</link>
    <description>&lt;P&gt;If&lt;FONT face="courier new,courier"&gt; &lt;STRONG&gt;&lt;FONT color="#000000"&gt;hor&lt;/FONT&gt;&lt;/STRONG&gt; &lt;/FONT&gt;is the number of divisions along the horizontal top/bottom edges, and&lt;FONT face="courier new,courier"&gt; &lt;STRONG&gt;&lt;FONT color="#000000"&gt;ver&lt;/FONT&gt;&lt;/STRONG&gt; &lt;/FONT&gt;the same for the vertical side edges, and &lt;EM&gt;if each corner has a muntin coming out of it&lt;/EM&gt; as in your image [that is, &lt;EM&gt;not&lt;/EM&gt; these kinds of arrangements:]&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kent1Cooper_0-1666095741994.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1128733iC2AAED287222C262/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kent1Cooper_0-1666095741994.png" alt="Kent1Cooper_0-1666095741994.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;then the number of panes is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;&lt;STRONG&gt;(+ (* hor (1+ ver)) (* ver (1+ hor)))&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So giving it the divisions you can get the resulting number of panes, but going in the other direction may not be feasible, since the numbers play off against each other.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you really intending to ask for &lt;EM&gt;any number&lt;/EM&gt; of panes?&amp;nbsp; Your image could get to your 31 by dividing either direction [presumably the vertical edges] into 4 instead of 3, but if you asked for 30, there may not be any combination that will give you that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF6600"&gt;&lt;STRONG&gt;EDIT:&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt; How about just a chart?&amp;nbsp; Surely the number of divisions in either direction is not going to be less than 2, nor more than some reasonably low number [maybe something like 8?].&amp;nbsp; A simple graph could put the number of horizontal divisions across the top and the vertical down the side, and be filled in with the resulting number of panes for each combination, and you could just look for a number you like, and wouldn't try any that can't be done.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kent1Cooper_1-1666096485727.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1128740iD8B0769FED090B56/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kent1Cooper_1-1666096485727.png" alt="Kent1Cooper_1-1666096485727.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 18 Oct 2022 12:36:28 GMT</pubDate>
    <dc:creator>Kent1Cooper</dc:creator>
    <dc:date>2022-10-18T12:36:28Z</dc:date>
    <item>
      <title>Looking for help with drawing diamond patterns with lisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/looking-for-help-with-drawing-diamond-patterns-with-lisp/m-p/11490229#M39622</link>
      <description>&lt;P&gt;I am wanting to write a lisp to do diamond lite patterns and the first place to start (in my opinion) would be a formula to evenly size the diamonds no matter the opening. Trying to find the formula to divide space into equal lites, can't find anything on google etc... So the general idea here would be that Instead of just drawing the same pattern everytime, I would specify a number of individual lites, and it would draw them as in the picture. So what I'm really looking for is, if I am aiming for say 31 lites, How can I figure out how many points to draw the lines from? (see picture below)&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="annoisscary_0-1666093188602.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1128690iC42A202561B2E3A2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="annoisscary_0-1666093188602.png" alt="annoisscary_0-1666093188602.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated, thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 17:37:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/looking-for-help-with-drawing-diamond-patterns-with-lisp/m-p/11490229#M39622</guid>
      <dc:creator>annoisscary</dc:creator>
      <dc:date>2022-10-18T17:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for help with a formula to evenly divide "lites"</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/looking-for-help-with-drawing-diamond-patterns-with-lisp/m-p/11490359#M39623</link>
      <description>&lt;P&gt;If&lt;FONT face="courier new,courier"&gt; &lt;STRONG&gt;&lt;FONT color="#000000"&gt;hor&lt;/FONT&gt;&lt;/STRONG&gt; &lt;/FONT&gt;is the number of divisions along the horizontal top/bottom edges, and&lt;FONT face="courier new,courier"&gt; &lt;STRONG&gt;&lt;FONT color="#000000"&gt;ver&lt;/FONT&gt;&lt;/STRONG&gt; &lt;/FONT&gt;the same for the vertical side edges, and &lt;EM&gt;if each corner has a muntin coming out of it&lt;/EM&gt; as in your image [that is, &lt;EM&gt;not&lt;/EM&gt; these kinds of arrangements:]&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kent1Cooper_0-1666095741994.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1128733iC2AAED287222C262/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kent1Cooper_0-1666095741994.png" alt="Kent1Cooper_0-1666095741994.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;then the number of panes is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;&lt;STRONG&gt;(+ (* hor (1+ ver)) (* ver (1+ hor)))&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So giving it the divisions you can get the resulting number of panes, but going in the other direction may not be feasible, since the numbers play off against each other.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you really intending to ask for &lt;EM&gt;any number&lt;/EM&gt; of panes?&amp;nbsp; Your image could get to your 31 by dividing either direction [presumably the vertical edges] into 4 instead of 3, but if you asked for 30, there may not be any combination that will give you that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF6600"&gt;&lt;STRONG&gt;EDIT:&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt; How about just a chart?&amp;nbsp; Surely the number of divisions in either direction is not going to be less than 2, nor more than some reasonably low number [maybe something like 8?].&amp;nbsp; A simple graph could put the number of horizontal divisions across the top and the vertical down the side, and be filled in with the resulting number of panes for each combination, and you could just look for a number you like, and wouldn't try any that can't be done.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kent1Cooper_1-1666096485727.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1128740iD8B0769FED090B56/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kent1Cooper_1-1666096485727.png" alt="Kent1Cooper_1-1666096485727.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 12:36:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/looking-for-help-with-drawing-diamond-patterns-with-lisp/m-p/11490359#M39623</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2022-10-18T12:36:28Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for help with a formula to evenly divide "lites"</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/looking-for-help-with-drawing-diamond-patterns-with-lisp/m-p/11490511#M39624</link>
      <description>&lt;P&gt;Great solution so far, however you did expand on something I didn't. the patterns could go 1 of 2 ways, either as shown in the picture I provided, or as shown in the first pattern in the example you provided. The chart is a good idea, I was aware some combinations just aren't possible and figured I would either make a list of possible numbers or let it error out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So next question would be, what method could I use to figure out the pattern for the first example you provided?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 13:09:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/looking-for-help-with-drawing-diamond-patterns-with-lisp/m-p/11490511#M39624</guid>
      <dc:creator>annoisscary</dc:creator>
      <dc:date>2022-10-18T13:09:23Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for help with a formula to evenly divide "lites"</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/looking-for-help-with-drawing-diamond-patterns-with-lisp/m-p/11490564#M39625</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11155448"&gt;@annoisscary&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;....what method could I use to figure out the pattern for the first example you provided?&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;In that situation, with muntins &lt;EM&gt;not&lt;/EM&gt; coming from the corners, if&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt; hor&lt;/FONT&gt; &lt;/STRONG&gt;&lt;/FONT&gt;is now the number of muntin &lt;EM&gt;points&lt;/EM&gt; along the horizontal top/bottom edges [one fewer than the number of &lt;EM&gt;divisions&lt;/EM&gt; they create, but the divisions are not the same size], and&lt;FONT face="courier new,courier" color="#000000"&gt;&lt;STRONG&gt; ver&lt;/STRONG&gt; &lt;/FONT&gt;the same for the vertical sides, then the number of panes is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;(+ (* hor ver) (* (1+ hor) (1+ ver)))&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You would presumably use DIVIDE along Line edges with &lt;EM&gt;twice&lt;/EM&gt; the number of muntin points, and use &lt;EM&gt;every other&lt;/EM&gt; resulting Point to draw the muntins from/to.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Further &lt;STRONG&gt;&lt;FONT color="#FF6600"&gt;EDIT:&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp; Another twist is to use the &lt;STRONG&gt;DIV+&lt;/STRONG&gt; command in &lt;STRONG&gt;DivideMeasurePlus.lsp&lt;/STRONG&gt;, &lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/share-your-favorite-usefull-lisp-files/m-p/8071104/highlight/true#M370151" target="_blank" rel="noopener"&gt;&amp;gt;here&amp;lt;&lt;/A&gt;.&amp;nbsp; It has several enhancements/improvements compared to the regular DIVIDE command, one of which is that it gives you the option to put the Points [or Blocks, etc.] &lt;STRONG&gt;&lt;EM&gt;at the midpoints of the divisions&lt;/EM&gt;&lt;/STRONG&gt;, rather than the standard of putting them at the division points.&amp;nbsp; Using that on Line edges, with the desired number of muntin points [&lt;EM&gt;not&lt;/EM&gt; doubled] will give you the Points where you need them, directly.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 13:39:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/looking-for-help-with-drawing-diamond-patterns-with-lisp/m-p/11490564#M39625</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2022-10-18T13:39:27Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for help with a formula to evenly divide "lites"</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/looking-for-help-with-drawing-diamond-patterns-with-lisp/m-p/11490640#M39626</link>
      <description>&lt;P&gt;Okay so, having a good foundation for figuring out what patterns are possible now, do you have any recommendations on how I would actually draw them? Not asking for you to write it all out or anything, a suggestion would do.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 13:46:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/looking-for-help-with-drawing-diamond-patterns-with-lisp/m-p/11490640#M39626</guid>
      <dc:creator>annoisscary</dc:creator>
      <dc:date>2022-10-18T13:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for help with a formula to evenly divide "lites"</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/looking-for-help-with-drawing-diamond-patterns-with-lisp/m-p/11490912#M39627</link>
      <description>&lt;P&gt;Is the perimeter to draw them in a Polyline rectangle, or four Lines?&amp;nbsp; Either way, finding the Point locations along the edges should be doable though challenging.&amp;nbsp; A routine would need to establish which edges are vertical and which horizontal with some kind of comparison, and apply the right divisions to the right edges.&amp;nbsp; If a Polyline, it would need to take into account at which corner is starts and in which direction it's drawn.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Even more interesting would be the calculation of &lt;EM&gt;which locations to connect to which others&lt;/EM&gt;.&amp;nbsp; In your image, with equal numbers of divisions in the two directions, Lines go across the diagonally opposite corners -- easy enough as a start.&amp;nbsp; Then a Line [or Polyline?] would need to start 1/3 of the way from the &lt;EM&gt;left&lt;/EM&gt; end of the bottom edge, find its way to 1/3 of the way &lt;EM&gt;down&lt;/EM&gt; from the top on the right, then 1/3 of the way from the &lt;EM&gt;right&lt;/EM&gt; on the top, etc.&amp;nbsp; If it was 31 panes in 3Hx4V division, no straight diagonals -- a Line would go from [for example] the bottom left corner to some place along the right edge, and then from there up to a place along the top edge, and from there down to a place along the left edge, etc.&amp;nbsp; Figuring out those relationships could be difficult, but it may be possible.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a cockamamie idea:&amp;nbsp; How about two User-defined &lt;STRONG&gt;Hatch patterns&lt;/STRONG&gt; of parallel lines running in the two angular directions?&amp;nbsp; A routine could pretty easily use the division numbers and the size of the outline to calculate the angles needed and the spacing, with a little trigonometry.&amp;nbsp; Origin points would be at corners in your diagram, and non-corner origin points for mine could be calculated pretty easily.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 14:49:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/looking-for-help-with-drawing-diamond-patterns-with-lisp/m-p/11490912#M39627</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2022-10-18T14:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for help with a formula to evenly divide "lites"</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/looking-for-help-with-drawing-diamond-patterns-with-lisp/m-p/11490965#M39628</link>
      <description>&lt;P&gt;I had thought of doing hatch patterns, and it might still be an option. But before I get to far into this let me throw another thing into the mix that's going to make this even more of a pain. (lol, sorry.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The fun part about all of this is that the diamonds outline could be basically any overall width. so just to get the ball rolling I've been just using a single segment, which would be the center point for my actually bar. So in reality its going to end up looking like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="annoisscary_0-1666105375602.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1128839iAC08FD4F1FEF8BBB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="annoisscary_0-1666105375602.png" alt="annoisscary_0-1666105375602.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So my thoughts are that yeah, Sometimes a hatch would work if I was drawing something like leaded class for instance. But if I'm drawing anything else its going to be offset from the center line. Now ideally I would draw it all out in a routine, however anything is better than the way we typically draw it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So again, any ideas? I was thinking I could probably figure out a way to array everything with some trig but I'm the type who honestly doesn't know if its possible until I spend a week trying. As always, any tips appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 15:06:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/looking-for-help-with-drawing-diamond-patterns-with-lisp/m-p/11490965#M39628</guid>
      <dc:creator>annoisscary</dc:creator>
      <dc:date>2022-10-18T15:06:41Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for help with drawing diamond patterns with lisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/looking-for-help-with-drawing-diamond-patterns-with-lisp/m-p/11491333#M39629</link>
      <description>&lt;P&gt;So the pattern above is actually pretty simple when approaching it with a "draw 1 diamond, array it to fill" mentality.&lt;/P&gt;&lt;P&gt;Can just do the division the same as a rectangle pattern. Was trying to research some trig to use to figure out the difference in height and width once its offset, I'll get there eventually I think but no luck as of yet. Was thinking I could maybe "Split" the diamonds into 4 right angle triangles and use one of them to figure out the differences in size, but even assuming I work that out I'm kind of at a loss for how I will draw the quarter/Half diamonds in the corners and on the perimeter. As I'm writing this I'm thinking, maybe a function that draws triangles given a width and height. Anyways, here is where I landed with the first version.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(Defun C:DLP (/
*error*
pt1 pt3 pt2 pt4 xl yl wthht	dpt1


)
;-----------------------------------------------------------------------------------------------
	(defun *error* (msg)
	(if osm (setvar 'osmode osm))
	(and msg(not (wcmatch (strcase msg)"*CANCEL*,*QUIT*,*BREAK*,*EXIT*"))
	(princ (strcat "\nError: " msg))
	)
	(if
	(= 8 (logand (getvar 'undoctl) 8))
	(vla-endundomark adoc)
	)
	(setvar "cmdecho" 1)

    (princ)
)
;-----------------------------------------------------------------------------------------------
	(defun DrawDia (ptt1 wth ht / ptt2 ptt3 ptt4) ; draws a Diamond (Rhombus)
	(setq ptt2 (mapcar '+ ptt1 (list (/ wth 2) (/ ht 2) 0.0)))
	(setq ptt3 (mapcar '+ ptt2 (list (-(/ wth 2)) (/ ht 2) 0.0)))
	(setq ptt4 (mapcar '+ ptt3 (list (-(/ wth 2)) (-(/ ht 2)) 0.0)))
	(command "pline" ptt1 ptt2 ptt3 ptt4 "C")
	(princ)
	)
;----------------------------------------------------------------------------------------------- 
  (initget 7)
  (setq xn (getint "\nEnter Number of Columns (W): "))
  (initget 7)
  (setq yn (getint "\nEnter Number of Rows (H): "))
  (setq
		pt1 (getpoint "\nSelect Lower Left Corner: ")
        pt3 (getcorner pt1 "\nSelect Upper Right Corner: ")
        pt2 (list (car pt3) (cadr pt1))
        pt4 (list (car pt1) (cadr pt3))
        xl (distance pt1 pt2)                              
        yl (distance pt1 pt4)
		wth (/ xl xn)
		ht (/ yl yn)
		dpt1 (mapcar '+ pt1 (list (/ wth 2) 0 0))
		)
;-----------------------------------------------------------------------------------------------
	(setq adoc (vla-get-activedocument (vlax-get-acad-object)))
	(vla-startundomark adoc)
	(setq osm (getvar "osmode"))
	(setvar "osmode" 0)
;-----------------------------------------------------------------------------------------------
  (DrawDia dpt1 wth ht)
  (setq ss (ssget "L"))
  (command "-array" ss "" "R" yn xn ht wth)
  	(vla-endundomark adoc)
	(setvar "osmode" osm)
  (princ)
  )
  
  &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 17:43:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/looking-for-help-with-drawing-diamond-patterns-with-lisp/m-p/11491333#M39629</guid>
      <dc:creator>annoisscary</dc:creator>
      <dc:date>2022-10-18T17:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for help with drawing diamond patterns with lisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/looking-for-help-with-drawing-diamond-patterns-with-lisp/m-p/11492094#M39630</link>
      <description>&lt;P&gt;Looking at c/l 1st etc Kents left image &amp;nbsp;the spacing factor is hor &amp;nbsp;0.5 1 1 1 0.5 Left edge 0.5 1 0.5 then a list join of lines depending on the number of rows and columns.&lt;/P&gt;&lt;P&gt;Similar for right image&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SeaHaven_2-1666138698969.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1129062iCEF5044ED21C6E91/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SeaHaven_2-1666138698969.png" alt="SeaHaven_2-1666138698969.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(Lpt1 Tpt1)(Lpt2 Tpt2)&lt;/P&gt;&lt;P&gt;(Bpt1 Tpt3)(Bpt2 Tpt4)&lt;/P&gt;&lt;P&gt;(Bpt3 Rpt1)&lt;/P&gt;&lt;P&gt;Then do reverse maybe mirror ?&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Re offsets I have done something that used trim to make the patterns correctly, need to solve step 1 1st.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have sent a email response also.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2022 00:47:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/looking-for-help-with-drawing-diamond-patterns-with-lisp/m-p/11492094#M39630</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2022-10-19T00:47:24Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for help with drawing diamond patterns with lisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/looking-for-help-with-drawing-diamond-patterns-with-lisp/m-p/11494301#M39631</link>
      <description>&lt;P&gt;Started trying it with lines instead of an array, thought it was going pretty well but the further I get the more problems I run into. the way it is now most number combinations work, albeit with some overlap here or there. but then you get weird ones where it just doesn't work at all. I'm going to keep messing with it but I figured I would share where I'm leaving off for now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;**Edit**&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Deleted old code, didn't like how complicated the original was becoming. Ended up making it more straightforward and used mirror instead of trying to draw from each corner until they met. Works pretty well if I say so myself,&amp;nbsp; Now I just need to workout a method offset and trim everything up.&lt;/P&gt;&lt;P&gt;Here is what I have so far:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(Defun C:DLP (/
*error*
pt1 pt3 pt2 pt4 xl yl wth  ht


  DrawDia xn yn bdpt1 bdpt2 ldpt1 ldpt2 rdpt1 rdpt2 tdpt1 tdpt2
                adoc osm )
;-----------------------------------------------------------------------------------------------
	(defun *error* (msg)
	(if osm (setvar 'osmode osm))
	(and msg(not (wcmatch (strcase msg)"*CANCEL*,*QUIT*,*BREAK*,*EXIT*"))
	(princ (strcat "\nError: " msg))
	)
	(if
	(= 8 (logand (getvar 'undoctl) 8))
	(vla-endundomark adoc)
	)
	(setvar "cmdecho" 1)

    (princ)
)
;----------------------------------------------------------------------------------------------- 
  (initget 7)
  (setq xn (getint "\nEnter Number of Columns (W): "))
  (initget 7)
  (setq yn (getint "\nEnter Number of Rows (H): "))
  (setq
		pt1 (getpoint "\nSelect Lower Left Corner: ")
        pt3 (getcorner pt1 "\nSelect Upper Right Corner: ")
        pt2 (list (car pt3) (cadr pt1))
        pt4 (list (car pt1) (cadr pt3))
        xl (distance pt1 pt2)                              
        yl (distance pt1 pt4)
		mid (mapcar '+ pt1 (list (/ xl 2) (/ yl 2) 0))
		midx (mapcar '+ pt1 (list (/ xl 2) 0 0))
		wth (/ xl xn)
		ht (/ yl yn)
		bdpt1 (mapcar '+ pt1 (list (/ wth 2) 0 0))
		bdpt2 (mapcar '+ pt2 (list (-(/ wth 2)) 0 0))
		ldpt1 (mapcar '+ pt1 (list 0 (/ ht 2) 0))
		ldpt2 (mapcar '+ pt4 (list 0 (-(/ ht 2)) 0))
		rdpt1 (mapcar '+ pt2 (list 0 (/ ht 2) 0))
		rdpt2 (mapcar '+ pt3 (list 0 (-(/ ht 2)) 0))
		tdpt1 (mapcar '+ pt4 (list (/ wth 2) 0 0))
		tdpt2 (mapcar '+ pt3 (list (-(/ wth 2)) 0 0))
		)
;-----------------------------------------------------------------------------------------------
	(setq adoc (vla-get-activedocument (vlax-get-acad-object)))
	(vla-startundomark adoc)
	(setq osm (getvar "osmode"))
	(setvar "osmode" 0)
;-----------------------------------------------------------------------------------------------
	(setq ss (ssadd))
	(setq rpt (-(+ xn yn)2))
	(cond ((= xn yn)
	(setq rpt (-(+ xn yn)1))))
	(repeat rpt
	(if(and(&amp;lt;(cadr ldpt1)(cadr pt4))(&amp;lt;(car bdpt1)(car pt2)))	;Until past top left or bottom right
	(progn
	(entmake(list'(0 . "LINE")'(100 . "AcDbEntity")'(67 . 0)'(8 . "LAYER")'(100 . "AcDbLine")(cons '10 ldpt1)(cons '11 bdpt1)))
	(ssadd (entlast)ss)
	(setq bdpt1 (mapcar '+ bdpt1 (list wth 0 0)))
	(setq ldpt1 (mapcar '+ ldpt1 (list 0 ht 0))))
	)
	(if(and(&amp;gt;(cadr ldpt1)(cadr pt4))(&amp;lt;(car bdpt1)(car pt2))) ;If Past top left but not bottom right
	(progn
	(entmake(list'(0 . "LINE")'(100 . "AcDbEntity")'(67 . 0)'(8 . "LAYER")'(100 . "AcDbLine")(cons '10 tdpt1)(cons '11 bdpt1)))
	(ssadd (entlast)ss)
	(setq bdpt1 (mapcar '+ bdpt1 (list wth 0 0)))
	(setq tdpt1 (mapcar '+ tdpt1 (list wth 0 0))))
	)
	(if(and(&amp;gt;(car bdpt1)(car pt2))(&amp;lt;(cadr ldpt1)(cadr pt4))) ;if past bottom right but not top left
	(progn
	(entmake(list'(0 . "LINE")'(100 . "AcDbEntity")'(67 . 0)'(8 . "LAYER")'(100 . "AcDbLine")(cons '10 ldpt1)(cons '11 rdpt1)))
	(ssadd (entlast)ss)
	(setq rdpt1 (mapcar '+ rdpt1 (list 0 ht 0)))
	(setq ldpt1 (mapcar '+ ldpt1 (list 0 ht 0))))
	)
	(if(and(&amp;gt;(car bdpt1)(car pt2))(&amp;gt;(cadr ldpt1)(cadr pt4))) ;if past both
	(progn
	(entmake(list'(0 . "LINE")'(100 . "AcDbEntity")'(67 . 0)'(8 . "LAYER")'(100 . "AcDbLine")(cons '10 rdpt1)(cons '11 tdpt1)))
	(ssadd (entlast)ss)
	(setq rdpt1 (mapcar '+ rdpt1 (list 0 ht 0)))
	(setq tdpt1 (mapcar '+ tdpt1 (list wth 0 0))))
	)
	)
	(command "Mirror" ss "" mid midx "n")
;-----------------------------------------------------------------------------------------------
  	(vla-endundomark adoc)
	(setvar "osmode" osm)
  (princ)
  )
  
  &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2022 00:16:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/looking-for-help-with-drawing-diamond-patterns-with-lisp/m-p/11494301#M39631</guid>
      <dc:creator>annoisscary</dc:creator>
      <dc:date>2022-10-20T00:16:02Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for help with drawing diamond patterns with lisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/looking-for-help-with-drawing-diamond-patterns-with-lisp/m-p/11494944#M39632</link>
      <description>&lt;P&gt;Been in touch and possible final result, will let annoisscary post final code.&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="SeaHaven_0-1666230638409.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1129606i1E937CADFDD0C937/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SeaHaven_0-1666230638409.png" alt="SeaHaven_0-1666230638409.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2022 01:50:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/looking-for-help-with-drawing-diamond-patterns-with-lisp/m-p/11494944#M39632</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2022-10-20T01:50:43Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for help with drawing diamond patterns with lisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/looking-for-help-with-drawing-diamond-patterns-with-lisp/m-p/11495994#M39633</link>
      <description>&lt;P&gt;Alright! We got everything working as it should be, for kicks I tested up to 60x60 offset patterns and while it did take a second to run it drew it perfectly!&lt;/P&gt;&lt;P&gt;Thanks to&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6254908"&gt;@Sea-Haven&lt;/a&gt; the offsets are cleaned up nicely and no manual intervention is needed. Along with the addition of his code I added the option to pick an offset or just draw the pattern centerline style.&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;P.S.&lt;/P&gt;&lt;P&gt;Decided to focus on 1 pattern as this is the most likely case scenario.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2022 22:57:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/looking-for-help-with-drawing-diamond-patterns-with-lisp/m-p/11495994#M39633</guid>
      <dc:creator>annoisscary</dc:creator>
      <dc:date>2022-10-20T22:57:02Z</dc:date>
    </item>
  </channel>
</rss>

