Empty guid when adding brep to the doc

Hi,

I got an empty guid when trying to add brep to the scene. The brep is just a box. The same code works for other brep I add to the scene generating correct not empty guid. what could be the problem here?

For some reason, the Brep is not valid (as you can see by the IsValid property in your screenshot)

Try the following to see why it is not valid:

String err;
if (!brep.IsValidWithLog(out err))
  RhinoApp.WriteLine("Brep not valid {0}", err);
else
  doc.Objects.Add(brep);

Brep not valid cv[0*cv_stride + 2] = -1.#IND is not valid.
ON_NurbsCurve.m_cv[] is not valid.
ON_Brep.m_C3[0] is invalid.

Doesn’t say much to me.

Found it. I have translated brep with NaN as one of the transformation values.
In short: var xFormTransformVectorVertical = Transform.Translation(new Vector3d(0, 0, NaN));

Yet another case when I can;t add the brep to the doc properly. But this time base goemetry seem to be valid. Can any one kindly advise?

I’m a bit worried about IsDocumentControlled=true. I think that means that the geometry comes from the document already.
You may want to try to make a copy, or call geometryBase.EnsurePrivateCopy(). I have to admit though that I’m not fully aware what IsDocumentControlled means and how that may affect your problem.