<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Frame members View Reps in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/frame-members-view-reps/m-p/12030054#M33016</link>
    <description>&lt;DIV&gt;Hi ,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;'create a design view representation for each unique part in the assembly&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;'define current document&lt;/DIV&gt;&lt;DIV&gt;Dim openDoc As Document&lt;/DIV&gt;&lt;DIV&gt;openDoc = ThisDoc.Document&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Dim oTrans As Transaction=ThisApplication.TransactionManager.StartTransaction(openDoc,"Create View Rep's")&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Try&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;'set a reference to the assembly component definintion.&lt;/DIV&gt;&lt;DIV&gt;'this assumes an assembly document is open.&lt;/DIV&gt;&lt;DIV&gt;Dim oAsmCompDef As AssemblyComponentDefinition&lt;/DIV&gt;&lt;DIV&gt;oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;'look at all of the components in the assembly&lt;/DIV&gt;&lt;DIV&gt;Dim oCompDef As Inventor.ComponentDefinition = openDoc.ComponentDefinition&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;'define the first level components collection&lt;/DIV&gt;&lt;DIV&gt;Dim oCompOcc As Inventor.ComponentOccurrence&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;'define view rep&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Dim oViewRep As DesignViewRepresentation&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;'define an arraylist to hold the list of&amp;nbsp; view rep names&lt;/DIV&gt;&lt;DIV&gt;Dim NameList As New ArrayList()&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;'Look at the view reps in the assembly&lt;/DIV&gt;&lt;DIV&gt;For Each oViewRep In oAsmCompDef.RepresentationsManager.DesignViewRepresentations&lt;/DIV&gt;&lt;DIV&gt;'set the list of names to the array list&lt;/DIV&gt;&lt;DIV&gt;NameList.Add(oViewRep.Name)&lt;/DIV&gt;&lt;DIV&gt;Next&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;'check for a Default view rep and create it if not found&lt;/DIV&gt;&lt;DIV&gt;If Not NameList.Contains("Default") Then&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'create Default view rep&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oViewRep = oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Add("Default")&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oViewRep.ShowAll&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oViewRep.Activate&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;End If&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;'zoom all&lt;/DIV&gt;&lt;DIV&gt;ThisApplication.CommandManager.ControlDefinitions.Item("AppIsometricViewCmd").Execute&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;'look at all of the unique parts in the assembly&lt;/DIV&gt;&lt;DIV&gt;For Each docFile In openDoc.AllReferencedDocuments&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;If oCompDef.Occurrences.AllReferencedOccurrences(docFile).Count &amp;gt; 0 Then 'avoid to create a view rep for base part of derived parts&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;If Not docFile.componentdefinition.bomstructure = BOMStructureEnum.kPhantomBOMStructure Then&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;If docFile.DocumentType = 12290 Then '12290 is the part document enumurator&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'locate the last backslash position in the full file name&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Dim FNamePos As Long&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FNamePos = InStrRev(docFile.FullFileName, "\", -1)&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'remove path from part file name &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Dim docFName As String&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) - FNamePos)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'remove extension from part file name&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ShortName = Left(docFName,&amp;nbsp; Len(docFName) - 4)&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'check to see if the arraylist contains the desired view rep&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;If Not NameList.Contains(ShortName) Then&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'create new View Rep&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oViewRep = oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Add(ShortName)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oViewRep.Activate&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oViewRep.Locked = False &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Else If NameList.Contains(ShortName) Then&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'reference existing View Rep&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oViewRep = oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item(ShortName)&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oViewRep.Activate&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oViewRep.Locked = False&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;End If&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Dim bSkip As Boolean=False&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'look at all of the occurences&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;For Each oCompOcc In oCompDef.Occurrences.AllLeafOccurrences&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'locate the colon position in the occurence name&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oCompOccPos = InStrRev(oCompOcc.Name, ":")&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;If oCompOccPos&amp;lt;2 Then oCompOccPos=Len(oCompOcc.Name)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'set occurence name to everything left of the colon&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oOccName = Left(oCompOcc.Name, oCompOccPos -1)&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'set visible if name matches first occurence&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 'If oCompOcc.Name = ShortName &amp;amp; ":1" And bSkip = False Then&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;If System.IO.Path.GetFileNameWithoutExtension(oCompOcc.ReferencedDocumentDescriptor.ReferencedFileDescriptor.FullFileName) = ShortName&amp;nbsp; And bSkip=False Then&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oCompOcc.Visible = True&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ThisApplication.ActiveView.Update()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;bSkip=True 'even if there is more than one occurrence named "xyz:1" in different subassys, we want only one occurence in our view rep&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Else&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oCompOcc.Visible = False&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ThisApplication.ActiveView.Update()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;End If&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Next&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;End If&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;End If&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'lock view rep&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oViewRep.Locked = True &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;End If&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;Next&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;'set Default View Rep active&lt;/DIV&gt;&lt;DIV&gt;oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item("Default").Activate&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;oTrans.End&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Catch ex As Exception&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;MsgBox(ex.StackTrace&amp;nbsp; )'Message)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oTrans.Abort&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;End Try&lt;/DIV&gt;</description>
    <pubDate>Tue, 13 Jun 2023 10:37:44 GMT</pubDate>
    <dc:creator>suresh.r.ext</dc:creator>
    <dc:date>2023-06-13T10:37:44Z</dc:date>
    <item>
      <title>Frame members View Reps</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/frame-members-view-reps/m-p/11410954#M33014</link>
      <description>&lt;P&gt;hi Im trying to create view rep for each member in frame through vba or inventor rules. i have tried but assembly occurrence only created. frames are not detected in assembly occurrence .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;image is the sample snips of frames, need your help guys.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1113733i19C8EFD4098ACFD2/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Sep 2022 11:36:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/frame-members-view-reps/m-p/11410954#M33014</guid>
      <dc:creator>suresh.r.ext</dc:creator>
      <dc:date>2022-09-09T11:36:04Z</dc:date>
    </item>
    <item>
      <title>Re: Frame members View Reps</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/frame-members-view-reps/m-p/11411150#M33015</link>
      <description>&lt;P&gt;Hi&amp;nbsp; &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12732673"&gt;@suresh.r.ext&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;&lt;P&gt;Can you supply the code your using? It is best to help you modify your code as it will help you understand the issues.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What might be wrong is whenever you create a view rep/activate one you need to set the occurrence visibility while looping through occurrences.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Syntax&lt;/P&gt;&lt;P&gt;Occurrance.Visible = True&lt;/P&gt;</description>
      <pubDate>Fri, 09 Sep 2022 13:07:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/frame-members-view-reps/m-p/11411150#M33015</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2022-09-09T13:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: Frame members View Reps</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/frame-members-view-reps/m-p/12030054#M33016</link>
      <description>&lt;DIV&gt;Hi ,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;'create a design view representation for each unique part in the assembly&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;'define current document&lt;/DIV&gt;&lt;DIV&gt;Dim openDoc As Document&lt;/DIV&gt;&lt;DIV&gt;openDoc = ThisDoc.Document&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Dim oTrans As Transaction=ThisApplication.TransactionManager.StartTransaction(openDoc,"Create View Rep's")&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Try&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;'set a reference to the assembly component definintion.&lt;/DIV&gt;&lt;DIV&gt;'this assumes an assembly document is open.&lt;/DIV&gt;&lt;DIV&gt;Dim oAsmCompDef As AssemblyComponentDefinition&lt;/DIV&gt;&lt;DIV&gt;oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;'look at all of the components in the assembly&lt;/DIV&gt;&lt;DIV&gt;Dim oCompDef As Inventor.ComponentDefinition = openDoc.ComponentDefinition&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;'define the first level components collection&lt;/DIV&gt;&lt;DIV&gt;Dim oCompOcc As Inventor.ComponentOccurrence&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;'define view rep&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Dim oViewRep As DesignViewRepresentation&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;'define an arraylist to hold the list of&amp;nbsp; view rep names&lt;/DIV&gt;&lt;DIV&gt;Dim NameList As New ArrayList()&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;'Look at the view reps in the assembly&lt;/DIV&gt;&lt;DIV&gt;For Each oViewRep In oAsmCompDef.RepresentationsManager.DesignViewRepresentations&lt;/DIV&gt;&lt;DIV&gt;'set the list of names to the array list&lt;/DIV&gt;&lt;DIV&gt;NameList.Add(oViewRep.Name)&lt;/DIV&gt;&lt;DIV&gt;Next&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;'check for a Default view rep and create it if not found&lt;/DIV&gt;&lt;DIV&gt;If Not NameList.Contains("Default") Then&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'create Default view rep&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oViewRep = oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Add("Default")&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oViewRep.ShowAll&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oViewRep.Activate&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;End If&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;'zoom all&lt;/DIV&gt;&lt;DIV&gt;ThisApplication.CommandManager.ControlDefinitions.Item("AppIsometricViewCmd").Execute&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;'look at all of the unique parts in the assembly&lt;/DIV&gt;&lt;DIV&gt;For Each docFile In openDoc.AllReferencedDocuments&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;If oCompDef.Occurrences.AllReferencedOccurrences(docFile).Count &amp;gt; 0 Then 'avoid to create a view rep for base part of derived parts&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;If Not docFile.componentdefinition.bomstructure = BOMStructureEnum.kPhantomBOMStructure Then&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;If docFile.DocumentType = 12290 Then '12290 is the part document enumurator&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'locate the last backslash position in the full file name&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Dim FNamePos As Long&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FNamePos = InStrRev(docFile.FullFileName, "\", -1)&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'remove path from part file name &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Dim docFName As String&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) - FNamePos)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'remove extension from part file name&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ShortName = Left(docFName,&amp;nbsp; Len(docFName) - 4)&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'check to see if the arraylist contains the desired view rep&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;If Not NameList.Contains(ShortName) Then&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'create new View Rep&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oViewRep = oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Add(ShortName)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oViewRep.Activate&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oViewRep.Locked = False &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Else If NameList.Contains(ShortName) Then&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'reference existing View Rep&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oViewRep = oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item(ShortName)&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oViewRep.Activate&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oViewRep.Locked = False&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;End If&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Dim bSkip As Boolean=False&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'look at all of the occurences&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;For Each oCompOcc In oCompDef.Occurrences.AllLeafOccurrences&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'locate the colon position in the occurence name&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oCompOccPos = InStrRev(oCompOcc.Name, ":")&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;If oCompOccPos&amp;lt;2 Then oCompOccPos=Len(oCompOcc.Name)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'set occurence name to everything left of the colon&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oOccName = Left(oCompOcc.Name, oCompOccPos -1)&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'set visible if name matches first occurence&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 'If oCompOcc.Name = ShortName &amp;amp; ":1" And bSkip = False Then&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;If System.IO.Path.GetFileNameWithoutExtension(oCompOcc.ReferencedDocumentDescriptor.ReferencedFileDescriptor.FullFileName) = ShortName&amp;nbsp; And bSkip=False Then&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oCompOcc.Visible = True&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ThisApplication.ActiveView.Update()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;bSkip=True 'even if there is more than one occurrence named "xyz:1" in different subassys, we want only one occurence in our view rep&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Else&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oCompOcc.Visible = False&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ThisApplication.ActiveView.Update()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;End If&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Next&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;End If&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;End If&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'lock view rep&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oViewRep.Locked = True &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;End If&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;Next&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;'set Default View Rep active&lt;/DIV&gt;&lt;DIV&gt;oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item("Default").Activate&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;oTrans.End&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Catch ex As Exception&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;MsgBox(ex.StackTrace&amp;nbsp; )'Message)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;oTrans.Abort&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;End Try&lt;/DIV&gt;</description>
      <pubDate>Tue, 13 Jun 2023 10:37:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/frame-members-view-reps/m-p/12030054#M33016</guid>
      <dc:creator>suresh.r.ext</dc:creator>
      <dc:date>2023-06-13T10:37:44Z</dc:date>
    </item>
    <item>
      <title>Re: Frame members View Reps</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/frame-members-view-reps/m-p/12030057#M33017</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7946284"&gt;@A.Acheson&lt;/a&gt;&amp;nbsp; Pls find the attachment for reference&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2023 10:40:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/frame-members-view-reps/m-p/12030057#M33017</guid>
      <dc:creator>suresh.r.ext</dc:creator>
      <dc:date>2023-06-13T10:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: Frame members View Reps</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/frame-members-view-reps/m-p/12032407#M33018</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12732673"&gt;@suresh.r.ext&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I reworked your original and this will give the following outcome.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AAcheson_0-1686719739297.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1227312iCA23C33E1EB281D8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AAcheson_0-1686719739297.png" alt="AAcheson_0-1686719739297.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;'create a design view representation for each unique part in the assembly 

