Hello,
I have studied pages on userdata:
http://wiki.mcneel.com/developer/userdata
http://wiki.mcneel.com/developer/sdksamples/documentdata
I was able to read/write the plugin data in document data..
Problem: I want to figure out when user changed the document or precisely differentiate between these two use cases:
1. User opened a document which has plugin data ---- Plugin read the data from .3dm file.
2. User opened a document which has plugin data ---- Plugin read the data from .3dm file---- User opened a document which does not have plugin data----(Since data was already read when user opened first document, plugin assumes that even the new document has this plugin data. )
So is there a way for plugin to know when the user opened a document or created a new document?
If not, is there a way to read the document data anywhere other than
public override bool ReadDocument(MRhinoDoc doc, RMA.OpenNURBS.OnBinaryArchive archive, IRhinoFileReadOptions options)
If not, do you think I need to write plugin data as object user data(instead of document data) and attach it to some entity in rhino?
Thank you for your help!!
Regards
Varun
Tags:
Permalink Reply by Dale Fugier on March 21, 2013 at 11:31am Hi Varun,
Here is a sample that you might find worth reviewing:
https://github.com/dalefugier/SampleCsDocumentUserData
Your plug-in's ReadDocument() member is called when Rhino discovered that the document it was reading contains your user data. Rhino passes ReadDocument() a FileReadOptions object that contain in what context the reading is occuring: new document, open document, import document, etc.
Does this help?
-- Dale
Permalink Reply by Varun Bhartiya on March 22, 2013 at 2:57am
Permalink Reply by Dale Fugier on March 22, 2013 at 9:14am >New document does not have any plugin data.
ReadDocument() is only called when Rhino is reading a document, either an existing document or a new document based on an existing template, that contains your plug-ins document data.
>If the user has opened a document that...
If you want to know when a new document is being created, then subscribe to the Rhino.RhinoDoc.NewDocument event. I've updated the sample to show you how to do this.
https://github.com/dalefugier/SampleCsDocumentUserData
-- Dale
Permalink Reply by Varun Bhartiya on March 25, 2013 at 6:55am Hello Dale,
Subscribing to new document and begin open document events worked..
Thank you very much!!!
Regards
Varun
© 2013 Created by McNeel Admin.
