Skip to content

Bug: RuntimeError: unidentifiable C++ exception #6

@dbc

Description

@dbc

Simple test case iteratively subtracting a cylinder from a block fails with "unidentifiable C++ exception"

import pyPolyCSG as csg

#probe = 0.9 # works
#probe = 1.0 # works
probe = 1.1 # fails
#probe = 2.0 # fails

block = csg.box(6,2,4,True)
cyl = csg.cylinder(1,4,True)
cyl = cyl.translate(0,probe,0)

offset = 4
i = 0 # keep track of which iteration failed
while offset > -0.4:
    print i
    i += 1
    tool = cyl.translate(offset,0,0)
    block -= tool
    offset -= 0.5

traceback:

>>> ================================ RESTART ================================
>>> 
0
1
2
3
4

Traceback (most recent call last):
  File "****/bug01.py", line 18, in <module>
    block -= tool
RuntimeError: unidentifiable C++ exception

and in the terminal window running idle:

FACE LOOP ERROR: 0x2918e88-0x2919540 : 2
FACE LOOP ERROR: 0x2918fa0-0x2919338 : 2
FACE LOOP ERROR: 0x2918f00-0x2919108 : 2
FACE LOOP ERROR: 0x29193d8-0x2919568 : 2
FACE LOOP ERROR: 0x2918e60-0x29193b0 : -2
FACE LOOP ERROR: 0x2919108-0x29193b0 : 2
FACE LOOP ERROR: 0x2919518-0x2924a58 : -2
FACE LOOP ERROR: 0x29193d8-0x2919518 : -2
FACE LOOP ERROR: 0x29190e0-0x2924a58 : 2
FACE LOOP ERROR: 0x2918ed8-0x2919568 : -2
FACE LOOP ERROR: 0x2918f78-0x2924a30 : 2
FACE LOOP ERROR: 0x2918e60-0x29190e0 : 2
FACE LOOP ERROR: 0x2918f78-0x2919540 : -2
FACE LOOP ERROR: 0x2918f00-0x29194a0 : -2
FACE LOOP ERROR: 0x29191a8-0x29194a0 : 2
FACE LOOP ERROR: 0x2918ed8-0x2918fa0 : 2
FACE LOOP ERROR: 0x29191a8-0x2924a30 : -2
FACE LOOP ERROR: 0x2918e88-0x2919338 : -2

The "FACE LOOP" message seems to come from:
carve/lib/intersect.cpp

There are 3 open bugs on Carve's issue tracker metioning 'FACE LOOP ERROR', and some Blender issues mentioning 'FACE LOOP ERROR'. These might be coming from an intersect operation leaving behind a degenerate mesh, causing problems for the next intersection operation. Or maybe not. I see Carve defines a Polyhedron::canonicalize() method which you are not yet exporting. I'm speculating that canonicalize() might be worth experimenting with.


Additional info: I speculate that this may be related to the cylinder having a flat bottom -- if I replace the cylinder with a sphere and try the same simulation, I can try many different sizes of sphere and step sizes and it all works fine.


Annnnnnd.... another update.
Changing cylinder creation to:

cyl = csg.cylinder(1,4,True)
cyl = cyl.rotate(0,0,0.1)
cyl = cyl.translate(0,probe,0)

will make the tests pass. So rotation in Z works around what ever bug is showing up here. That kind of blows the flat-bottom theory out of the water.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions