Hi there,
Just ran into some odd behaviour with BinaryArchiveWriter/Reader and GeometryBase.GeometryEquals(...).
Namely, if I write Brep to the archive, read it, then use GeometryBase.GeometryEquals(...) to compare what I read with what I wrote, the two brep’s aren’t seen as equal. Here’s some NUnit source code that illustrates it–I’m using the Rhino.Testing framework:
[RhinoTestFixture]
public class SerializationTests
{
[Test]
public void ReadWriteBrep()
{
var writtenBrep = Brep.CreateFromSphere(new Sphere(Point3d.Origin, 1.0));
const string testFileName = $"{nameof(ReadWriteBrep)}.bin";
{
File.Delete(testFileName);
using var outputFile = new BinaryArchiveFile(testFileName, BinaryArchiveMode.Write);
outputFile.Open();
outputFile.Writer.WriteGeometry(writtenBrep);
outputFile.Close();
}
using var inputFile = new BinaryArchiveFile(testFileName, BinaryArchiveMode.Read);
inputFile.Open();
var readBrep = (Brep)inputFile.Reader.ReadGeometry();
inputFile.Close();
Assert.IsTrue(GeometryBase.GeometryEquals(readBrep, writtenBrep)); // This fails
}
}
Any help would be much appreciated!
Kind regards,
Dustin