Vertex Counting plugin?
-
Thanks for the responses. I'll have to try this out when I get home tonight.
-
@thomthom said:
@verts.flatten!.uniq!
Beware of the bang methods.
.flatten!
and.uniq!
- while faster and preferred, will returnnil
upon no change.
One has to use them on separate lines to avoid potential, and likely, errors.@verts.flatten! @verts.uniq!
But combined as
@verts.flatten.uniq!
so there's only an end 'bang!' it will work.
Without the!
it returns the changed array, with it it returns either the changed array ORnil
if there's no change !! -
I finally had a chance to try this out and it works (almost) perfectly!
Almost because for some reason it always returns 1 less vertex than is actually present. For example, a square plane shows 3, a cube shows 7, etc.
This is a complete non-issue, though, since I'm just trying to make sure the number is less than (I think) 25,000.Thanks again!
-
In my code you compile an array of arrays of vertices from faces... [vs]
The vs.flatten! explodes the arrays into one giant array.
The vs.uniq! ensures that there are no duplicates [two abutting faces share 2 vertices].
The vs.length returns the total number of vertices - it should not be 'short' -
I actually used the code offered by sdmitch (after having separated the command as thomthom suggested), and saved it as a plugin rather than having to cut+paste whenever I wanted to check.
-
Fredo has vertex marking tools and count sides tool maybe ask to report the vert numbers?
A small donation goes along way
-
@dsarchs said:
I actually used the code offered by sdmitch (after having separated the command as thomthom suggested), and saved it as a plugin rather than having to cut+paste whenever I wanted to check.
You are correct. The count was one less than it should be. Out of habit, because Ruby array index always starts at 0, subtracting 1 from the array length is so common that it is a reflex action. The correct message statement would be
UI.messagebox "This model contains\n\n#{@f_cnt} faces\n#{@e_cnt} edges\nand #{@verts.length} vertices"
-
Thanks, although I'm not really worried that it lists 1 less than actual. I just checked and the limit is 64,000 vertices -- so being off by 1 is irrelevant. I mostly wanted a tool to see how many object groups I could combine for single export.
If I think about it I'll change the code when I get home tonight -- but either way it's working for what I need it to do. -
@unknownuser said:
Fredo has vertex marking tools and count sides tool maybe ask to report the vert numbers?
The new version of CountFacesBySides, part of FredoTools, now provide the count of vertices in the selection or the whole model.
Fredo
-
Hey, I've just wanted to say thanks for all your answers here!
I'm working with CE3 too, and your code is really helpful to me.
Advertisement