VBA code to change level of detail representation of assembly occurrences

Eyal.Admon
Contributor
Contributor

VBA code to change level of detail representation of assembly occurrences

Eyal.Admon
Contributor
Contributor

Hello,

 

I need to change  to change level of detail representation of certain occurrences in an assembly.

the occurrence is currently suppressed and need to change to LOD "all components suppressed"

 

Thanks in advance,

Eyal

 

 

0 Likes
Reply
Accepted solutions (1)
274 Views
3 Replies
Replies (3)

bradeneuropeArthur
Mentor
Mentor

Hi,

 

You want to change the LOD from sub-assemblies in a assembly, correct?

What version of Inventor are you using?

What specific occurrences do you want to change?

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

0 Likes

Eyal.Admon
Contributor
Contributor

Hi Arthur, 

Thank you for your reply . 

I'm currently using inventor 2019. 

I'm aware that when I will upgrade, I'll have to modify my code. 

 

I currently have a script that iterates through all the occurrences in an assembly document and looking for a specific one by name.

I managed to unsuppress an occurrence but not change to a specific LOD..

 

 

Thanks

Eyal 

0 Likes

Eyal.Admon
Contributor
Contributor
Accepted solution

never mind, found out how.

her's the code:

Sub SET_LOD()

Dim oDoc As AssemblyDocument
Dim oComps As ComponentOccurrences
Dim oComp As ComponentOccurrence
Dim LOD As String
Set oDoc = ThisApplication.ActiveDocument
Set oComps = oDoc.ComponentDefinition.Occurrences

LOD = "All Parts Suppressed"

For Each oComp In oComps
  If oComp.Definition.Document.File.FullFileName = FilePath Then
   Call oComp.SetLevelOfDetailRepresentation(LOD, False)
  End If
Next

End Sub

 

 

0 Likes