Hi @jaconoorland45, short version: the Sheet.ChangeLayer route WCrihfield described works, and the rule below does it, but it's about 4 times faster than curve by curve, not instant like the UI. It finds the component by its name (or its path, if it sits deeper) in the assembly, collects every line segment of it in all views of the active sheet, and moves them in one call to a copy of their layer with your color and weight. Each original layer gets its own copy, so hidden lines stay dashed.

On a test sheet about your size (a sub-assembly of 60 plates with 80 holes each, placed twice, plus one other part, 3 views) it moved 10,410 segments in about 30 s, rule start included; curve by curve took about 132 s on the same sheet. Your loop takes 30 minutes, mine 132 s, so something else may be slowing yours down too (machine, sheet, or how the loop is written): I can't promise your seconds, only the ratio. About two thirds of the time goes into reading the segments, and that part the ChangeLayer call doesn't save. The picture is a smaller example, a tank agitator on its frame, same rule (orange there is red in the drawing).
About the why: I can't see inside the UI, but my guess is that it stores the color and weight on the component in the view, as one setting, without touching the curves. As far as I can tell, 2023 has no API for that kind of setting, so code has to read the curves first. Inventor 2025.1 added one (DrawingView.SetComponentLineColor, color only): on the same big sheet it took 0.16 s, close to your 1 s in the UI. If you upgrade, that's instant for the color; the weight still needs the layer rule.
' Moves every line of one component (part or sub-assembly, at any level) to its own layer, in every view of the active sheet.
' Sheet.ChangeLayer moves a whole collection in one call, instead of editing the curves one by one.
' Each original layer (visible, hidden...) gets its own copy, so hidden lines stay dashed.
Dim sOccPath As String = "AGITATOR:1" ' CHANGE: component as shown in the assembly browser; if it sits inside
' another sub-assembly, the whole path with "/", e.g. "MIXER:1/AGITATOR:1"
Dim iRed As Integer = 255 ' CHANGE: line color (red, green, blue 0-255)
Dim iGreen As Integer = 0
Dim iBlue As Integer = 0
Dim dWeightCm As Double = 0.07 ' CHANGE: line weight in cm (0.07 = 0.7 mm)
Dim sSuffix As String = " - " & sOccPath.Replace("/", " > ") ' new layers: "<original layer> - <component path>"
Dim oDrawDoc As DrawingDocument = ThisDoc.Document
Dim oSheet As Sheet = oDrawDoc.ActiveSheet
Dim oColor As Inventor.Color = ThisApplication.TransientObjects.CreateColor(iRed, iGreen, iBlue)
Dim oGroups As New Dictionary(Of String, ObjectCollection)
Dim aPath() As String = sOccPath.Split("/"c)
Dim iCount As Integer = 0
For Each oView As DrawingView In oSheet.DrawingViews
Dim oOcc As ComponentOccurrence = Nothing
Dim oCurves As DrawingCurvesEnumerator = Nothing
Try
Dim oAsmDoc As AssemblyDocument = oView.ReferencedDocumentDescriptor.ReferencedDocument
oOcc = oAsmDoc.ComponentDefinition.Occurrences.ItemByName(aPath(0))
For i As Integer = 1 To aPath.Length - 1 ' walk down the path, one level at a time
Dim oNext As ComponentOccurrence = Nothing
For Each oSub As ComponentOccurrence In oOcc.SubOccurrences
If oSub.Name = aPath(i) Then
oNext = oSub
Exit For
End If
Next
If oNext Is Nothing Then Throw New Exception(aPath(i) & " not found")
oOcc = oNext
Next
oCurves = oView.DrawingCurves(oOcc)
Catch
Continue For ' view of another model, or the component is not in this view
End Try
For Each oCurve As DrawingCurve In oCurves
For Each oSeg As DrawingCurveSegment In oCurve.Segments
Dim sLayer As String = oSeg.Layer.Name
If sLayer.EndsWith(sSuffix) Then Continue For ' already moved by an earlier run
If Not oGroups.ContainsKey(sLayer) Then
oGroups.Add(sLayer, ThisApplication.TransientObjects.CreateObjectCollection)
End If
oGroups(sLayer).Add(oSeg)
iCount += 1
Next
Next
Next
For Each sLayer As String In oGroups.Keys
Dim oNewLayer As Layer = Nothing
Try
oNewLayer = oDrawDoc.StylesManager.Layers.Item(sLayer & sSuffix)
Catch
oNewLayer = oDrawDoc.StylesManager.Layers.Item(sLayer).Copy(sLayer & sSuffix)
End Try
oNewLayer.Color = oColor
oNewLayer.LineWeight = dWeightCm
oSheet.ChangeLayer(oGroups(sLayer), oNewLayer)
Next
Logger.Info(iCount & " line segments of " & sOccPath & " moved to " & oGroups.Count & " layer(s)")
Change sOccPath to your sub-assembly as it shows in the browser, plus the color and the weight. If it sits inside another sub-assembly, put the whole path, like MIXER:1/AGITATOR:1. I tried that one level down too (two copies of the same assembly, each with the same sub-assembly inside): only the copy in the path changed, the one with the same name in the other copy kept its lines. Running it a second time on the same sheet moves nothing and adds no layers, and the copy of the same sub-assembly next to it stays as it was.
I ran it in Inventor 2025. The API help lists ChangeLayer since 2011, so 2023 should have it, but I haven't tried this rule in 2023.
I wrote it up with the measurements here: https://steptocut.com/blog/inventor-drawing-change-line-color-ilogic/
If more of your drawing cleanup ends up in rules, feel free to ask.
Written with Claude (AI), tested in Inventor 2025 on the test sheet above.