Jump to content

Adding value from existing attribute


Recommended Posts

Hello!

I am working on a project that consist of different layers of primitives. Layer_1, Layer_2, etc. 
What I have done is to create a attribute called “Level”. I then base the value of the Level attribute from its Layer_# name. Example: Layer_1 will have a Level attribute with a value of 1. Layer_2 will have a Level attribute with a value of 2.

The problem I have is that with the file there comes other named primitives aswell. 
In this case all I want to do is to have the “Twigs” attribute to always have the highest value. Even if I were to have 100 layers.
So in this case I want the Twigs to have a value of 4. How would I do these procedurally?

Thanks!


Here is what it looks like:

97691b668e0f0134c45022f2fd684cbf.png

Link to comment
Share on other sites

Attribute Promote your "level" attribute to a Detail attribute in Maximum mode (without removing the original attribute), so you know what your highest extant level is, then you can just increment on top of that for your twigs... for example:

if(s@name == "Twigs") {
    i@level = detail(0, "maxlevel")+1;

}

 

Edited by toadstorm
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...