hallo!
i tried to save the current material of an entity object in an attribute to be able to assign the material to the entity later in the skript with the following code which isn't working so far:
<span class="syntaxdefault"></span><span class="syntaxcomment">#to savi it in an attribute<br /></span><span class="syntaxdefault">mod </span><span class="syntaxkeyword">= </span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model<br />ents </span><span class="syntaxkeyword">= </span><span class="syntaxdefault">mod</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">entities <br />mats </span><span class="syntaxkeyword">= </span><span class="syntaxdefault">mod</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">materials<br /><br />ents</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">each</span><span class="syntaxkeyword">{|</span><span class="syntaxdefault">e</span><span class="syntaxkeyword">|<br /> if </span><span class="syntaxdefault">e</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">typename </span><span class="syntaxkeyword">== </span><span class="syntaxstring">"Face"<br /> </span><span class="syntaxkeyword">if (</span><span class="syntaxdefault">e</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">material</span><span class="syntaxkeyword">) </span><span class="syntaxcomment">#checks wheter a material is assigned to the face<br /> </span><span class="syntaxdefault">mat_prev </span><span class="syntaxkeyword">= </span><span class="syntaxdefault">e</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">material</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">name<br /> e</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">set_attribute </span><span class="syntaxstring">"time"</span><span class="syntaxkeyword">, </span><span class="syntaxstring">"material"</span><span class="syntaxkeyword">, </span><span class="syntaxdefault">mat_prev<br /> end<br /> end<br /> </span><span class="syntaxkeyword">}<br /><br /></span><span class="syntaxcomment">#to reassign it later<br /><br /></span><span class="syntaxdefault">mod </span><span class="syntaxkeyword">= </span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model<br />ents </span><span class="syntaxkeyword">= </span><span class="syntaxdefault">mod</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">entities <br />mats </span><span class="syntaxkeyword">= </span><span class="syntaxdefault">mod</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">materials<br />ents</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">each</span><span class="syntaxkeyword">{|</span><span class="syntaxdefault">e</span><span class="syntaxkeyword">|<br /> if </span><span class="syntaxdefault">e</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">typename </span><span class="syntaxkeyword">== </span><span class="syntaxstring">"Face" <br /> </span><span class="syntaxdefault">mat_temp</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">e</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">get_attribute </span><span class="syntaxstring">"time"</span><span class="syntaxkeyword">, </span><span class="syntaxstring">"material"<br /> </span><span class="syntaxdefault">e</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">material</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">mats</span><span class="syntaxkeyword">[</span><span class="syntaxdefault">mat_temp</span><span class="syntaxkeyword">] </span><span class="syntaxcomment">#before that should be checked wether the attribute isn't nil<br /> </span><span class="syntaxdefault">end<br /> </span><span class="syntaxkeyword">} </span><span class="syntaxdefault"></span>
thanks for your time.
tim