I'm going to throw some stuff at you that may or may not help!
https://forums.autodesk.com/t5/inventor-customization/default-view-label-characters/m-p/5930091#M601...
https://forums.autodesk.com/t5/inventor-customization/max-point-of-section-line/m-p/6024011#M61451
Here's my iLogic code that relabels all drawing views A B C D then replaces the drawing view label with a custom sketch symbol. It's not linked, so you have to re-run the rules to get the labels to change. Thanks to MechMachineMan for his help.
Brandon
Sub Main()
Dim oDrawing As DrawingDocument
oDrawing = ThisApplication.ActiveDocument
Dim oSheets As Sheets
oSheets = oDrawing.Sheets
Dim iSheetCount As Integer
iSheetCount = oSheets.Count
Dim oSheet As Sheet
Dim oPreviousSheet As Sheet
Dim oView As DrawingView
Dim oViews As DrawingViews
Dim oPreviousViews As DrawingViews
Dim oViewSheet As Sheet
Dim oParentView As DrawingView
Dim oParentViewSheet As Sheet
Dim oParentViewSheetName As String
Dim oViewSheetName As String
Dim oParentColonIndex As Integer
Dim oViewColonIndex As Integer
Dim oParentViewSheetNameLength As Integer
Dim oViewSheetNameLength As Integer
Dim oParentViewSheetIndex As String
Dim oViewSheetIndex As String
Dim oSketchSym As SketchedSymbol
Dim oSketchSymLib As SketchedSymbolDefinitionLibrary
oSketchSymLib = oDrawing.SketchedSymbolDefinitions.SketchedSymbolDefinitionLibraries.Item("Library")
Dim oCallOut As SketchedSymbolDefinition
oCallOut = oDrawing.SketchedSymbolDefinitions.AddFromLibrary(oSketchSymLib, "CallOut", True)
Dim oCallOutArrow As SketchedSymbolDefinition
oCallOutArrow = oDrawing.SketchedSymbolDefinitions.AddFromLibrary(oSketchSymLib, "CallOutArrow", True)
Dim oViewLabel As SketchedSymbolDefinition
oViewLabel = oDrawing.SketchedSymbolDefinitions.AddFromLibrary(oSketchSymLib, "ViewLabel", True)
Dim oTransGeom As TransientGeometry
oTransGeom = ThisApplication.TransientGeometry
sViewLabels = New String(){"A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","T","U","V","W","X","Y","Z","AA","AB","AC","AD","AE","AF","AG","AH","AJ","AK","AL","AM","AN","AP","AR","AT","AU","AV","AW","AX","AY","AZ"}
Dim iViewCount = 0
Dim oDrawingIProps As PropertySets
oDrawingIProps = oDrawing.PropertySets
Dim oDrawingCustomIProps As PropertySet 'point to Custom iProperties'
oDrawingCustomIProps = oDrawingIProps.Item("Inventor User Defined Properties")
Dim oPosition As Point2d
Dim oRotation As Double
Dim oViewLabelPosition As Point2d
Dim oOffsetFromBaseView As Double
Dim sPromptFieldsCallOut(1) As String
Dim sPromptFieldsViewLabel(3) As String
iLogicVb.RunExternalRule("dwgRenumberSheets") 'confirms that the iProperties for the page numbers are created
For i = 1 to iSheetCount
oSheet = oSheets.Item(i)
'deletes existing call outs since we can't update them
For Each oSketchSym In oSheet.SketchedSymbols
Select Case oSketchSym.Name
Case "CallOut"
oSketchSym.Delete
Case "CallOutArrow"
oSketchSym.Delete
Case "ViewLabel"
oSketchSym.Delete
End Select
Next 'next sketched symbol'
Next
'assuming there are no drawing views on sheet 1
For i = 2 To iSheetCount
oSheet = oSheets.Item(i)
'MessageBox.Show(i,"Sheet")
oPreviousSheet = oSheets.Item(i-1)
Try 'catches errors if there are no views on a sheet
oViews = oSheet.DrawingViews
oPreviousViews = oPreviousSheet.DrawingViews
oViews.Item(1).ShowLabel = False 'turns OFF the label for the first view
Catch
End Try
If oViews.Count() <> 0 And oPreviousViews.Count() <> 0 Then
If oViews.Item(1).ReferencedDocumentDescriptor.DisplayName <> oPreviousViews.Item(1).ReferencedDocumentDescriptor.DisplayName Then
iViewCount = 0
For Each oView In oViews
oView.Name = sViewLabels(iViewCount)
iViewCount = iViewCount + 1
Next
ElseIf oViews.Item(1).ReferencedDocumentDescriptor.DisplayName = oPreviousViews.Item(1).ReferencedDocumentDescriptor.DisplayName Then
For Each oView In oViews
oView.Name = sViewLabels(iViewCount)
iViewCount = iViewCount + 1
Next
End If
ElseIf oViews.Count() <> 0 And oPreviousViews.Count() = 0 Then
iViewCount = 0
For Each oView In oViews
oView.Name = sViewLabels(iViewCount)
iViewCount = iViewCount + 1
Next
ElseIf oViews.Count() = 0 Then
End If
Try '9/1/2016
For Each oView in oSheet.DrawingViews
oViewSheet = oView.Parent
oParentView = oView.ParentView
If (oView.ViewType = 10501 And oParentView Is Nothing) Or (oView Is oViewSheet.DrawingViews.Item(1)) Then 'kStandardDrawingViewType'
sPromptFieldsViewLabel(0) = oView.Name
sPromptFieldsViewLabel(1) = oView.ReferencedDocumentDescriptor.ReferencedDocument.PropertySets.Item("Design Tracking Properties").Item("Stock Number").Value & " " & oView.ReferencedDocumentDescriptor.ReferencedDocument.PropertySets.Item("Design Tracking Properties").Item("Description").Value
sPromptFieldsViewLabel(2) = "SCALE " & oView.ScaleString
sPromptFieldsViewLabel(3) = ""
oOffsetFromBaseView = 2.5 'arbitrary distance'
oViewLabelPosition = oTransGeom.CreatePoint2d(oView.Position.X, oView.Position.Y - (oView.Height/2) - oOffsetFromBaseView)
oSketchSym = oViewSheet.SketchedSymbols.Add(oViewLabel, oViewLabelPosition, 0, 1, sPromptFieldsViewLabel)
End If
If oParentView IsNot Nothing Then
oParentViewSheet = oParentView.Parent
oParentViewSheetName = oParentViewSheet.Name
oViewSheetName = oViewSheet.Name
oParentColonIndex = oParentViewSheetName.IndexOf(":")
oViewColonIndex = oViewSheetName.IndexOf(":")
oParentViewSheetNameLength = Len(oParentViewSheetName)
oViewSheetNameLength = Len(oParentViewSheetName)
oParentViewSheetIndex = Right(oParentViewSheetName, oParentViewSheetNameLength - oParentColonIndex - 1)
oViewSheetIndex = Right(oViewSheetName, oViewSheetNameLength - oViewColonIndex - 1)
Dim sPropName As String
sPropName = "SheetNumber" & oParentViewSheetIndex
'oView.ShowLabel = True 'turns on view label for child view on other sheet
Dim oViewType As String
Select Case oView.ViewType
Case 10502
oViewType = "DETAIL "
Case 10503
oViewType = "SECTION "
Case Else
oViewType = "VIEW "
End Select
oView.ShowLabel = False
If oView.Parent IsNot oParentView.Parent Or oViewType <> "VIEW " Then
sPromptFieldsViewLabel(0) = oView.Name
sPromptFieldsViewLabel(1) = oView.ReferencedDocumentDescriptor.ReferencedDocument.PropertySets.Item("Design Tracking Properties").Item("Stock Number").Value & " " & oView.ReferencedDocumentDescriptor.ReferencedDocument.PropertySets.Item("Design Tracking Properties").Item("Description").Value
sPromptFieldsViewLabel(2) = "SCALE " & oView.ScaleString
sPromptFieldsViewLabel(3) = oViewType & "FROM " & oParentView.Name & " " & oDrawingCustomIProps.Item(sPropName).Value()
oOffsetFromBaseView = 2.5 'arbitrary distance'
oViewLabelPosition = oTransGeom.CreatePoint2d(oView.Position.X, oView.Position.Y - (oView.Height/2) - oOffsetFromBaseView)
oSketchSym = oViewSheet.SketchedSymbols.Add(oViewLabel, oViewLabelPosition, 0, 1, sPromptFieldsViewLabel)
End If
Dim oViewVector As Vector
Dim oParentViewVector As Vector
Dim oParentViewUpVector As Vector
Dim oCrossVector As Vector
oViewVector = GetViewVector(oView)
oParentViewVector = GetViewVector(oParentView)
oParentViewUpVector = oParentView.Camera.UpVector.AsVector
oCrossVector = oParentViewUpVector.CrossProduct(oViewVector)
oRotation = NormalizeAngle(oParentViewUpVector.AngleTo(oViewVector), False)
If oViewVector.IsParallelTo(oParentViewUpVector) And oRotation = PI Then
oAngle = 0
ElseIf oViewVector.IsParallelTo(oParentViewUpVector) And oRotation = 0 Then
oAngle = PI
Else
oCrossVector.Normalize
oParentViewVector.Normalize
If oCrossVector.IsEqualTo(oParentViewVector, .000087266)'.005)
oAngle = oRotation + PI
Else
oAngle = oRotation
End If
End If
If oView.ViewType() = 10504 And oViewSheet IsNot oParentViewSheet Then 'projected view
oOffsetFromBaseView = 1.25 'a completely arbitrary distance
If oAngle = 1.5*PI Then
oPosition = oTransGeom.CreatePoint2d(oParentView.Position.X - (oParentView.Width)/2 - oOffsetFromBaseView, oParentView.Position.Y)
ElseIf oAngle = 0.5*PI Then
oPosition = oTransGeom.CreatePoint2d(oParentView.Position.X + (oParentView.Width)/2 + oOffsetFromBaseView, oParentView.Position.Y)
ElseIf oAngle = 0 Then
oPosition = oTransGeom.CreatePoint2d(oParentView.Position.X, oParentView.Position.Y - (oParentView.Height/2) - oOffsetFromBaseView) 'place call out below view
'oParentView.Label.Position = oTransGeom.CreatePoint2d(oParentView.Position.X, oParentView.Position.Y - (oParentView.Height/2) - 2*oOffsetFromBaseView) ??I can't remember what this does
ElseIf oAngle = PI Then
oPosition = oTransGeom.CreatePoint2d(oParentView.Position.X, oParentView.Top + oOffsetFromBaseView) 'place call out above view
End If
sPromptFieldsCallOut(0) = oView.Name
sPropName = "SheetNumber" & oViewSheetIndex
sPromptFieldsCallOut(1) = oDrawingCustomIProps.Item(sPropName).Value()
oSketchSym = oParentViewSheet.SketchedSymbols.Add(oCallOutArrow, oPosition, oAngle, 1, sPromptFieldsCallOut)
oSketchSym = oParentViewSheet.SketchedSymbols.Add(oCallOut, oPosition, 0, 1, sPromptFieldsCallOut)
ElseIf oView.ViewType() = 10503 Then 'section view
'MessageBox.Show(oRotation, oView.Name)
'MessageBox.Show(oAngle, oView.Name)
MessageBox.Show (oView.Name, oParentView.Name)
oView.ShowEntireLine = True
'oView.ScaleFromBase = True 'I took this out so it doesn't rescale the section views BG
Dim oParentViewPosition As Point2d
oParentViewPosition = oParentView.Center
Dim oSecLine As DrawingSketch
oSecLine = oView.SectionLineSketch
Dim oSketchLine As SketchLine
Dim oCallOutPosition As Point2d
Dim oCallOutOffset As Double
Dim oCallOutOffsetVector As Vector2d
oCallOutOffset = 0.4445 'from the radius of the sketched symbol
'oRotation = NormalizeAngle(oParentViewUpVector.AngleTo(oViewVector), False)
For Each oSketchLine In oSecLine.SketchLines
If oSketchLine.Reference = False Then
'Dim oDirection As UnitVector2d
'oDirection = oSketchLine.Geometry.Direction
'Dim oZeroAngle As UnitVector2d
'oZeroAngle = oTransGeom.CreateUnitVector2d(0,1) 'setting 12:00 to the 0 degree rotation base
'find the highest or rightest point, not the maxpoint'
Dim oSecLineStart As Point2d
Dim oSecLineEnd As Point2d
oSecLineStart = oSketchLine.StartSketchPoint.Geometry
oSecLineEnd = oSketchLine.EndSketchPoint.Geometry
If oSecLineStart.X > oSecLineEnd.X And oSecLineStart.Y > oSecLineEnd.Y Then 'down to left
oPosition = oSecLineStart
oCallOutOffsetVector = oTransGeom.CreateVector2d(ABS(oCallOutOffset*(COS(oRotation)))/oView.Scale, ABS(oCallOutOffset*(SIN(oRotation)))/oView.Scale)
oPosition.TranslateBy(oCallOutOffsetVector)
'may need to change to oParentView.Scale'
Else If oSecLineStart.X < oSecLineEnd.X And oSecLineStart.Y < oSecLineEnd.Y Then 'up to right
oPosition = oSecLineEnd
oCallOutOffsetVector = oTransGeom.CreateVector2d(ABS(oCallOutOffset*(COS(oRotation)))/oView.Scale, ABS(oCallOutOffset*(SIN(oRotation)))/oView.Scale)
oPosition.TranslateBy(oCallOutOffsetVector)
Else If oSecLineStart.X > oSecLineEnd.X And oSecLineStart.Y < oSecLineEnd.Y Then 'up to left
oPosition = oSecLineEnd
oCallOutOffsetVector = oTransGeom.CreateVector2d(0-ABS(oCallOutOffset*(COS(oRotation)))/oView.Scale, ABS(oCallOutOffset*(SIN(oRotation)))/oView.Scale)
oPosition.TranslateBy(oCallOutOffsetVector)
Else If oSecLineStart.X < oSecLineEnd.X And oSecLineStart.Y > oSecLineEnd.Y Then 'down to right
oPosition = oSecLineStart
oCallOutOffsetVector = oTransGeom.CreateVector2d(0-ABS(oCallOutOffset*(COS(oRotation)))/oView.Scale, ABS(oCallOutOffset*(SIN(oRotation)))/oView.Scale)
oPosition.TranslateBy(oCallOutOffsetVector)
Else If oSecLineStart.X = oSecLineEnd.X Then
oPosition = oTransGeom.CreatePoint2d(oSketchLine.RangeBox.MaxPoint.X, oSketchLine.RangeBox.MaxPoint.Y + oCallOutOffset/oView.Scale)
Else If oSecLineStart.Y = oSecLineEnd.Y Then
oPosition = oTransGeom.CreatePoint2d(oSketchLine.RangeBox.MaxPoint.X + oCallOutOffset/oView.Scale, oSketchLine.RangeBox.MaxPoint.Y)
Else
End If
End If
Next 'next sketch line of section line sketch
oCallOutPosition = oTransGeom.CreatePoint2d(oPosition.X*oView.Scale + oParentViewPosition.X, oPosition.Y*oView.Scale + oParentViewPosition.Y)
sPromptFieldsCallOut(0) = oView.Name
sPropName = "SheetNumber" & oViewSheetIndex
sPromptFieldsCallOut(1) = oDrawingCustomIProps.Item(sPropName).Value()
oSketchSym = oParentViewSheet.SketchedSymbols.Add(oCallOutArrow, oCallOutPosition, oAngle, 1, sPromptFieldsCallOut) ' pi-oAngle works half the time....'
'MessageBox.Show(oRotation,"oRotation")
oSketchSym = oParentViewSheet.SketchedSymbols.Add(oCallOut, oCallOutPosition, 0, 1, sPromptFieldsCallOut)
End If
End If
Next 'next view on sheet
Catch '9/1/2016
End Try '9/1/2016
Next 'next sheet
Dim oTopNode As BrowserNode
oTopNode = oDrawing.BrowserPanes.ActivePane.TopNode
Dim oNode As BrowserNode
For Each oNode In oTopNode.BrowserNodes
If oNode.Visible = True And oNode.Expanded = True Then
oNode.Expanded = False
End If
Next
iLogicVb.UpdateWhenDone = True
End Sub
Function GetViewVector(oView As DrawingView) As Vector
Dim oTransGeom As TransientGeometry
oTransGeom = ThisApplication.TransientGeometry
Dim oCamera As Camera
oCamera = oView.Camera
Dim oCameraEye, oCameraTarget As Point
oCameraEye = oCamera.Eye
oCameraTarget = oCamera.Target
Dim oViewVector As Vector
oViewVector = oTransGeom.CreateVector(oCameraEye.X - oCameraTarget.X, oCameraEye.Y - oCameraTarget.Y, oCameraEye.Z - oCameraTarget.Z)
'oViewVector = oTG.CreateVector(oCameraEye.X, oCameraEye.Y, oCameraEye.Z)
Return oViewVector
End Function
Function NormalizeAngle(angle As Double, ReturnDegrees As Boolean)
Dim oAngle As Double
Dim multiple As Double
If Math.Abs(angle) >= 2*Math.PI '360 degrees
multiple = angle \ (2*Math.PI)
oAngle = angle - multiple*2*Math.PI
Else
oAngle = angle
End If
'MessageBox.Show(oAngle, "oAngle")
'MessageBox.Show(ReturnDegrees, "ReturnDegrees")
If ReturnDegrees = False
Return oAngle
Else
Return (180/Math.PI) * oAngle
End If
End Function