Reference Brep in C++ Learning


Learning… Simple question.

How can I reference Brep in Rhino C++?

If I do it like this it references only a one brep face

	CRhinoGetObject g;
	g.SetCommandPrompt(L"Select Brep");
	g.GetObjects(1, 1);

	if (g.CommandResult() != CRhinoCommand::success)
		return g.CommandResult();

	const ON_Brep* brep = g.Object(0).Brep();

	if (brep == 0)
		return CRhinoCommand::failure;

You probably need to use another object type, not CRhinoGetObject::surface_object, but something with either polysurface or brep in the name (can’t remember exactly). And you probably don’t want EnableSubObjectSelect().

Thanks it was polysrf_object

Do know if there is a quicker way to convert integer to ON_wString than this?
I just want to print some stuff and pass some integers.

int count = brep->m_F.Count();
auto str = std::to_string(count);
char const* strChar = str.c_str();
ON_wString strRhino (strChar);


There is the Rhino way:

int val = 24;
ON_wString str;
str.Format(L"%d", val);
// TODO...

– Dale

Thank you:)