I am reposting this graphics from here.
Let’s first of all have a look at the various available ways to reference geometry and data in ghPython:
ghdoc is the standard document for rhinoscriptsyntax. We can use it all the time and it is meant to be as quick as possible, in order to slow down rhinosciptsyntax in Grasshopper as little as possible.
It is also possible to just reference or create geometry in memory using RhinoCommon methods.
The third and last document is the usual Rhino document, which is also accessible in ghPython: Rhino.RhinoDoc.ActiveDoc .
All these three styles are valid and useful for certain purposes and code writing styles.
Specifically, you are asking to take data from ghdoc, obtain the geometry, and finally add it to the Rhino document. This is essentially baking in ghPython, right?
I am attaching an example.
When you have a document available and a Guid, you can use rhinoscriptsyntax.coerceXXX(guid) in order to obtain geometry, or specific types of geometry.
Similarly, scriptcontext.doc.Objects.AddXXX() allows to add geometry to the document. There are lots of variants for this. You can refer to the RhinoCommon documentation for all methods in the ObjectTable class, or all methods in the ghPython one are on GitHub.
bake_into_rhino.gh (7.5 KB)