Create preview images of geometry

Hi

i want to create preview images of geometry which is not yet in the document.
For this i tried to use the code below but i do not see the brep i have drawn with DrawShadedBrep, only those who are in the document.
So is there a way do make preview images like this, but for geometry which was not yet added to the document?

			CRhinoView* view = RhinoApp().ActiveView();
			CRhinoDisplayPipeline* dp = view->ActiveViewport().DisplayPipeline();
			const CDisplayPipelineAttributes* pDA = CRhinoDisplayAttrsMgr::StdShadedAttrs();

			CRhinoDib dib;
			dib.CreateDib(200, 200, 24, true);

			CDisplayPipelineAttributes da(*pDA);
			da.m_bUseDocumentGrid = false;
			da.m_bDrawGrid = true;
			da.m_bDrawAxes = true;
			da.m_bDrawWorldAxes = true;
			da.m_bCastShadows = false;
			da.m_pIteratorOverride = NULL;

			dp->DrawShadedBrep(*brep);
			bool res = dp->DrawToDib(dib, 200, 200, &da);

			dib.WriteToFile(L"c:\\temp\\test.png");

Hi @dsw,

It’s a little more involved than this. Here is a sample that should help.

https://github.com/mcneel/rhino-developer-samples/blob/6/cpp/SampleCommands/cmdSampleMeshPreviewImage.cpp

– Dale

Thanks @dale, you have always a nice example at the hand :ok_hand::grinning: