<?xml encoding=”UTF-8″>By Adam Nagy
If you need to find all the sketch entities that are not used then you can simply iterate through the sketches and their entities and check which ones are not part of a profile yet:
Public Sub HighlighUncosumedSketchEntities()
Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oSel As SelectSet
Set oSel = oDoc.SelectSet
Dim oSketches As PlanarSketches
Set oSketches = oDoc.ComponentDefinition.Sketches
Dim oUnconsumed As ObjectCollection
Set oUnconsumed = <br> ThisApplication.TransientObjects.CreateObjectCollection
Dim oSketch As PlanarSketch
For Each oSketch In oSketches
' First collect all the sketch entities<br> Dim oEnt As SketchEntity
For Each oEnt In oSketch.SketchEntities
Call oUnconsumed.Add(oEnt)
Next
' If the sketch is consumed then some of its
' entities are already used for something
' so we need to remove those from the collection
If oSketch.Consumed Then
Dim oProfile As Profile
For Each oProfile In oSketch.Profiles
Dim oPath As ProfilePath
For Each oPath In oProfile
Dim oPEnt As ProfileEntity
For Each oPEnt In oPath
Call oUnconsumed.RemoveByObject( _<br> oPEnt.SketchEntity)
Next
Next
Next
End If
Next
Call oSel.SelectMultiple(oUnconsumed)
End Sub

Leave a Reply