理解装配中的文件引用-2

来源:互联网 发布:matlab画二维数组 编辑:程序博客网 时间:2024/05/17 14:15

本文接着上一篇 【理解装配中的文件引用-1http://blog.csdn.net/autodeskinventorapi/article/details/8505452。 

原文链接:http://modthemachine.typepad.com/my_weblog/2008/11/file-references-part-2.html

I received a question related to my last posting that I thought was good and also helps to illustrate the previous posting.  The question that came in asked about the new Open Drawing command that is part of the subscription pack.  When you have a part, assembly, or presentation document open and right-click on the top node in the browser you'll see the new Open Drawing command in the context menu, as shown below.

Inventor中的零件或装配右键菜单有一个功能叫做【Open Drawing】,中文是【打开工程图】。很早前是在为速博用户提供的,现在已经是产品正式的部分。它可以打开引用了该文档的工程图。


Based on the last posting, the obvious question is how can this work since we learned that the part doesn't know which documents it's referenced in.  Is there something I wasn't telling you?  The answer is that nothing has changed from the last posting and everything I explained there still applies.  But then how can this command work?  It's actually quite simple how the command works and could have easily been implemented as a small add-in command.

其实在上一篇我们也提到,例如零件,它并不知道谁引用了自己。而上面Inventor提供的功能是怎么回事呢?其实它的原理非常简单。

When you run the Open Drawing command it looks in the current directory and subdirectories for a file that has the same name as the active document, but with a .idw or .dwg file extension.  If it doesn't find the file in the current directory or subdirectory it will search the other directories defined by the active project.  If it still doesn't find the file then it displays the Open dialog to allow you to specify the file.  The part doesn't have any knowledge of the drawing, it's only the program logic that's making that association based on the filename of the part.

当你运行【打开工程图】时,它在工程项目的文件夹或子文件夹找寻和当前文档(例如零件)同名但是后缀为.idw 或 .dwg的文件。如果没找到,则去项目制定的其它路径寻找。如果还是没找到,则弹出一个对话框让你指定。其实,当前文档根本不知道谁引用了它,而仅仅基于同文件名来进行查找。

There was also a related question in the customization newsgroup that I thought was answered in the previous posting but I think probably needs to be emphasized.  The concept to understand is that a reference to another document is just the filename, i.e. MyPart.ipt, NOT the full filename, C:\Temp\MyPart.ipt.  When Inventor opens an assembly it reads the file reference list and looks for the referenced files on disk.  It does this using the file name and the active project to define the possible locations of the file.  The location is not part of the file reference.  The important thing to get from this is that if you need to reorganize your files and move them around on disk you don't need to do anything about the file references.  You only need to make sure that the project specifies the directories that contain the files.  The only time you need to change file references is when you've changed the filename of the file. 

强调一下。这里做判断的标准基于文件名,而不是文件全名(包括后缀或路径)。 当Inventor打开装配,它将在磁盘上寻找引用的文件。也是基于文件名。路径并不是引用的一部分。所以,如果你把含有零件和装配的文件夹整体拷贝到另外的位置,你不需要担心是否引用的文件能被找到。只需要确保工程项目规定的那些文件夹里有这样名字的零件即可。


原创粉丝点击