I have always wanted a modifier like volSelect that selects polygons based on area. It would be important that it update the selection as the topology below it in the stack changes.
I’m doing something wrong with the function. This doesn’t do anything as written but if I create the function outside the plugin first, then the plugin at least prints the face selection… but I still haven’t gotten it to update the actual face selection.
plugin modifier pSelByArea
name:"SelByArea"
classID:#(0x45b71d21, 0x637cf590)
extends:Edit_Poly replaceUI:false version:2
(
fn setFaceSelByArea obj areaVal =
(
local theSelection = #{}
local num_faces = obj.getNumFaces()
for f = 1 to num_faces do
(
local face_Area = obj.GetFaceArea f
if face_Area >= areaVal do append theSelection f
)
print theSelection
return theSelection
)
parameters params_Area rollout:rol_SelByArea
(
spn_MinArea type:#float animateable:true ui:spn_MinArea default:10
on spn_MinArea set val do
(
face_Selection = setFaceSelByArea delegate val
delegate.SetSelection #Face face_selection
delegate.SetEPolySelLevel #Face
)
)
rollout rol_SelByArea "Select By Area"
(
spinner spn_MinArea "Min Area: " range:[0.01,1e9,20]
)
)