Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Rob67ert
990 Views, 2 Replies

Search part of a filename with iLogic

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.
Tags (1)
Anonymous
in reply to: Rob67ert

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

Rob67ert
in reply to: Anonymous

Thanks :slightly_smiling_face:
Robert

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