Search function in Inventor

Search function in Inventor

Anonymous
Not applicable
997 Views
3 Replies
Message 1 of 4

Search function in Inventor

Anonymous
Not applicable

Hi,

 

In my company we make pretty big assemblies (current model has around 600 unique parts).  When I am workin in the main assembly I often notice that I use a lot of time to search back and forth in the model browser to find a part burried in a sub-sub-sub assembly. 

Does Inventor have some kind of search engine/function build in, which makes it much faster to find a deeply burried part? 

 

If this does not exist, does anybody know of an add-in, ilogic rule or macro which can execute this? 

What I am looking for is something similar to the "ctrl - F " funcion in f.e. microsoft word.

 

Thanks in advance! 

 

Lars

0 Likes
998 Views
3 Replies
Replies (3)
Message 2 of 4

CCarreiras
Mentor
Mentor

Hi!

 

Check those options:

 

to find parts in work space based in the browser´s select parts.

To find parts in the browser based in the work space parts selection

Find parts based in a parameters, name, properties, etc etc etc...Clipboard09.png

CCarreiras

EESignature

0 Likes
Message 3 of 4

dg2405
Advocate
Advocate

Hey,

because the inventor-search is horrible i've made a search macro to find parts in big assemblys very fast. Here is the code:

It search for the following iproperties:

-Part Number

-Stock Number

-Description

-Vendor

 

Public oAllOccsCollection As ObjectCollection
Public oAllFolderNodesCollection As ObjectCollection
Public OccName As String
Public Found As Boolean
Public Sub Suche()
On Error Resume Next

Dim oAsmDoc As AssemblyDocument
Set oAsmDoc = ThisApplication.ActiveDocument
Dim oAsmCompDef As AssemblyComponentDefinition
Set oAsmCompDef = oAsmDoc.ComponentDefinition
Dim oPane As BrowserPane
Set oPane = oAsmDoc.BrowserPanes.ActivePane
Call oPane.TopNode.DoSelect
Dim oOccCollection As ObjectCollection
Set oOccCollection = ThisApplication.TransientObjects.CreateObjectCollection

'Public Variable oAllOccsCollection füllen
Call SearchAllOccs(oAsmDoc.ComponentDefinition.Occurrences, 1)

'Suchbegriff Eingabe
Dim UserInputUCase As String
UserInput = InputBox("Bitte geben sie den Suchbegriff ein:", "Suche", "")
UserInputUCase = UCase(UserInput)
If UserInput = vbCancle Then Exit Sub

'Alle BrowserNodes zuklappen
Call NodesZuklapeen

'Alle Occurrences durchsuchen
Dim oNode As BrowserNode
Dim oDoc As Document
Dim oOcc As ComponentOccurrence
For Each oOcc In oAllOccsCollection
    Set oNode = oPane.GetBrowserNodeFromObject(oOcc)
    Set oDoc = oOcc.Definition.Document
    If InStr(UCase(oDoc.PropertySets("Design Tracking Properties").Item("Part Number").value), UserInputUCase) Then
        Call oOccCollection.Add(oOcc)
        oNode.Parent.Expanded = True
    End If
    If InStr(UCase(oDoc.PropertySets("Design Tracking Properties").Item("Stock Number").value), UserInputUCase) Then
        Call oOccCollection.Add(oOcc)
        oNode.Parent.Expanded = True
    End If
    If InStr(UCase(oDoc.PropertySets("Design Tracking Properties").Item("Description").value), UserInputUCase) Then
        Call oOccCollection.Add(oOcc)
        oNode.Parent.Expanded = True
    End If
    If InStr(UCase(oDoc.PropertySets("Design Tracking Properties").Item("Vendor").value), UserInputUCase) Then
        Call oOccCollection.Add(oOcc)
        oNode.Parent.Expanded = True
    End If
Next


If oOccCollection.Count > 0 Then
    For Each oOcc In oOccCollection
        OccName = oOcc.Name
        Set oNode = oPane.GetBrowserNodeFromObject(oOcc)
        Call SearchNodesUp(oNode, 1)
    Next
End If

