Breakdown of the differences between `FactoryDocument` and Document returned from `Application.Documents.Open`?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi
We have some logic that enforces standards in our models, that's run from anywhere from parts to assemblies to drawings; for instance, just before an assembly is saved, we automatically check certain properties for compliance, in the assembly itself as well as each sub-document.
I'm trying to optimize some of our processes. One thing I'm looking to eliminate if I can is our calls of `Application.Documents.Open`, which runs in the above example at the start to gather each document to be operated on. My understanding is that this might be replaced by simply using the `FactoryDocument` from the `ComponentOccurrence.Definition.Document.ComponentDefinition`;
however, simply swapping this out, from a call to `Application.Documents.Open` to a check to see if the `Document` is a model state factory and returning it as-is, if not, or the `FactoryDocument`, if so, doesn't seem to go so smoothly:
There are at least two errors that wouldn't otherwise exist: the first is deleting material assets local to the target document; the second is renaming its model states.
Can anyone account for this difference in behaviour? Are there other differences that have been encountered or documented somewhere I should be aware of?
Thanks