How Can I active a LOD (Level of Detail) with iLogic?

How Can I active a LOD (Level of Detail) with iLogic?

王承之pmhker
Advisor Advisor
906 Views
3 Replies
Message 1 of 4

How Can I active a LOD (Level of Detail) with iLogic?

王承之pmhker
Advisor
Advisor

I create some LOD in assembly, and i want activate one of them with ilogic,how can i do ?


If my post answers your question, please click the "Accept as Solution" button. This helps everyone find answers more quickly!
如果我的回帖解决了您的问题,请点击 "接受为解决方案" 按钮. 这可以帮助其他人更快的找到解决方案!


王 承之
Autodesk AGN [Inventor 俱乐部] Leader
Inventor Club | Bilibili


AGN L    EESignature

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

Sergio.D.Suárez
Mentor
Mentor
Accepted solution

Hi, try this ilogic code, it is a way to show how you can access the LOD.

Dim oDoc As AssemblyDocument = ThisDoc.Document  
Dim oDef As ComponentDefinition = oDoc.ComponentDefinition 

Dim ActLOD As String = oDef.RepresentationsManager.ActiveLevelOfDetailRepresentation.name

Dim oList As New ArrayList

For i As Integer = 1 To oDef.RepresentationsManager.LevelOfDetailRepresentations.count
	oList.Add( oDef.RepresentationsManager.LevelOfDetailRepresentations(i).name)
Next

oValue = InputListBox("Select LOD", oList, ActLOD, "Ilogic - LOD", "Available Selections")

oDef.RepresentationsManager.LevelOfDetailRepresentations.Item(oValue).Activate(True)

 I hope this can help you develop your own code.
regards


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 3 of 4

王承之pmhker
Advisor
Advisor

Thanks very much,your answer is exactly what i need.


If my post answers your question, please click the "Accept as Solution" button. This helps everyone find answers more quickly!
如果我的回帖解决了您的问题,请点击 "接受为解决方案" 按钮. 这可以帮助其他人更快的找到解决方案!


王 承之
Autodesk AGN [Inventor 俱乐部] Leader
Inventor Club | Bilibili


AGN L    EESignature

0 Likes
Message 4 of 4

Guido.LangeTuchscherer
Enthusiast
Enthusiast

@Sergio.D.Suárez 

Hi there, do some of you maybe know how to decifer if a level of detail actually exists?

 

Just after suppressing a part in an assembly, I can get the active LOD and then my way was to use Try (Catch) to activate the LOD (if existing), which unfortunately always succeeds, it just writes a new actual one. When the active LOD actually exists there is no problem, but when there only is a temporary one it will generate new LOD everytime I save.

 

Dim asDoc As AssemblyDocument = ThisDoc.Document
aComp = asDoc.ComponentDefinition

'Position der Detailgenauigkeit erfassen
Dim ActLOD As String = aComp.RepresentationsManager.ActiveLevelOfDetailRepresentation.Name

Try aComp.RepresentationsManager.LevelOfDetailRepresentations.Item(ActLOD).Activate(True) 'MsgBox(ActLOD & " gesetzt") Catch AcLOD = "TempDetailgenauigkeit" 'MsgBox(AcLOD & " erstellt") 'Finally aComp.RepresentationsManager.LevelOfDetailRepresentations.Add(AcLOD) 'MsgBox(AcLOD & " aktiviert") End Try 

 

I got the issue in different words here: https://forums.autodesk.com/t5/inventor-customization/setting-representation-level-of-detail-fails-d...

0 Likes