- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm on my way out now for the weekend, so in a hurry.
First, I would advise against using the 'before save' event, because if your document has not been saved yet, it will not have a file path, or a file name yet, so 'ThisDoc.Path' will not have a value (empty String). It would be better 'after save', so that it will always have a file path and file name, even though I rarely use that event myself.
Second, I would not mix the terms 'ThisDoc' and 'ThisApplication.ActiveDocument', because they can be pointing to different documents when this rule gets triggered by 'events', instead of you having the document visibly open on your screen at that time. I am usually also a little cautious about using 'iProperties.Value()' snippets in a code that will get triggered to run by events, because they do not have a really good way to specify which specific document they will be focused on. I usually switch to doing those things the Inventor API way [Document.PropertySets.Item().Item().Value]. Just to be super sure about which document every line of code will be working on. I would use 'ThisDoc.Document' for obtaining a reference to the current document, when the rule gets ran by an event, because it will be the most appropriate in most situations. It's good that you are using 'New' then save process, because that avoids accidentally saving over your template, or the code referring to the template, instead of the 'truly' new document.
Wesley Crihfield
(Not an Autodesk Employee)