CreateHighlightSet on sub-assembly geometry

CreateHighlightSet on sub-assembly geometry

Anonymous
Not applicable
358 Views
1 Reply
Message 1 of 2

CreateHighlightSet on sub-assembly geometry

Anonymous
Not applicable

Hi All,

Just looking for a pointer on creating a highlight set on a component occurrence within a sub-assembly.

 

What I am doing is getting the entities attached to a constraint in the sub assembly and trying to highlight the geometry to show the user which faces etc. are involved in the constraint.

 

I have tried several different ways of creating a proxy object but it throws an error every time. I had thought I was creating the proxy at the wrong level but I've tried calling the 'CreateGeometryProxy' method on the main assembly, sub assembly, leaf occurrence but nothing seems to work.

 

Please advise on the correct procedure given the model below. I would like to highlight face A and B while in the Main Assembly

 

 

Main Assembly

     Sub Assembly

         Leaf Occurrence One

             Face A

         Leaf Occurrence Two

             Face B

 

oHighlightSet = InventorApplication.ActiveDocument.CreateHighlightSet
oHighlightSet.Color = InventorApplication.TransientObjects.CreateColor(255, 0, 0)
Dim oTemp As Object
Dim oCompTemp As ComponentOccurrence
Dim oGeomTemp As Object
oGeomTemp = oConstraint.EntityOne
oGeomTemp = oGeomTemp.NativeObject
oCompTemp = oConstraint.Parent
oCompTemp.CreateGeometryProxy(oGeomTemp, oTemp)
oHighlightSet.AddItem(oTemp)
oCompTemp = oConstraint.Parent
oCompTemp.CreateGeometryProxy(oGeomTemp, oTemp)
oHighlightSet.AddItem(oTemp)

 

Thanks in advance

Phil

0 Likes
359 Views
1 Reply
Reply (1)
Message 2 of 2

COLINBRUSCHI
Enthusiast
Enthusiast

This is an old post, but since it went unanswered and I recently wanted the same outcome...

 

 

For Each compOccurrence As ComponentOccurrence In docOccurrences    'get all top level occurrences

If compOccurrence.DefinitionDocumentType = DocumentTypeEnum.kPartDocumentObject Then

    For Each oEdge As Edge In compOccurrence.SurfaceBodies(1).Edges 'get all edges if its a part
        oEdgeCollection.Add(oEdge)
    Next

ElseIf compOccurrence.DefinitionDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then     'first get all parts, then get all edges of those parts

    Dim occurrenceDoc As AssemblyDocument = compOccurrence.Definition.Document
    Dim oEdgeProxy As EdgeProxy     'proxy between subassembly geometry and top level assembly

    For Each subOccurrence As ComponentOccurrence In occurrenceDoc.ComponentDefinition.Occurrences  'get all subassembly parts

        If subOccurrence.DefinitionDocumentType = DocumentTypeEnum.kPartDocumentObject Then     'must be a part doc

            For Each oEdge As Edge In subOccurrence.SurfaceBodies(1).Edges  'get all edges of part

                Call compOccurrence.CreateGeometryProxy(oEdge, oEdgeProxy)  'create proxy
                oEdgeCollection.Add(oEdgeProxy)

            Next
        End If
    Next
End If
Next

 

 

0 Likes