<?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 Reinstating materials in Libraries &amp; objects</title>
    <link>https://community.graphisoft.com/t5/Libraries-objects/Reinstating-materials/m-p/15615#M37256</link>
    <description>&lt;DIV class="actalk-migrated-content"&gt;&lt;T&gt;I wonder if any of the GDL gurus out there can help me with this problem?&lt;BR /&gt;
&lt;BR /&gt;
In an object I am making I want the user to be able to set all the objects in an array to be either the same, or for the materials to alternate thus item 1 to be material 1, item 2 material 2; item3 material 1;item4 material2 and so on.&lt;BR /&gt;
&lt;BR /&gt;
I have tried the following:&lt;BR /&gt;
&lt;BR /&gt;
IF modpar='samemat' THEN&lt;BR /&gt;
	FOR P=1 TO num&lt;BR /&gt;
		IF samemat=1 THEN&lt;BR /&gt;
			holdmat&lt;P&gt;=mat2&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;
			mat2&lt;/P&gt;&lt;P&gt;=mat1&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;
		ELSE&lt;BR /&gt;
			mat2&lt;/P&gt;&lt;P&gt;=holdmat&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;
		ENDIF&lt;BR /&gt;
	NEXT P&lt;BR /&gt;
ENDIF&lt;BR /&gt;
&lt;BR /&gt;
In the above modpar is a variable derived from 'GLOB_MODPAR_NAME'. samemat is an on/off parameter where the user chooses whether all the objects are the same material or whether the components have alternating materials. There may be more that one array, but only two possible materials in each of the arrays. All the arrays are correctly declared and defined in the object&lt;BR /&gt;
&lt;BR /&gt;
The intent of the script steps above is as follows: if the material is to be the same throughout, make all the materials the same, and place the second material in a 'holding array'. If the materials are to differ then retrieve the stored data from hold mat and use it as the second material.&lt;BR /&gt;
&lt;BR /&gt;
I have tried this in the Master script, and in the Parameters script (with the addition of a PARAMETERS directive where necessary). The result from the Parameter script is not good, so I have been trying to make this work in the Master script. The result from the Master script is that the materials change in the UI that I have created, but the materials in the object itself do not update. In fact the model seems to think that all elements in the mat2&lt;/P&gt;&lt;P&gt; array are the 'General' material.&lt;BR /&gt;
&lt;BR /&gt;
It works in one direction: i.e when materials differ and are changed to become the same, the process works, but when changing from one material to two, the process doesn't work.&lt;BR /&gt;
&lt;BR /&gt;
I can only deduce that the Master script is telling the UI that the materials have been updated, but the 3D script is ignorant of this change.&lt;BR /&gt;
&lt;BR /&gt;
Mike&lt;/P&gt;&lt;/T&gt;&lt;/DIV&gt;</description>
    <pubDate>Fri, 15 Jul 2005 09:11:14 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2005-07-15T09:11:14Z</dc:date>
    <item>
      <title>Reinstating materials</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Reinstating-materials/m-p/15615#M37256</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;&lt;T&gt;I wonder if any of the GDL gurus out there can help me with this problem?&lt;BR /&gt;
&lt;BR /&gt;
In an object I am making I want the user to be able to set all the objects in an array to be either the same, or for the materials to alternate thus item 1 to be material 1, item 2 material 2; item3 material 1;item4 material2 and so on.&lt;BR /&gt;
&lt;BR /&gt;
I have tried the following:&lt;BR /&gt;
&lt;BR /&gt;
IF modpar='samemat' THEN&lt;BR /&gt;
	FOR P=1 TO num&lt;BR /&gt;
		IF samemat=1 THEN&lt;BR /&gt;
			holdmat&lt;P&gt;=mat2&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;
			mat2&lt;/P&gt;&lt;P&gt;=mat1&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;
		ELSE&lt;BR /&gt;
			mat2&lt;/P&gt;&lt;P&gt;=holdmat&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;
		ENDIF&lt;BR /&gt;
	NEXT P&lt;BR /&gt;
ENDIF&lt;BR /&gt;
&lt;BR /&gt;
In the above modpar is a variable derived from 'GLOB_MODPAR_NAME'. samemat is an on/off parameter where the user chooses whether all the objects are the same material or whether the components have alternating materials. There may be more that one array, but only two possible materials in each of the arrays. All the arrays are correctly declared and defined in the object&lt;BR /&gt;
&lt;BR /&gt;
The intent of the script steps above is as follows: if the material is to be the same throughout, make all the materials the same, and place the second material in a 'holding array'. If the materials are to differ then retrieve the stored data from hold mat and use it as the second material.&lt;BR /&gt;
&lt;BR /&gt;
I have tried this in the Master script, and in the Parameters script (with the addition of a PARAMETERS directive where necessary). The result from the Parameter script is not good, so I have been trying to make this work in the Master script. The result from the Master script is that the materials change in the UI that I have created, but the materials in the object itself do not update. In fact the model seems to think that all elements in the mat2&lt;/P&gt;&lt;P&gt; array are the 'General' material.&lt;BR /&gt;
&lt;BR /&gt;
It works in one direction: i.e when materials differ and are changed to become the same, the process works, but when changing from one material to two, the process doesn't work.&lt;BR /&gt;
&lt;BR /&gt;
I can only deduce that the Master script is telling the UI that the materials have been updated, but the 3D script is ignorant of this change.&lt;BR /&gt;
&lt;BR /&gt;
Mike&lt;/P&gt;&lt;/T&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 15 Jul 2005 09:11:14 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Reinstating-materials/m-p/15615#M37256</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-07-15T09:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: Reinstating materials</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Reinstating-materials/m-p/15616#M37257</link>
      <description>I don't understand, why you use an array to store the materials.&lt;BR /&gt;
&lt;BR /&gt;
You want to make the matrial of the objects individual or equal. Choosable by one switch, right?&lt;BR /&gt;

&lt;PRE&gt;! ### 3D-Script:
FOR P=1 TO num

IF samemat=1 THEN
  SET MATERIAL mat1&lt;P&gt;
  ! or simply
  !    SET MATERIAL mat1
  ! if there's only one material for all
  ELSE
  SET MATERIAL mat2&lt;/P&gt;&lt;P&gt;
  ENDIF

! here come the objects defining statements, CALLs etc.

NEXT P
&lt;/P&gt;&lt;/PRE&gt;

If you don't want to see the individual materials in the UI or parameter list you can hide them by the same IF ... THEN construction and additional LOCK and HIDEPARAMETER.</description>
      <pubDate>Fri, 15 Jul 2005 10:08:30 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Reinstating-materials/m-p/15616#M37257</guid>
      <dc:creator>Frank Beister</dc:creator>
      <dc:date>2005-07-15T10:08:30Z</dc:date>
    </item>
    <item>
      <title>Re: Reinstating materials</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Reinstating-materials/m-p/15617#M37258</link>
      <description>F Beister solved it for me. When I thought about it the answer was just too obvious - I feel as if I am really dumb!! Many thanks for the input - I might have got there eventually but I was not thinking about how to solve the problem in the right way!!</description>
      <pubDate>Fri, 15 Jul 2005 17:06:26 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Reinstating-materials/m-p/15617#M37258</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-07-15T17:06:26Z</dc:date>
    </item>
  </channel>
</rss>

