<?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: Simple routine to create an array of elements with subsequent RGB color valu in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-routine-to-create-an-array-of-elements-with-subsequent/m-p/9102240#M82656</link>
    <description>&lt;PRE&gt;(command "chprop" (entlast) "" "c" "TrueColor" col "")&lt;/PRE&gt;&lt;P&gt;But col must be R,G,B&amp;nbsp; "0,0,count" (strcat "0,0," (rtos count 2 0))&lt;/P&gt;</description>
    <pubDate>Wed, 23 Oct 2019 00:36:03 GMT</pubDate>
    <dc:creator>Sea-Haven</dc:creator>
    <dc:date>2019-10-23T00:36:03Z</dc:date>
    <item>
      <title>Simple routine to create an array of elements with subsequent RGB color values.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-routine-to-create-an-array-of-elements-with-subsequent/m-p/9102051#M82655</link>
      <description>&lt;P&gt;Hey VLisp Folks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm glad to write my first post in this forum.&lt;/P&gt;&lt;P&gt;I started to learn VLisp about 2 weeks ago to execute (as I thought) a simple routine.&lt;/P&gt;&lt;P&gt;I want to create an array of squares filled with hatching that have subsequent RGB color values.&lt;/P&gt;&lt;P&gt;So first square is filled with (R:0 G:0 B:0), second&amp;nbsp;(R:0 G:0 B:1), third (R:0 G:0 B:2) ... last (R:0 G:0 B:255).&lt;/P&gt;&lt;P&gt;I want to start with this simple task in order to create a larger color gradient.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The reason for that task is that we are always having a trouble to print correct colors on our company plotter.&lt;/P&gt;&lt;P&gt;I want to create a sample plot for everyone in my office to match screen colors with plotter colors easier.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So far I wrote the piece of code below, but the last line of code (setting color property to the last created object) is not working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please, let me know where are my bugs. Also, I'd be glad to get some reasonable advices as for a beginner into VLisp.&lt;/P&gt;&lt;P&gt;I'm not looking for an advanced solution, that I'll perhaps do not understand. I just want someone to guide me a little bit. Thanks for understanding!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(defun c:RGB_Array ()
		(setq repetition (getint "\nNumber of repetitions: "))
		(setq count 0)
		(setq basepoint (list 0 0))
		(setq dist 100)
		(while 	(&amp;lt; count repetition)
			(setq count (1+ count))
			(setq basepoint (list dist 0))
			(setq curcol count)
			(setq current_object (entlast))
			(command "copy" current_object "" "" basepoint (list dist 0))
			(setpropertyvalue current_object "color" 0 0 curcol)
		)	
)&lt;/PRE&gt;&lt;P&gt;So this piece of code is creating an array but does not change the color of the object.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Krzysztof&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2019 21:03:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-routine-to-create-an-array-of-elements-with-subsequent/m-p/9102051#M82655</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-10-22T21:03:11Z</dc:date>
    </item>
    <item>
      <title>Re: Simple routine to create an array of elements with subsequent RGB color valu</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-routine-to-create-an-array-of-elements-with-subsequent/m-p/9102240#M82656</link>
      <description>&lt;PRE&gt;(command "chprop" (entlast) "" "c" "TrueColor" col "")&lt;/PRE&gt;&lt;P&gt;But col must be R,G,B&amp;nbsp; "0,0,count" (strcat "0,0," (rtos count 2 0))&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 00:36:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-routine-to-create-an-array-of-elements-with-subsequent/m-p/9102240#M82656</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2019-10-23T00:36:03Z</dc:date>
    </item>
    <item>
      <title>Re: Simple routine to create an array of elements with subsequent RGB color valu</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-routine-to-create-an-array-of-elements-with-subsequent/m-p/9111345#M82657</link>
      <description>&lt;P&gt;Thank you for great hint!&lt;BR /&gt;The last row of code would look like this then:&lt;/P&gt;&lt;PRE&gt;(command "chprop" (entlast) "" "c" "TrueColor" (strcat "0,0," (rtos count 2 0)) "")&lt;/PRE&gt;&lt;P&gt;It works exactly as I wanted. Now I need perhaps to create a nested loop to make 2-dimensional array...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Oct 2019 21:37:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-routine-to-create-an-array-of-elements-with-subsequent/m-p/9111345#M82657</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-10-27T21:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: Simple routine to create an array of elements with subsequent RGB color valu</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-routine-to-create-an-array-of-elements-with-subsequent/m-p/9111415#M82658</link>
      <description>&lt;P&gt;RGB has approx. 256*256*256 combinations not sure how many squares you plan, have seen color cards ? Its like 50mm thick of colours you need to work out what you want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thinking about it now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Colorwh,dwg has two sets 2nd is rgb. will try to find does not appear in 2020.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Found, zoom in click on small squares this is what you want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Oct 2019 23:25:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-routine-to-create-an-array-of-elements-with-subsequent/m-p/9111415#M82658</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2019-10-27T23:25:39Z</dc:date>
    </item>
    <item>
      <title>Re: Simple routine to create an array of elements with subsequent RGB color valu</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-routine-to-create-an-array-of-elements-with-subsequent/m-p/9134232#M82659</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6254908"&gt;@Sea-Haven&lt;/a&gt;&amp;nbsp;Thank you for the color wheels.&lt;/P&gt;&lt;P&gt;For sure those are useful. Unfortunately they do not cover the brightest tones of whites.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I imagine 256x256x256 it's over 16 Mio. colors...&lt;/P&gt;&lt;P&gt;Though, I had in mind to create some sort of an array out of 32 array grids from 32x32 colors (32,768 combinations).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another thing, I started to learn programming since one year and I find myself in situations where someone else already solved the problems that I wanted to approach. It's no fun to use shortcuts &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 21:51:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-routine-to-create-an-array-of-elements-with-subsequent/m-p/9134232#M82659</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-11-07T21:51:57Z</dc:date>
    </item>
    <item>
      <title>Re: Simple routine to create an array of elements with subsequent RGB color valu</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-routine-to-create-an-array-of-elements-with-subsequent/m-p/9136401#M82660</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;.... The last row of code would look like this then:&lt;/P&gt;
