Community
Vault Forum
Welcome to Autodesk’s Vault Forums. Share your knowledge, ask questions, and explore popular Vault topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ReplaceRef​erence before upload to vault

2 REPLIES 2
Reply
Message 1 of 3
ben.cameron
418 Views, 2 Replies

ReplaceRef​erence before upload to vault

Hi,

 

I've got some code that is attempting to do the following:

1) Retrieve a .dwg and associated .ipt from Vault ($\Test\Part1.dwg and $\Test\Part1.ipt)

2) Rename the files locally and copy them to a subfolder (resulting in C:\Projects\Test\Replace\Part1-2.dwg and C:\Projects\Test\Replace\Part1-2.ipt)

3) Update the reference in the new .dwg (Part1-2.dwg) to point to the new .ipt (Part1-2.ipt)

4) Upload the renamed, updated files into the new location in Vault ($\Test\Replace)

 

Everything seems to work fine, except that if I delete the local files after this process completes and then use Inventor's "Open From Vault" command to open the .dwg, it only downloads the .dwg rather than also downloading the .ipt.  This causes a reference error to then pop up in Inventor.

 

I'm using the .dwg's ReferencedFileDescriptor.ReplaceReference method to update the reference in step 3 and then saving the file.  If I look in Vault Explorer after this process completes, the references appear to be correct.  If I select the $\Test\Replace\Part1-2.dwg file, Part1-2.ipt is shown below in the "Uses" tab.


Also, when I use Fiddler to profile the web service requests being sent to Vault after selecting a file to open from Vault within Inventor, the references are being returned correctly.  Here is the sequence of requests in both cases (when the files have been added to Vault using my code vs. files that have been checked in from Inventor):

 

GetFilesByMasterID
GetProperties
GetLatestAssociatedFilePathsByMasterIds
DownloadFile
GetFilesAssociationsByIds

In both cases, the GetLatestAssociatedFilePathsByMasterIds call is returning the references as I would expect.  However, in the case where the files were checked in from Inventor, the "DownloadFile" method is being called twice (first for the .dwg and then for the .ipt).  The only other difference is that the Inventor check-in is apparently automatically creating .dwf's for both the .dwg and .ipt and checking those in to Vault as well. So,the
GetLatestAssociatedFilePathsByMasterIds call is returning 4 files in this case rather than just the 2 that I care about.

Since the references are coming back correctly both from the Vault Explorer and the web service calls, my assumption is that everything is as it should be in Vault after my code executes.  This leads me to believe that it has something to do with
the .dwg file itself - like maybe there is something else I need to do to the .dwg in step 3 besides just call
ReplaceReference.

Any ideas?

Thanks,
Ben
2 REPLIES 2
Message 2 of 3
Redmond.D
in reply to: ben.cameron

When you check-in the DWG and set up your dependency to the IPT, what are you setting as the 'dependSources' value.  I think Inventor expects the value to be "INVENTOR".

 

To check things our for yourself, call GetFilesAssociationsByIds on Part1.dwg.  The 'Source' value on the FileAssoc object is what you want to use for the 'dependSources' value on check-in.



Doug Redmond
Software Engineer
Autodesk, Inc.

Message 3 of 3
ben.cameron
in reply to: ben.cameron

I just double-checked, and the call to AddFile is passing "INVENTOR" as the single element in an array for the dependSources parameter.  The call to GetFileAssociationsByIds is also returning "INVENTOR" as the Source on the dependency file association.  Here's the complete result from GetFileAssociationsByIds, in case anything else jumps out at you:

<GetFileAssociationsByIdsResult>
 <FileAssocArray>
  <FileAssocs>
   <FileAssoc Id="70" Typ="Dependency" Source="INVENTOR" CorrectRev="true">
    <ParFile Id="209" Name="Part1-12.dwg" MasterId="208" VerNum="1" MaxCkInVerNum="1" CkInDate="2011-02-11T08:04:56.72-06:00" Comm="Vault File Copy Operation" CreateDate="2011-02-11T08:04:56.72-06:00" CreateUserId="2" Cksum="-752367122" FileSize="195931" ModDate="2011-02-11T08:05:24.767-06:00" CreateUserName="Administrator" CheckedOut="false" CkOutFolderId="-1" CkOutSpec="" CkOutMach="" CkOutUserId="-1" FileClass="DesignDocument" Locked="false" Hidden="false" Cloaked="false" FileStatus="Unknown" IsOnSite="true" OrigFileId="-1" DesignVisAttmtStatus="None" ControlledByChangeOrder="false">
     <FileRev RevId="95" Label="" MaxConsumeFileId="-1" MaxFileId="209" RevDefId="0" MaxRevId="95" Order="1" />
     <FileLfCyc LfCycStateId="-1" LfCycDefId="-1" LfCycStateName="" Consume="false" />
     <Cat CatId="1" CatName="Base" />
    </ParFile>
    <CldFile Id="207" Name="Part1-12.ipt" MasterId="206" VerNum="1" MaxCkInVerNum="1" CkInDate="2011-02-11T08:04:44.347-06:00" Comm="Vault File Copy Operation" CreateDate="2011-02-11T08:04:44.347-06:00" CreateUserId="2" Cksum="954900923" FileSize="75264" ModDate="2011-02-11T08:05:12.067-06:00" CreateUserName="Administrator" CheckedOut="false" CkOutFolderId="-1" CkOutSpec="" CkOutMach="" CkOutUserId="-1" FileClass="None" Locked="false" Hidden="false" Cloaked="false" FileStatus="Unknown" IsOnSite="true" OrigFileId="-1" DesignVisAttmtStatus="None" ControlledByChangeOrder="false">
     <FileRev RevId="94" Label="" MaxConsumeFileId="-1" MaxFileId="207" RevDefId="0" MaxRevId="94" Order="1" />
     <FileLfCyc LfCycStateId="-1" LfCycDefId="-1" LfCycStateName="" Consume="false" />
     <Cat CatId="1" CatName="Base" />
    </CldFile>
   </FileAssoc>
  </FileAssocs>
 </FileAssocArray>
</GetFileAssociationsByIdsResult>

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report