Jump to content
anicg

use @area inside divide sop

Recommended Posts

I attach the hip file where I have a simple grid but I need to divide using the area (e.g. area/12), I get an error "Local variable 'area' not found. " although I'm using a measure sop that creates an area attribute.

Any idea?

area_divide.hiplc

Share this post


Link to post
Share on other sites

Very few of the nodes, allow you to reference vex attributes inside the parameter fields. The @ prefix is a vex construct, but the parameter fields for each node executes hScript. You can still reference an attribute using an hScript function, like this.

prim("../measure1",0,"area",0)/12

The function reaches into the measure1 sop and grabs the value of @area for primitive #0.

You may see the immediate problem with this approach. What if you have multiple primitives with different areas? How do you know which primitive to chose the value from?

Edited by Atom
  • Like 1

Share this post


Link to post
Share on other sites
You may see the immediate problem with this approach. What if you have multiple primitives with different areas? How do you know which primitive to chose the value from?

Exactly!
And in some situations it's a good idea to promote the area attribute to detail, using the Sum of all primitives area

I can see you have only one poligon so you shouldn't worry about and just the 0 one

I added the 2 exemplos to your file:

area_divide.hiplc

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

×