[Closed] separate polygons that are next to each other in groups !?
how to separate polygons that are next to each other in groups !?
let’s say i have a plane with 10 polygons… 1…4,6,7,9,10 faces are selected…
so i want to have for every faces pack that are next to each other a variable…
pack1 = #{1…4}
pack2 = #{6,7}
pack3 = #{9,10}
any idea on how to do that !? or at least how to see what polygons are next to each other !?
fn findIsolatedPolys obj:selection[1] faces: = if iskindof obj Editable_Poly do
(
fn firstBit arr = if arr.isEmpty then #{} else #{(arr as array)[1]}
if faces == unsupplied do faces = obj.selectedfaces as bitarray
local vertsUsingFace = polyop.getVertsUsingFace
local facesUsingVert = polyop.getFacesUsingVert
local iso = #(), f, ff, flist
f = firstBit faces
flist = faces
while not f.isEmpty do
(
ff = facesUsingVert obj (vertsUsingFace obj f)
ff *= faces
flist -= ff
f = if not (ff - f).isEmpty then ff else
(
append iso ff
firstBit (faces = flist)
)
)
iso
)
Look for function like getFacesByEdge, that will tell you what faces sharing given edge.
Can’t you get the outline edges of the selections and then in edge mode just split?
-Johan
i can do that but i don’t need that
see http://vimeo.com/15029844 at 0:09 i select 4 polygons… if i do loop it loops correctly just in one direction… before if i did that it looped in both direction… now i filter the selection… if there are more the two polygons next to each other they are put in one variable… origFaces-2Faced… the i filter the edges for those polygons… so i get a nice loop/ring… the problem is when i have 4faces next to each other and another 4next to each other… the filter works just for the first group of polygons … because i only do edge[1]… to filter… so if i filter every group of polygons i can get nice loop/ring
Sorry haven’t got time to write this out properly this morning, but like a good morning problem solve to get my day started.
Bit of psuedo code to help you along, the theory should work…
--set inital arrays
AR_packs = #()
--set pack one first...
pack = #()
append pack face1ID
append AR_packs pack
--loop through faces....
for i = 2 to faces.count do
(
--find my neighbour faces... (do this by getedgesbyface then getfacesbyedges excluding current face)
--loop through neighbour faces and try find them in each pack in AR_Packs
--once we find a neighbour face ID in one of the packs then add this id to the pack
--if we don't find the neighbour face IDs in any existing packs, make new pack and add me to it.
)
http://forums.cgsociety.org/showthread.php?f=98&t=917971
This will be helpful for you as well.