If oOccCollection.Count = 0 Then
    Mes = MsgBox("Kein Teil mit """ & UserInput & """ gefunden", vbOKOnly, "Hinweis")
    Exit Sub
End If

'Alle gefundenen Occurrences im Browser markieren
Call oAsmDoc.SelectSet.Clear
Call oAsmDoc.SelectSet.SelectMultiple(oOccCollection)
ThisApplication.CommandManager.ControlDefinitions.Item("GRxZoomSelCmd").Execute
If oOccCollection.Count = 1 Then Mes = MsgBox("Es wurde " & oOccCollection.Count & " Teil gefunden", vbOKOnly, "Hinweis")
If oOccCollection.Count > 1 Then Mes = MsgBox("Es wurden " & oOccCollection.Count & " Teile gefunden", vbOKOnly, "Hinweis")
End
End Sub
Public Function SearchAllOccs(Occurrences As ComponentOccurrences, Level As Integer)
    Dim oOcc As ComponentOccurrence
    If oAllOccsCollection Is Nothing Then
        Set oAllOccsCollection = ThisApplication.TransientObjects.CreateObjectCollection
    End If
    For Each oOcc In Occurrences
        Call oAllOccsCollection.Add(oOcc)
        If oOcc.DefinitionDocumentType = kAssemblyDocumentObject Then
            Call SearchAllOccs(oOcc.SubOccurrences, Level + 1)
        End If
    Next
End Function
Public Function SearchNodesUp(oNode As BrowserNode, Level As Integer)
    If oNode.Parent.Type <> kBrowserPaneObject Then
        Dim oParentNode As BrowserNode
        Set oParentNode = oNode.Parent
        Call SearchNodesDown(oParentNode.BrowserNodes, 1)
        Call oAllFolderNodesCollection.Clear
        Call SearchNodesUp(oParentNode, 1)
    End If
End Function
Public Function SearchNodesDown(oNodes As BrowserNodesEnumerator, Level As Integer)
    If oAllFolderNodesCollection Is Nothing Then
        Set oAllFolderNodesCollection = ThisApplication.TransientObjects.CreateObjectCollection
    End If
    Found = False
    Dim oNode As BrowserNode
    For i = 1 To oNodes.Count
        Set oNode = oNodes(i)
        If Not oNode.NativeObject Is Nothing Then
            If TypeOf oNode.NativeObject Is BrowserFolder _
            Or TypeOf oNode.NativeObject Is RectangularOccurrencePattern _
            Or TypeOf oNode.NativeObject Is RectangularOccurrencePatternProxy _
            Or TypeOf oNode.NativeObject Is CircularOccurrencePattern _
            Or TypeOf oNode.NativeObject Is CircularOccurrencePatternProxy _
            Or TypeOf oNode.NativeObject Is OccurrencePatternElement _
            Or TypeOf oNode.NativeObject Is OccurrencePatternElementProxy Then
                Call oAllFolderNodesCollection.Add(oNode)
                Call SearchNodesDown(oNode.BrowserNodes, 1)
            Else
                If TypeOf oNode.NativeObject Is ComponentOccurrence Then
                    If oNode.NativeObject.Name = OccName Then
                        Found = True
                        Dim oNode3 As BrowserNode
                        For Each oNode3 In oAllFolderNodesCollection
                            If oNode3.Expanded = False Then oNode3.Expanded = True
                        Next
                    End If
                End If
            End If
            If Found = False And i = oNodes.Count Then
                Call oAllFolderNodesCollection.Clear
            End If
        End If
    Next
End Function
Sub NodesZuklapeen()
Set oDoc = ThisApplication.ActiveEditDocument
Dim oTopNode As BrowserNode
Set oTopNode = oDoc.BrowserPanes.ActivePane.TopNode
Dim oNode As BrowserNode
For Each oNode In oTopNode.BrowserNodes
If oNode.Visible = True And oNode.Expanded = True Then
oNode.Expanded = False
End If
Next
End Sub

 

have fun!

Message 4 of 4

GeorgK
Advisor
Advisor

Great work.

 

@ Autodesk: you can provide from this code. It would be great to have a search function like google.

0 Likes