Referenced File Descriptors

Referenced File Descriptors

Anonymous
Not applicable
1,279 Views
6 Replies
Message 1 of 7

Referenced File Descriptors

Anonymous
Not applicable
I saw a reference that Mike Martin made to SilentMode when changing the path
of referenced files. Anyone know what he is talking about?

I am trying to copy a set of files to a new location and want to "break the
link to the old location and supply a new path. Anyone got an example?

Thanks

Tim Strandberg
0 Likes
1,280 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
Could you mean SilentOperation?

Gets/sets the Boolean flag that controls whether an operation will proceed without
prompting (if that gets required...e.g.: error message dismissal). If Autodesk Inventor is
running visible, this property is FALSE by default.

--
Kent
Assistant Moderator
Autodesk Discussion Forum Moderator Program


"Tim Strandberg" wrote in message
news:F5D190C661F9BDA3C80B96E92ABFB6ED@in.WebX.maYIadrTaRb...
> I saw a reference that Mike Martin made to SilentMode when changing the path
> of referenced files. Anyone know what he is talking about?
>
> I am trying to copy a set of files to a new location and want to "break the
> link to the old location and supply a new path. Anyone got an example?
>
> Thanks
>
> Tim Strandberg
>
>
0 Likes
Message 3 of 7

Anonymous
Not applicable
Well that makes more sense. But my other question still stands. Has anyone
done anything, preferably from Apprentice regarding reference paths?

Thanks Kent!


"Kent Keller" wrote in message
news:20408BA58F40A1DAB120D7D976EFF63B@in.WebX.maYIadrTaRb...
> Could you mean SilentOperation?
>
> Gets/sets the Boolean flag that controls whether an operation will proceed
without
> prompting (if that gets required...e.g.: error message dismissal). If
Autodesk Inventor is
> running visible, this property is FALSE by default.
>
> --
> Kent
> Assistant Moderator
> Autodesk Discussion Forum Moderator Program
>
>
> "Tim Strandberg" wrote in message
> news:F5D190C661F9BDA3C80B96E92ABFB6ED@in.WebX.maYIadrTaRb...
> > I saw a reference that Mike Martin made to SilentMode when changing the
path
> > of referenced files. Anyone know what he is talking about?
> >
> > I am trying to copy a set of files to a new location and want to "break
the
> > link to the old location and supply a new path. Anyone got an example?
> >
> > Thanks
> >
> > Tim Strandberg
> >
> >
>
>
0 Likes
Message 4 of 7

Anonymous
Not applicable
> I am trying to copy a set of files to a new location and want to "break
the
> link to the old location and supply a new path. Anyone got an example?

I have done a similar job - "copy a assembly file". I traversed the copied
assembly file and call for all component occurrence's the methode Replace
with the new file location path, to break the link to the old location.

Alexander
0 Likes
Message 5 of 7

Anonymous
Not applicable
Tim



This resopnse is dated, so I bet you have a solution by now, but her goes.

If I understand you right. You are trying to programatically change the path of referenced files of an assembly.

There is a sample code fiund in the inventor help under apprentice. Here it is. (hope it pastes in ok)



Private Sub ChangeReferenceSample()
Dim oApprentice As New ApprenticeServerComponent

' Open a document.
Dim oDoc As ApprenticeServerDocument
Set oDoc = oApprentice.Open("C:\Temp\Assembly1.iam")

' Iterate through the references looking for a
' reference to a specific file.
Dim oRefFileDesc As ReferencedFileDescriptor
For Each oRefFileDesc In oDoc.ReferencedFileDescriptors
If oRefFileDesc.FullFileName "C:\Temp\OldPart.ipt" Then
' Replace the reference.
Call oRefFileDesc.PutLogicalFileNameUsingFull( _
"C:\Temp\NewPart.ipt")
Exit For
End If
Next

' Set a reference to the FileSaveAs object.
Dim oFileSaveAs As FileSaveAs
Set oFileSaveAs = oApprentice.FileSaveAs

' Save the assembly.
Call oFileSaveAs.AddFileToSave(oDoc, oDoc.FullFileName)
Call oFileSaveAs.ExecuteSave
End Sub




I have to get out here more often, I know this is a month past due.



JP
0 Likes
Message 6 of 7

Anonymous
Not applicable
Darn,I knew that would happen.



Private Sub ChangeReferenceSample()

Dim oApprentice As New ApprenticeServerComponent



' Open a document.

Dim oDoc As ApprenticeServerDocument

Set oDoc = oApprentice.Open("C:\Temp\Assembly1.iam")



' Iterate through the references looking for a

' reference to a specific file.

Dim oRefFileDesc As ReferencedFileDescriptor

For Each oRefFileDesc In oDoc.ReferencedFileDescriptors

If oRefFileDesc.FullFileName = "C:\Temp\OldPart.ipt" Then

' Replace the reference.

Call oRefFileDesc.PutLogicalFileNameUsingFull( _

"C:\Temp\NewPart.ipt")

Exit For

End If

Next



' Set a reference to the FileSaveAs object.

Dim oFileSaveAs As FileSaveAs

Set oFileSaveAs = oApprentice.FileSaveAs



' Save the assembly.

Call oFileSaveAs.AddFileToSave(oDoc, oDoc.FullFileName)

Call oFileSaveAs.ExecuteSave

End Sub

0 Likes
Message 7 of 7

Anonymous
Not applicable
OK - But what if the destination is another
folder???

 

/ Michael Christoffersen

 
0 Likes