Search part of a filename with iLogic

Search part of a filename with iLogic

Rob67ert
Collaborator Collaborator
1,044 Views
2 Replies
Message 1 of 3

Search part of a filename with iLogic

Rob67ert
Collaborator
Collaborator

Hi,

 

I like to get a parameter from a part in an assembly.

But I only know one part of the filename or the partnumber.

 

How do i get that solved?

Robert

If you find this reply helpful ? It would be nice if you use the Accept as Solution or Kudos button below.
0 Likes
Accepted solutions (1)
1,045 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Accepted solution

You can use .Expression or .Value depending on how you want to use the parameter. Bear in mind there's no error testing in the code to see if the parameter exists or not, so you will get an error if it doesn't exist.

 

' Get the component definition of the currently open assembly.

' This will fail if an assembly document is not open.

Dim doc As AssemblyDocument

doc = ThisDoc.Document

 

Dim oAsmCompDef As AssemblyComponentDefinition

oAsmCompDef = doc.ComponentDefinition

 

Dim oComp As ComponentOccurrence

 

Dim oComps As ComponentOccurrences

oComps = doc.ComponentDefinition.Occurrences

 

For Each oComp In oComps

     If oComp.Name.Contains("part of the part number") Then

        value = oComp.Definition.Parameters.Item("myparam").Expression

     End If

Next

0 Likes
Message 3 of 3

Rob67ert
Collaborator
Collaborator
Thanks 🙂
Robert

If you find this reply helpful ? It would be nice if you use the Accept as Solution or Kudos button below.
0 Likes