
I want to explain some of the more confusing aspects of File attachments and dependencies.
What is a Dependency?
It's just what it sounds like. The parent file depends on the child file. The parent file can't work properly if the child file is not present. Dependencies should be only created programmatically such as the CAD client or a custom program.
What is an Attachment?
It a parent/child link where the parent does not depend on the child file. This is the only association type that the end user can explicitly create in the Vault Explorer client.
What type should I use?
Sometimes it's unclear what type to use. I recommend asking yourself this question "When viewing the parent file, do I always want the child file to be present?" If the answer is yes, then it's a dependency. If the answer is no, then it's probably an attachment.
How do dependencies affect behavior?
A lot more business logic is built into dependencies. Operations that will break a file reference are restricted. For example, you can't delete a file that has a parent dependency. However, you are allowed to do the delete if you are deleting all the parents too.
The move and rename operations in Vault Explorer have special client-side logic for updating parent references during these operations. If the parent can't be updated, the operation is blocked. However this is all client-side logic. The server will allow moves and renames in these cases. So it's up to the client application to insure that file references don't get broken when the API calls are made.
What is a Design Visualization attachment?
This is a case where a parent is attached to a child file with the DesignVisualization classification. In other words, the child is meant to provide a view for the CAD data. The nice thing about this attachment type is that you can create them without increasing the version of the file.
The server will allow you to have design visualizations of any type, however many clients will only recognize DWF files. It's also a good idea to avoid having more than one visualization attachment on a single file.
What does a "source" mean?
When you add or check-in a file, you set up your attachments and dependencies. You pass in the File ID of the child file and you have to provide a "source" for the association. A source is basically the application that "owns" the link. Other applications are supposed to refrain from modifying the link. A null value means that the link is not specific to an application.
The source concept was introduced specifically for the Inventor DWG feature, and I am not aware of any other uses. Basically, it tells if an association is owned by Inventor or AutoCAD so that one app doesn't alter the other app's associations.
The only legal values for a source are null, "INVENTOR" and "AUTOCAD". Any other value may lead to strange behavior in some clients (the server doesn't care).
The recommendation is to pass in null for new associations. If you are preserving an existing association, just pass in the existing source. Inventor and AutoCAD files should be added to Vault via through the CAD applications themselves.

Leave a Reply