ReplaceReference on "Piping Runs Environment" assembly does not work instantly

ReplaceReference on "Piping Runs Environment" assembly does not work instantly

Anonymous
Not applicable
654 Views
4 Replies
Message 1 of 5

ReplaceReference on "Piping Runs Environment" assembly does not work instantly

Anonymous
Not applicable

Hi,

 

I have an Inventor Addin and i am using Inventor API.

I want to rename a complete assembly-structure that contains a piping assembly.

 

The Problem is that Inventor does not recognize the changes instantly and does not find the routes:

2016-06-20 10_03_53-Inventor Kopieren von Generator Baugruppen.docx - Word.png

 

 

I have a function which renames all models recursively, using replaceReference:

For Each childDoc As Document In activeDocument.ReferencingDocuments

  oFileDescriptors = childDoc.File.ReferencedFileDescriptors

  For descriptorCount = 1 To oFileDescriptors.Count

    Try

      If String.Compare(oFileDescriptors.Item(descriptorCount).FullFileName, filePath, True) = 0 Then

              oFileDescriptor = oFileDescriptors.Item(descriptorCount)

              oFileDescriptor.ReplaceReference(newFilePath)

      End If

    Catch exc As Exception

    End Try

  Next descriptorCount

Next

 

What can I do that Inventor recognizes the changes correctly?

It is no option to reopen assemblies, because opening of large assemblies is too slow.

 

thanks

-marcus

 

0 Likes
Accepted solutions (1)
655 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Accepted solution
I solved the Problem switching to LevelOfDetailEnum.kAllPartsSuppressedLevelOfDetail and back.
0 Likes
Message 3 of 5

Anonymous
Not applicable

I did not understand it fully. whose lod did you change and run. Could you please explain a bit more in detail

0 Likes
Message 4 of 5

Anonymous
Not applicable

I switched it on the main Assembly like that:

 If m_application.ActiveDocument.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
                        With DirectCast(m_application.ActiveDocument, AssemblyDocument)
                            
                            Dim alvl = .ComponentDefinition.RepresentationsManager.ActiveLevelOfDetailRepresentation
                            For Each lvl As LevelOfDetailRepresentation In .ComponentDefinition.RepresentationsManager.LevelOfDetailRepresentations
                                If lvl.LevelOfDetail = LevelOfDetailEnum.kAllPartsSuppressedLevelOfDetail Then
                                  
                                    lvl.Activate()
                                    Exit For
                                End If
                            Next
                            'switch back
                            alvl.Activate()
                        End With
                    End If
 
0 Likes
Message 5 of 5

Anonymous
Not applicable

thank you. working

0 Likes