&lt;PRE&gt;... (rtos count 2 0)....&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The 'count' variable is an &lt;EM&gt;integer&lt;/EM&gt;, so there's no need for mode and precision arguments if you use the more appropriate function.&amp;nbsp; That (rtos) function can be replaced with:&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;&lt;STRONG&gt;(itoa count)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2019 20:19:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-routine-to-create-an-array-of-elements-with-subsequent/m-p/9136401#M82660</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2019-11-08T20:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: Simple routine to create an array of elements with subsequent RGB color valu</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-routine-to-create-an-array-of-elements-with-subsequent/m-p/9136462#M82661</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous&amp;nbsp;wrote:&lt;BR /&gt;....&amp;nbsp;&lt;SPAN&gt;Please, let me know where are my bugs. ....&lt;/SPAN&gt;&lt;BR /&gt;
&lt;PRE&gt;&lt;FONT face="Artifakt, Tahoma, Helvetica, Arial, sans-serif" color="#666666"&gt;&lt;SPAN style="font-size: 16px; white-space: normal; background-color: #ffffff;"&gt;....&lt;/SPAN&gt;&lt;/FONT&gt;
			(command "copy" current_object "" "" basepoint &lt;FONT color="#FF0000"&gt;(list dist 0)&lt;/FONT&gt;)
....&lt;/PRE&gt;
&lt;P&gt;So this piece of code is creating an array ....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Apart from the color-assignment correction, are there any error messages as it's creating the array?&amp;nbsp; It seems to me the &lt;FONT color="#FF0000"&gt;red&lt;/FONT&gt; part there is after the command is completed, so I would expect an unknown command message.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Further comment:&amp;nbsp; You have some things going on that you don't need.&amp;nbsp; Any variable that's set to a fixed value and never changed may as well just have that fixed value used instead of the variable [i.e. &lt;FONT color="#0000FF"&gt;dist&lt;/FONT&gt;].&amp;nbsp; And you don't need the &lt;FONT color="#0000FF"&gt;basepoint&lt;/FONT&gt;, &lt;FONT color="#0000FF"&gt;curcol&lt;/FONT&gt; or &lt;FONT color="#0000FF"&gt;current_object&lt;/FONT&gt; variables, if you structure it something like this [minimally tested]:&lt;/P&gt;
&lt;PRE&gt;(defun c:RGB_Array (/ repetition count)
  (setq
    repetition (getint "\nNumber of repetitions: ")
    count 0
  ); setq
  (while (&amp;lt; count repetition)
    (setq count (1+ count))
    (command "_.copy" "_last" "" "" "_none" "100,0")
    (setpropertyvalue (entlast) "color" (strcat "0,0," (itoa count)))
  ); while
); defun&lt;/PRE&gt;
&lt;P&gt;[You &lt;EM&gt;can&lt;/EM&gt;&amp;nbsp; use your &lt;FONT color="#000000"&gt;(setpropertyvalue)&lt;/FONT&gt; approach instead of switching to CHPROP, if you have reason to prefer it, such as that it's a little shorter.&amp;nbsp; It should also be faster, if the quantities involved are large enough that you would notice the difference.]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2019 21:08:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-routine-to-create-an-array-of-elements-with-subsequent/m-p/9136462#M82661</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2019-11-08T21:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: Simple routine to create an array of elements with subsequent RGB color valu</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-routine-to-create-an-array-of-elements-with-subsequent/m-p/9142527#M82662</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Thank you for your tip!&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2019 21:48:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-routine-to-create-an-array-of-elements-with-subsequent/m-p/9142527#M82662</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-11-12T21:48:58Z</dc:date>
    </item>
    <item>
      <title>Re: Simple routine to create an array of elements with subsequent RGB color valu</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-routine-to-create-an-array-of-elements-with-subsequent/m-p/9147715#M82663</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help under my posts.&lt;/P&gt;&lt;P&gt;I learned basic Autolisp within a month and already found a solution to my RGB Array matrices.&lt;/P&gt;&lt;P&gt;The code is still a mess but 4096 colorul rectangles are real &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;See the outcome as an attachement&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;THANK YOU!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2019 21:50:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-routine-to-create-an-array-of-elements-with-subsequent/m-p/9147715#M82663</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-11-14T21:50:35Z</dc:date>
    </item>
    <item>
      <title>Re: Simple routine to create an array of elements with subsequent RGB color valu</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-routine-to-create-an-array-of-elements-with-subsequent/m-p/9157895#M82664</link>
      <description>&lt;P&gt;[For a more concise solution, see &lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/4096-hatch-entities-with-subsequent-rgb-values/m-p/9157822/highlight/true#M392675" target="_blank" rel="noopener"&gt;&amp;gt;this&amp;lt;&lt;/A&gt;&amp;nbsp;on the other thread.]&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 18:03:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-routine-to-create-an-array-of-elements-with-subsequent/m-p/9157895#M82664</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2019-11-20T18:03:22Z</dc:date>
    </item>
  </channel>
</rss>

