Inventor Customization

Reply
Active Member
adrianburns
Posts: 6
Registered: ‎01-11-2008
Message 1 of 3 (279 Views)
Accepted Solution

Highlighting Parts in Sub-Assmeblies

279 Views, 2 Replies
10-16-2012 07:56 AM

Guys,

 

I'm having a problem highlighting parts within a sub assembly.  A simple structure to demonstarte this issue would be:

 

TopLevel.iam

         |

        SubAssy.iam

                 |

                 ChildPart1.ipt

                 ChildPart2.ipt

 

Using this structure I wish to highligh ChildPart1.ipt, howver my vba macro code below doesn't seem to work (nothing happens):

 

    Public Sub Highlight()
        Dim SubAssy As Inventor.AssemblyDocument
        Dim ChildPart1 As Inventor.ComponentOccurrence
        Dim highlightSet As Inventor.highlightSet
       
        Set SubAssy = ThisApplication.ActiveDocument.ReferencedDocuments(1)
        Set ChildPart1 = SubAssy.ComponentDefinition.Occurrences(1)
       
        Set highlightSet = SubAssy.CreateHighlightSet()
       
        highlightSet.Color = ThisApplication.TransientObjects.CreateColor(255, 255, 255)
        highlightSet.Color.Opacity = 0.8
       
        highlightSet.AddItem ChildPart1
    End Sub

 

Can anyone provide any help? 

 

Many thanks,

 

Adrian.

Active Member
adrianburns
Posts: 6
Registered: ‎01-11-2008
Message 2 of 3 (253 Views)

Re: Highlighting Parts in Sub-Assmeblies

10-18-2012 01:40 AM in reply to: adrianburns

Anyone got any ideas?  I still can't seem to get this working, in a nutshell I just want the highlighting to work as it does in the Model browser, when you hover over an item in the model browser it highlights it in the assembly even if its within a sub-assembly...

 

Again, any help would be greatly appreciated.

 

Active Member
adrianburns
Posts: 6
Registered: ‎01-11-2008
Message 3 of 3 (244 Views)

Re: Highlighting Parts in Sub-Assmeblies

10-18-2012 06:44 AM in reply to: adrianburns

If anyone is interested (or facing the same issue) I've figured out the answer.  You need to add component occurence proxy objects to the highlightset not the sub component occurence objects themselves.  This can be done by first returning the component occurences from the root assembly then returning the suboccurences from those.

 

e.g.

 

Dim topHighlightSet As Inventor.highlightSet

Public Sub Highlight()
    Dim topLevel As Inventor.AssemblyDocument
    Dim subAssy As Inventor.ComponentOccurrence
    Dim childPart1Occurence As Inventor.ComponentOccurrenceProxy
    
    Set topLevel = ThisApplication.ActiveDocument
    Set subAssy = topLevel.ComponentDefinition.Occurrences.Item(1)
    Set childPart1Occurence = subAssy.SubOccurrences(1)
    
    Set topHighlightSet = topLevel.CreateHighlightSet()

    topHighlightSet.Color = ThisApplication.TransientObjects.CreateColor(255, 255, 255)
    topHighlightSet.Color.Opacity = 0.8
    topHighlightSet.AddItem childPart1Occurence
    
End Sub

 

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube