object data structure is malformed

Dear Blenders,

I am generating some objects using a script:


bpy.ops.mesh.primitive_cylinder_add(radius=1., depth=depth, location=Vcentr)

Then, I tweak some of the vertices:


for v in bpy.context.active_object.data.vertices:
    if (cond):
        v.co *= 0.1
bpy.context.active_object.data.update()
bpy.object.ops.transform_apply(location=True, rotation=True, scaling=True

Finally, I merge all objects together into one object.

This is where the trouble starts.


# create boolean modifiers
objs = bpy.context.scene.objects
base_obj = objs[0]
modnames = []
for obj in objs[1:]:
    modname = 'MyUnion' + str(obj)
    modnames.append(modname)
    mod = base_obj.modifiers.new(modname, 'BOOLEAN')
    mod.operation = 'UNION'
    mod.object = obj


for mod in modnames:
    bpy.ops.object.modifier_apply(apply_as='DATA', modifier=mod)
    remove_doubles(base_obj)

The behaviour is really strange. If the topology is complex, the modifier fails on some objects.


CSG failed, exception degenerate edge
Unknown internal error in boolean

If I move an object that is also in the union, even one that is not attached to any other, it will sometimes make the modifier work.

See:



Example .blend (Win64/Lin64 reproduced): https://mega.co.nz/#!OYITnLJa!Rc84QQt1FbV6DUv7GGQ1hUdwv0w-0Ob9INc1uB5hhFU

Is this a bug?

One thing I forgot to mention.

Exporting to WaveFront OBJ, importing it back and applying the modifiers goes down without a hitch. This is why I expect Blender’s internal data structure to be malformed, rather than it being an issue with the actual mesh.

Updates:

  • Added calc_edges=True, calc_tessface=True to bpy.context.active_object.data.update().

  • Linked objects to scene and called bpy.context.scene.update().

The problem persists.


CSG failed, exception degenerate edge
Unknown internal error in boolean
CSG failed, exception extern/carve/lib/triangulator.cpp:899 "didn't manage to link up hole!"