Rule to switch between view reps and switch between levels of detail

Rule to switch between view reps and switch between levels of detail

ASchlaack
Collaborator Collaborator
439 Views
3 Replies
Message 1 of 4

Rule to switch between view reps and switch between levels of detail

ASchlaack
Collaborator
Collaborator

Can I please get a rule to switch between view reps and levels of detail?

 

Example of how I'll use it:

 

Select Case Paremeter
   Case = 1
      View Rep = View 1
Next
   Case = 2
      View Rep = View 2
Next

End Select


OR


Select Case Paremeter
   Case = 1
      Level of Detail = Level 1
Next
   Case = 2
      Level of Detail = Level 2
Next

End Select
Thanks,
Aaron Schlaack
---------------------------------------------------------------------------------
Autodesk Inventor 2018
Dell Windows 8.1 64 bit Intel(R) Xeon(R) @ 3.50GHz 32GB Ram
0 Likes
440 Views
3 Replies
Replies (3)
Message 2 of 4

MechMachineMan
Advisor
Advisor

API Help. RepresentationsManager.

 

It would be way faster for you if you actually learned how to use the other resources and weren't completely dependant on forums/ just plain old lazy.


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 3 of 4

ASchlaack
Collaborator
Collaborator
I use that, I post on here what I can't find out on my own.
Thanks,
Aaron Schlaack
---------------------------------------------------------------------------------
Autodesk Inventor 2018
Dell Windows 8.1 64 bit Intel(R) Xeon(R) @ 3.50GHz 32GB Ram
0 Likes
Message 4 of 4

Vladimir.Ananyev
Alumni
Alumni

My advice is to test your ideas with representations in the Inventor VBA invironment that is good for the debugging. Then you may quite easily migrate your code to iLogic.

Here is the vba code snippet that prints the list of the available LODs and then activates one of them existing LODs:

Sub ChangeLOD()

    Dim oAsmDoc As Inventor.AssemblyDocument
    Set oAsmDoc = ThisApplication.ActiveDocument
    
    ' Get assembly component definition
    Dim oAsmDef As Inventor.ComponentDefinition
    Set oAsmDef = oAsmDoc.ComponentDefinition
    
    Dim oRepMgr As RepresentationsManager
    Set oRepMgr = oAsmDef.RepresentationsManager
    
    Dim oLODs As LevelOfDetailRepresentations
    Set oLODs = oRepMgr.LevelOfDetailRepresentations
    
    Dim oLOD As LevelOfDetailRepresentation
    For Each oLOD In oLODs
        Debug.Print oLOD.name
    Next
    
    Dim name As String

    Dim n As Integer
    n = 2

    Select Case n
        Case 1
            name = "BOTTOM"
        Case 2
            name = "TOP"
        Case Else
            name = "Master"
    End Select
    
    Set oLOD = oLODs.Item(name)
    oLOD.Activate
    
    Beep
End Sub

Cheers,


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

0 Likes