I am still working on my custom clipping box(just like Revit has) which is attached with 6 clipping planes on each face using Rhino.Display.DisplayConduit class.
The clipping box needs to be save as user file, but as far as I went through example programs, I could not find the way to solve it.
If anyone has good example or any clue, please give me some advises.
A part of the DisplayConduit Class is;
protected override void CalculateBoundingBox(CalculateBoundingBoxEventArgs e)
if (d_box != null) //d_box is geometry Box object
BoundingBox m_bbox = d_box.box.BoundingBox;
protected override void PreDrawObjects( DrawEventArgs e)
//and... each sides of Y and Z.
protected override void DrawOverlay(DrawEventArgs e)
If I understand correctly, you want to save the details of your clipping box to file? You have, I think, two options:
- save it as plug-in data in the .3dm file, so that when the user re-opens the saved file, this information can be read back and your custom clipping box can be restored;
- save it to an external file
Saving to and reading from 3dm is done by the PlugIn class, using PlugIn.ShoudCallWriteDocument (override this in your plug-in class to return true if you want to write something to 3dm file), followed by PlugIn.WriteDocument (override this in your plug-in class to do the actual writing of data).
Lastly, when a user opens a file in which you have written something with the approach above, you need to override the PlugIn.ReadDocument method, and read back what you wrote before.
One more tip if you go down this road: write a version number of your data to the file, and read this back. You never know if you are going to need to change/extend the data written to file, and once you start writing to files, you need to support the data written to file, even if you changed in newer versions what is written. By always using a version number, and reading that back from your file, you can support different versions of what you wrote.
Thank you Menno!!
Yes! I exactly need to save the “details” of my custom clipping box.
I have found some examples which are using PlugIn class, and will go through it to try to understand the PlugIn class.
My understanding of Rhinocommon is still low level. But it is getting interesting when my program successfully runs.
Only this forum is just my hope to solve problem, because I do not have anyone to whom I could ask questions about Rhinocommon.
Thank you very much!!!