Loaded Model Includes Geometry From Earlier Model

Due to the nature of my project, I’m converting from a CAD format to an egg string dynamically, and then loading that into a NodePath. Loading the first model string works fine, but the next model I load includes the geometry from the first. It seems like it could be a caching issue, but I can’t figure out where it’s coming from. I’ve exported the CAD models to STEP and they look as they should.

In the picture the blue plane on the bottom is the first thing I add. The white one above with the raised lettering is the second one I added. The white one is only supposed to have the lettering, but the plane from the first model is included as well. Here is a snippet of my code.

# Load the first, blue model
# I've written the tesselate and getEggString functions, but they're both static, and don't access any global variables
(vertices, indices, normals) = Builder.tessellate(eval('cq.Workplane("XY").box(10, 10, 0.01)').val(), 0.001, False)
model_egg = Builder.getEggString(vertices, indices, normals)

egg = EggData()
success = egg.read(StringStream(str.encode(model_egg)))

self.main_plane = NodePath(loadEggData(egg))
self.main_plane.reparentTo(render)
self.main_plane.setPos(0, 0, 0)
self.main_plane.setColor(0, 0, 1, 1)

# Load the second, white model
(vertices, indices, normals) = Builder.tessellate(eval('cq.Workplane("XY").text("XY", 6, 1.0)').val(), 0.001, False)
model_egg = Builder.getEggString(vertices, indices, normals)

egg = EggData()
success = egg.read(StringStream(str.encode(model_egg)))
self.plane_text = NodePath(loadEggData(egg))
self.plane_text.reparentTo(render)
self.plane_text.setPos(0, 0, 1)

I apologize for the noise. The problem seems to be somewhere in the tessellation or how I’m converting that to the egg string. I’ve isolated it to that code, but I just don’t know where yet.

You’re loading the .egg string, but then immediately overwriting it with a model loaded from disk, so the first line is effectively useless.

@rdb Thanks for the reply. In copying the code over and fixing the indentation for Discourse, I accidentally removed the hash from that commented line. It’s commented out in my local version.

There seems to be some geometry caching going on in the underlying CAD API. I’m still tracking it down.

I figured it out and it has nothing to do with Panda3D. Again, sorry for the noise.