how to group polygon by its primitive attribute

   10588   6   2
User Avatar
Member
479 posts
Joined: Dec. 2009
Offline
I have a geometry composed of several polygons, each of them has an attribute called “area” of which the value ranges from 0 to 1.

how can I group the polygons of which the “area” attribute is larger than 0.5?

I've tried according to Peter Quint's video tutorial by using “group geometry” node and the “Group by Expression” option. Howerver, the expression of “$AREA > 0.5” doesn't seem to work.

Thanks!
User Avatar
Member
519 posts
Joined:
Offline
Are you actually typing “$Area > 0.5” in the expression field?

It works here…

Attachments:
group_area_by_expression.hip (72.5 KB)

User Avatar
Member
479 posts
Joined: Dec. 2009
Offline
thanks, pagefan!

please see the example file as attached:
1. the bgeo file which contains the polygons with various primitive attributes
2. the hip file which import the bgeo file

I'm trying to use the “group geometry” node to group those polygons of which the “SkyEF” attribute is larger than 20, and somehow it didn't work.

Can you kindly help to take a look and tell me what's wrong?

Thanks!

Attachments:
group_by_expression_v01.hipnc (68.1 KB)
geometry.zip (65.2 KB)

User Avatar
Member
1908 posts
Joined: Nov. 2006
Offline
The problem is that your attribute doesn't have a local variable attached to it, so your expression fails. There's two ways you could fix it:

1. Create a local variable then use it in your expression

2. Use a primitive() expression instead.

Attached is a file with both methods.

Attachments:
group_by_expression_v01_177.hipnc (78.1 KB)

Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
519 posts
Joined:
Offline
Hi Oat,

there seems something wrong with the way your attributes were created. See the attached files for ways to fix or work around it…Let me know how you created the attributes and if you have any custom variable mappings.

Cheers,
Hans

/*edit: Graham beat me… edit*/

Attachments:
group_by_expression_v02.hipnc (81.7 KB)

User Avatar
Member
2624 posts
Joined: Aug. 2006
Offline
Hi ,
I have fixed your scene, please do MMB on a node to see my notes. With a bit of attribute management everything works as expected.

rob

EDIT :- everyone beat me

Attachments:
group_by_expression_v01_177_rsefix.hipnc (517.6 KB)

Gone fishing
User Avatar
Member
479 posts
Joined: Dec. 2009
Offline
Thank you so much, guys!

I've learn at least five ways to deal with the problem.

As Pagefan suggested, I've checked the original hip file where the attributes in the bgeo file are originall created and from which the bgeo file is saved out.

It seems that after the geometry and their attributes are saved out from the original hip file to bgeo file, the “Custom Variable Mappings” for the attributes will be lost and I guess that's the source of the problem posted here.

Thanks again!
  • Quick Links