Separating a multi-parts mesh ?

   24567   12   2
User Avatar
Member
375 posts
Joined: 5月 2014
Offline
hello,
I'm working on a STL import that was exported from Solidworks, and was in several parts. In Houdini the STL is all merged into one object.
I don't want to select all these faces one by one.
What's the official way to separate a mesh into parts in Houdini?
I have tried the Polydoctor node. What's cool is that it automatically shows the different parts that the object is made of: see attached pic.
Is Polydoctor the way to go?
With Polydoctor, I tried to extract the attribute “manifoldnumber” inside a “for each” but I don't know what to do next.
Thanks for the help…

Attachments:
Separating_Mesh.png (430.7 KB)

Houdini gamboler
User Avatar
Member
2523 posts
Joined: 6月 2008
Offline
You can create groups by detecting the constant colors, then use the delete node to isolate only that part of the geometry.

Attachments:
ap_groups_via_color.hiplc (91.2 KB)
Untitled-1.jpg (246.4 KB)

Using Houdini Indie 20.0
Ubuntu 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
375 posts
Joined: 5月 2014
Offline
Hello Enivob

First thanks for taking the time to help and to post a file. I tried your scene and here's what I can say:
The VEX code in the attribute wrangle would force us to select each colors by typing their values. The problem is: there are 46 parts in this imported mesh, so the code would be too long to type.
There should be an automatic way to select parts, and here's why the polydoctor's manifoldnumber attribute could be used. The manifold attribute goes from 0 to 45.
I think we should do something like this:
For each manifoldnumber, create a new mesh.
But is it possible to generate 46 new meshes from a single node? Which node would it be?

And again : Is Polydoctor the best way to go for separating merged meshes in Houdini?

Thanks
Gz
Houdini gamboler
User Avatar
Member
670 posts
Joined: 9月 2013
Offline
The partition SOP creates groups for example based on colours.
http://www.sidefx.com/docs/houdini/nodes/sop/partition.html [www.sidefx.com]
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
375 posts
Joined: 5月 2014
Offline
Thanks. However I'm still a beginner so I don't know how to use this node…
Houdini gamboler
User Avatar
Member
333 posts
Joined: 10月 2012
Offline
You just need to place the sop and connect it. There is a preset in the partition sop. Just click the small down arrow next to rule.
group by color should give you:

color_`rint(@Cd.r*255)`_`rint(@Cd.g*255)`_`rint(@Cd.b*255)`
Edited by Doudini - 2018年7月27日 11:01:06
User Avatar
Member
7726 posts
Joined: 9月 2011
Offline
No, what you want is the connectivity node, which creates an attribute to index each island. The partition can then create groups based on the connectivity attribute. Typically groups are not required to consider the mesh as ‘separate’ once you have some kind of identifier for each part. If you want them packed into individual packed fragments/geometries, the assemble sop can be used name/pack by connectivity.
User Avatar
Member
375 posts
Joined: 5月 2014
Offline
Hello all, and first thanks for your help.
I've been testing again , following your precious advices. I managed to get it working, by keeping the Polydoctor node involved.

So here are the 3 things I tried :
1: From the polydoctor node I output the manifoldnumber attribute. Then in partition I add this rule : manifoldnumber_$manifoldnumber . Then in the assemble node I create groups based on manifoldnumber_. So with the delete node I can see my groups.

2: Putting a partition node just at the output of the STL , with the rule color_`rint(@Cd.r*255)`_`rint(@Cd.g*255)`_`rint(@Cd.b*255)` , does not work: it just creates a group called “color_255_255_255”

3: I also tried a connectivity node. I created a “island” attribute, but this attribute is not recognized in a visualizer node, I can't get it to show different colors for the different parts.

If you have some patience You can check the attached pic that sums it all up!

Attachments:
Separating a multi-parts mesh 02.jpg (575.7 KB)

Houdini gamboler
User Avatar
Member
8506 posts
Joined: 7月 2007
Offline
manifold number and connectivity class attribute serve the same purpose, you can use either, even though they may produce different order

you can easily extract polys by attribute value and avoid partition and creating groups, just by using Blast SOP and @<attribname>=<value> in the group field, like
@manifoldnumber=0

you can even make it depend on the digits in the node's name using expression like
@manifoldnumber=`opdigits(".")`

Attachments:
extract_by_connectivity.hip (228.8 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
2034 posts
Joined: 9月 2015
Offline
Thanks Tomas for posting hip file showing applied ‘elements’ I haven't seen before; Very good keeper for reference.
User Avatar
Member
375 posts
Joined: 5月 2014
Offline
Hi!
Tamte thanks a lot for your explanation and for taking the time to post a scene file!! This forum is very helpfull.
I think I have now the best way to separate multi-parts meshes!

Re-reading the thread , I have some more questions:
- I understand what “packing” does but i'm not yet use to when using it, in which case should I pack parts of my networks?
- About the “@” prefix for attribute. It is not used when the attribute is created, it is used when the attribute is called. Correct?

Bye,
Gz
Houdini gamboler
User Avatar
Member
8506 posts
Joined: 7月 2007
Offline
Grendizer
- I understand what “packing” does but i'm not yet use to when using it, in which case should I pack parts of my networks?

it's a broader concept, but some advantages are
- you can duplicate packed geo and all the copies will point to the same underlying geo in memory, so it will instane automatically
- when you pack geo all the attributes are packed inside the primitive so not only you can access it as a single primitive, but you can merge it with other packed primitives that have other attributes packed inside without forcing all of them to have the same attribs which would happen if you merged nonpacked geos
- packed prims have their transform, so you can take advantage of that


Grendizer
- About the “@” prefix for attribute. It is not used when the attribute is created, it is used when the attribute is called. Correct?
depends
- in Nodes based on Snippet VOP (like Wrangles or Attrib/Group Expression, POP VEXpressions, …) you can use @<attribname> to create/modify/read attributes
and for further specificity use type description, f@, v@, s@, …
- in group fields you use @<attribname> to read the value per element, f@, v@, s@, … don't apply here, just @
- in some parameters of older non-compilable nodes which take local variables you can use @<attribname> to read atttrib value per element
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
375 posts
Joined: 5月 2014
Offline
Thanks again Tamte!

Houdini gamboler
  • Quick Links