How about some code (vb.net)
Public Sub SetComponentsReference()
Dim strComponent As String = InputBox("Insert Component Name")
Dim strLayer As String = InputBox("Enter in layer to use:", "Change Component Layer", "Reference (ANSI)")
Dim layer As Inventor.Layer = Nothing
If Not String.IsNullOrEmpty(strComponent) Then
GetInventorApplication()
If invApp IsNot Nothing Then
If invApp.ActiveDocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
Dim invdoc As Inventor.DrawingDocument = invApp.ActiveDocument
Dim trans As Inventor.Transaction = invApp.TransactionManager.StartTransaction(invdoc, "Change Componet Layer")
For Each mlayer As Inventor.Layer In invdoc.StylesManager.Layers
If mlayer.Name = "Reference (ANSI)" Then
layer = mlayer
Exit For
End If
Next
If layer IsNot Nothing Then
For Each mSheet As Inventor.Sheet In invdoc.Sheets
MsgBox(mSheet.Name & " Start")
Dim ioc As Inventor.ObjectCollection = invApp.TransientObjects.CreateObjectCollection
For Each drView As Inventor.DrawingView In mSheet.DrawingViews
Dim vdoc As Inventor.Document = drView.ReferencedDocumentDescriptor.ReferencedDocument
If vdoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
Dim aDoc As Inventor.AssemblyDocument = vdoc
GetComponentSegments(strComponent, drView, aDoc.ComponentDefinition.Occurrences, ioc)
End If
Next
mSheet.ChangeLayer(ioc, layer)
mSheet.Update()
MsgBox(mSheet.Name & " Updated")
Next
End If
trans.End()
End If
End If
End If
End Sub
sets components to a layer (create a custom layer of your own, and change code to default to it). Components found in all views of all sheets of active document (by component occurrence name) aka load.ipt has occurrence name "load:1". We use this to isolate components graphically without changing BOM properties. Same can be done manually by right-clicking on object in view browser, and choosing select as edges, then changing layer.
Jamie Johnson : Owner / Sisu Lissom, LLC https://sisulissom.com/