'define current document
Dim oOpenDoc As Document = ThisDoc.Document

Dim oTrans As Transaction = ThisApplication.TransactionManager.StartTransaction(oOpenDoc,"Create View Rep's")

Try
	
	'set a reference to the assembly component definintion.
	'this assumes an assembly document is open.
	Dim oAsmCompDef As AssemblyComponentDefinition = ThisApplication.ActiveDocument.ComponentDefinition

	'look at all of the components in the assembly
	Dim oCompDef As Inventor.ComponentDefinition = oOpenDoc.ComponentDefinition

	'define the first level components collection
	Dim oCompOcc As Inventor.ComponentOccurrence 

	'define view rep 
	Dim oViewRep As DesignViewRepresentation
	
	'define view reps 
	Dim oViewReps As DesignViewRepresentations = oAsmCompDef.RepresentationsManager.DesignViewRepresentations

	'define an arraylist to hold the list of  view rep names
	Dim NameList As New ArrayList()

	'Look at the view reps in the assembly
	For Each oViewRep In oViewReps
		'set the list of names to the array list
		NameList.Add(oViewRep.Name)
	Next

	'check for a Default view rep and create it if not found
	If Not NameList.Contains("Default") Then
		'create Default view rep 
		oViewRep = oViewReps.Add("Default") 
		oViewRep.ShowAll
		oViewRep.Activate
	End If

	'zoom all
	ThisApplication.CommandManager.ControlDefinitions.Item("AppIsometricViewCmd").Execute

	'look at all of the unique parts in the assembly
	For Each oRefDoc As Document In oOpenDoc.AllReferencedDocuments
		If oCompDef.Occurrences.AllReferencedOccurrences(oRefDoc).Count &amp;gt; 0 Then 'avoid to create a view rep for base part of derived parts
			If Not oRefDoc.componentdefinition.bomstructure = BOMStructureEnum.kPhantomBOMStructure Then
				If oRefDoc.DocumentType = 12290 Then '12290 is the part document enumurator
		 			Dim sShortName As String = System.IO.Path.GetFileNameWithoutExtension(oRefDoc.FullFileName)
					'check to see if the arraylist contains the desired view rep
					If Not NameList.Contains(sShortName) Then
						'create new View Rep 
						oViewRep = oViewReps.Add(sShortName)
					ElseIf NameList.Contains(sShortName) Then
						'reference existing View Rep 
						oViewRep = oViewReps.Item(sShortName) 
					End If
					
					oViewRep.Activate
					oViewRep.Locked = False
					
					Dim bSkip As Boolean = False
					'look at all of the occurences
					For Each oCompOcc In oCompDef.Occurrences.AllLeafOccurrences 
						'locate the colon position in the occurence name
						Dim oCompOccPos As Integer = InStrRev(oCompOcc.Name, ":")
						If oCompOccPos&amp;lt;2 Then oCompOccPos = Len(oCompOcc.Name)
						'set occurence name to everything left of the colon
						Dim oOccName As String = Left(oCompOcc.Name, oCompOccPos -1) 
						'set visible if name matches first occurence
				      	'If oCompOcc.Name = ShortName &amp;amp; ":1" And bSkip = False Then
						If System.IO.Path.GetFileNameWithoutExtension(oCompOcc.ReferencedDocumentDescriptor.ReferencedFileDescriptor.FullFileName) = sShortName  And bSkip=False Then
							oCompOcc.Visible = True
							ThisApplication.ActiveView.Update()
							bSkip = True 'even if there is more than one occurrence named "xyz:1" in different subassys, we want only one occurence in our view rep
						Else
							oCompOcc.Visible = False
							ThisApplication.ActiveView.Update()
						End If
					
					Next
					oViewRep.Locked = True
				End If
			End If
			
		End If
	
	Next

	'set Default View Rep active
	oViewReps.Item("Default").Activate

	oTrans.End

