I am getting the error ‘Reference to deleted group’ when I run the following code (this is just a simplified extract). In a nutshell: I need to calculate the area of several polygons; to do this I create a face within a group, use the Face.area method and then delete the group. As you can see the group never gets deleted, nevertheless after a few successful iterations I receive the error.
nusselt = mod.entities.add_group (1..nTilt).each do |i| (1..nAzimuth).each do |j| theta = Math::PI / 2.0 - (tiltMin + (i * 1.0 - 1.0) * dTilt) phi = azimuthMin + (j * 1.0 - 1.0) * dAzimuth pt1 = pt1(theta, phi) pt2 = pt2(theta, phi) pt3 = pt3(theta, phi) pt4 = pt4(theta, phi) projection = nusselt.entities.add_face(pt1,pt2,pt3,pt4) if (projection != nil) view_factor[i-1][j-1] = projection.area / Math::PI else view_factor[i-1][j-1] = 0.0 end end end
I have tried several cases and i can’t find a pattern: sometimes it happens at the first iteration, sometimes at an apparently random point in the loop.
Any help or suggestion?