Brep is the geometry-only representation, GH_Brep is a wrapper object class that allows its use in Grasshopper. Every geometry class from Rhino has a wrapper class for Grasshopper. The Value property on the wrapper gives you the geometry-only object.
Normally, you should be able to get/set the geometry directly from/to the data input.
What problems do you run into?
I have an input in a compiled component that takes in either a Curve or Brep. Hence it uses: pManager.AddGenericParameter()
So is an object that needs its type checked. Since such an object can be either the Rhino version or the Grasshopper version, I have to check for four types and cast accordingly.
Upstream of this compiled component is a C# script component (not a compiled component, a script) that spits out a Brep (at least I thought it did), but once I looked through it in Visual Studio it showed up as a Grasshopper.Kernel.Types.GH_Brep, which was a bit surprising.
I ended up doing if statements with casts/checks as such in the compiled component:
if(sectionCurve is Grasshopper.Kernel.Types.GH_Curve || sectionCurve is Curve)
{
Curve _sectionCurve = null;
if (sectionCurve is Grasshopper.Kernel.Types.GH_Curve _sectionGH_Curve)
{
GH_Convert.ToCurve(_sectionGH_Curve, ref _sectionCurve, GH_Conversion.Both);
}
else
{
_sectionCurve = (Curve)sectionCurve;
}
// at this point, the _sectionCurve is Curve
}
if (sectionCurve is Grasshopper.Kernel.Types.GH_Brep || sectionCurve is Brep)
{
Brep _sectionBrep = null;
if (sectionCurve is Grasshopper.Kernel.Types.GH_Brep _sectionGH_Brep)
{
GH_Convert.ToBrep(_sectionGH_Brep, ref _sectionBrep, GH_Conversion.Both);
}
else
{
_sectionBrep = (Brep)sectionCurve;
}
// at this point, the _sectionBrep is Brep
}