Catch ex As Exception
	MsgBox(ex.StackTrace)'Message)
	oTrans.Abort
End Try&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a shorter version that is working in a more target way to find&amp;nbsp; only frame generator parts.&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Dim asmDoc As AssemblyDocument = ThisDoc.Document
Dim trans As Transaction = ThisApplication.TransactionManager.StartTransaction(asmDoc, "FG View Reps") 	

Dim viewReps As DesignViewRepresentations = asmDoc.ComponentDefinition.RepresentationsManager.DesignViewRepresentations
Dim viewRep As DesignViewRepresentation

'Traverse all referenced documents		
For Each doc As Document In asmDoc.AllReferencedDocuments 
	If doc.DocumentInterests.HasInterest("{AC211AE0-A7A5-4589-916D-81C529DA6D17}") _' Frame generator component
		AndAlso doc.DocumentType = DocumentTypeEnum.kPartDocumentObject _ 'Part
		AndAlso doc.IsModifiable _'Not read only CC/Library document
		AndAlso Not doc.DocumentInterests.HasInterest("SkeletonDoc") _'Not reference skeleton
		AndAlso asmDoc.ComponentDefinition.Occurrences.AllReferencedOccurrences(doc).Count &amp;gt; 0 _'Exists in assembly (not derived base component)
		AndAlso Not doc.ComponentDefinition.Bomstructure = BOMStructureEnum.kPhantomBOMStructure Then
	
		Dim occ As ComponentOccurrence = asmDoc.ComponentDefinition.Occurrences.AllReferencedOccurrences(doc).Item(1)
		Dim fileName As String = System.IO.Path.GetFileNameWithoutExtension(doc.FullFileName)

		'Select/Create view rep
		Try
			viewRep = viewReps(fileName)
		Catch
			viewRep = viewReps.Add(fileName)
		End Try
		
		viewRep.Activate
		viewRep.Locked = False
		viewRep.HideAll
		occ.Visible = True
		viewRep.Locked = True
		
	End If	
