Jump to content
hampuseh

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×