If a file name has a phrase in it

If a file name has a phrase in it

AMN3161
Advocate Advocate
507 Views
2 Replies
Message 1 of 3

If a file name has a phrase in it

AMN3161
Advocate
Advocate

morning everyone

 

Anyone have a chunk of code that will trigger if a level of detail has a phrase in it? Like I want something to happen if a level of detail in a assembly has the word "Major" in it.

 

So it will trigger when the level of detail says

 

Major BOM

Major Spool 1

Major Spool 2

Major Spool 3

 

and so on

0 Likes
Accepted solutions (1)
508 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor
Accepted solution

Something similar to this?

Dim oADoc As AssemblyDocument = ThisAssembly.Document
Dim oADef As AssemblyComponentDefinition = oADoc.ComponentDefinition
For Each oLOD As LevelOfDetailRepresentation In oADef.RepresentationsManager.LevelOfDetailRepresentations
	If oLOD.Name.Contains("Major") Then
		'do what you want here
	End If
Next

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click 'LIKE' 👍.

Vote For My IDEAS 💡and Explore My CONTRIBUTIONS

Inventor 2020 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3

AMN3161
Advocate
Advocate

outstanding, thank you!

0 Likes