Next

'Create view rep
Try
	viewRep = viewReps("Default")
Catch
	viewRep = viewReps.Add("Default")
	viewRep.ShowAll
End Try

viewRep.Activate
viewRep.Locked = True

trans.End &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2023 05:49:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/frame-members-view-reps/m-p/12032407#M33018</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-06-14T05:49:04Z</dc:date>
    </item>
    <item>
      <title>Re: Frame members View Reps</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/frame-members-view-reps/m-p/12288888#M33019</link>
      <description>&lt;P&gt;Hi, thanks for these codes, they are incredibly close to what I'm currently needing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The second code works perfectly for me to get views of frame members, whether I run it in the weldment assembly or in the frame assembly within that, but obviously only creates views for the frame members.&lt;/P&gt;&lt;P&gt;The first code works for any part in assemblies that don't have frames in, or will work in the frame assembly itself to create views for all the members, but comes up with errors when trying to run it in a weldment assembly that contains a frame.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to combine the two so that it will work in the top level weldment assembly and create views for all frame members and also for any other parts that are included?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance, what's already here has already been a great help!&lt;/P&gt;&lt;P&gt;Alasdair&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2023 09:09:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/frame-members-view-reps/m-p/12288888#M33019</guid>
      <dc:creator>alasdair_crawford</dc:creator>
      <dc:date>2023-10-06T09:09:38Z</dc:date>
    </item>
    <item>
      <title>Re: Frame members View Reps</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/frame-members-view-reps/m-p/12289508#M33020</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13529505"&gt;@alasdair_crawford&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you don't want to specifically target frame generated parts then just remove those filters from the if statement. This will then target all part documents that are not read only. The start of the If statement then moves to replace the next AndAlso statement.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;'If doc.DocumentInterests.HasInterest("{AC211AE0-A7A5-4589-916D-81C529DA6D17}") _' Frame generator component
		AndAlso doc.DocumentType = DocumentTypeEnum.kPartDocumentObject _ 'Part
		AndAlso doc.IsModifiable _'Not read only CC/Library document
		'AndAlso Not doc.DocumentInterests.HasInterest("SkeletonDoc") _'Not reference skeleton
		&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;New filter setup&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;If doc.DocumentType = DocumentTypeEnum.kPartDocumentObject _ 'Part
AndAlso doc.IsModifiable  Then 'Not read only CC/Library document

'DO SOMETHING HERE
End If 
		&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2023 14:14:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/frame-members-view-reps/m-p/12289508#M33020</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-10-06T14:14:48Z</dc:date>
    </item>
    <item>
      <title>Re: Frame members View Reps</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/frame-members-view-reps/m-p/12289515#M33021</link>
      <description>&lt;P&gt;Thank you, that's working great. Really appreciate the help!&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2023 14:10:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/frame-members-view-reps/m-p/12289515#M33021</guid>
      <dc:creator>alasdair_crawford</dc:creator>
      <dc:date>2023-10-06T14:10:21Z</dc:date>
    </item>
  </channel>
</rss>

