Page MenuHome

Bug on vertex group creation after using bisect_plane
Closed, ArchivedPublic

Description

System Information
Operating system: Windows 10
Graphics card: GTX1060

Blender Version
Blender 2.79

Short description of error
Wrong vertices are added to a vertex group.

Exact steps for others to reproduce the error
I am writing a script to create contour lines on an object. Each line is created, its vertices will be added into a new vertex group.
I use bmesh.ops.bisect_plane to create contour lines. I get mutilple sets of vertices from geom_cut.
I create the new vertex groups for each set of vertices.
However, the newer vertex groups somehow contain the vertices from previous vertex groups.
After a long time of testing, I believe the problem is on BMesh.
The attachment is the file showing my trials. The instruction is in the scripts.

Details

Type
Bug

Event Timeline

Philipp Oeser (lichtwerk) closed this task as Archived.
Philipp Oeser (lichtwerk) claimed this task.

The thing is that newly created geometry weights will always be interpolated from adjacent geometryand will end up in neighboring vertex groups.

This is not special to bisect_plane or usage from python.
You can also see this by just creating an edgeloop using the Loopcut Tool next to a loop that is already in a vertex group. The new loop will also be put in neighboring vertex group(s) [can be multiple] and weights will be interpolated.
(it is not always consistent, but basically, this it how it works...)

In your file you are mentioning you are getting good results when bisecting, remembering the created new vertex indices and creating the vertex groups after all cuts have been made.
This works for the same reason: you are not creating new gemoetry next to gemoetry that already has weights.

You seem to be using vertex groups like selection sets [meaning one vertex should only be in a single group only].
Suggest to either store indices in a list [aka your own implementation of this] or if you want to keep using vertex groups, then make sure to remove newly created vertices from all other existing groups after creation.

I will close this [unless @Campbell Barton (campbellbarton) or @Brecht Van Lommel (brecht) have objections?] as not being a bug...
@wenye he (rampagedog12) : feel free to comment again if issues persist...