- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Does anyone know where the default view label characters are in the API? Im wondering if/where the internal counter is?
I'd like to re-letter the detail and section views using the active standard rules if possible as opposed to hard coding my own lettering sequence.
Cheers
Craig
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
---------------------------------------------------------------------------------------------------------------------------
Inventor 2010 Certified Professional
Currently using 2023 Pro
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
If you don't mind spending $5:
https://designandmotion.net/autodesk/inventor-view-labels-whack/
Otherwise, in the API, the alphabetical view label name is in
Sheet -> DrawingView.Name()
In the API help, search DrawingView Object, scroll down to Properties, and you'll find Name.
Brandon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Brandon. Thats where im heading with it but i was looking for the internal counter, not the name itself. I havent looked too far into it yet to see if VBA has its own letter counter but i was hoping to avoid creating array A, B, C...... AA, AB etc. I can find the excluded characters so i could just compare my list to that.
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
---------------------------------------------------------------------------------------------------------------------------
Inventor 2010 Certified Professional
Currently using 2023 Pro
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
The label ID that will be used in the next view is not exposed through the API and neither is any functionality to create a view label independent of actually creating a view. However, I went ahead and wrote a little VBA function that takes an existing view label as input and returns the next view label. For example if I pass in "A" it will return "B". It skips the letters not allowed in the ISO standard and will begin outputting double letters when it reaches the end of the alphabet. For example, if I pass in "Y" it will return "AA" since "Z" is skipped. The important function is GetNextLabel and TestViewLabel is just for testing.
Public Sub TestViewLabel()
Dim i As Integer
For i = 1 To 50
Dim lbl As String
Dim oldLabel As String
oldLabel = lbl
lbl = GetNextLabel(lbl)
Debug.Print oldLabel & " = " & lbl
Next
End Sub
Public Function GetNextLabel(Optional ByVal ExistingLabel As String = "") As String
If ExistingLabel = "" Then
GetNextLabel = "A"
Else
ExistingLabel = UCase(Trim(ExistingLabel))
Dim charCount As Integer
charCount = Len(ExistingLabel)
Dim charString As String
charString = Mid(ExistingLabel, 1, 1)
Dim charCode As Integer
charCode = Asc(charString)
Select Case charString
Case "H", "N", "P", "R", "W"
' Special case for characters before I, O, Q, S, and X. Increment
' by two in those cases to skip those letters which aren't to be
' in the ISO standard.
charCode = charCode + 2
Case "Y"
' Special case for the character before Z, so that it will start
' over at A but have an additional character.
charCode = 65
charCount = charCount + 1
Case Else
charCode = charCode + 1
End Select
' Build the label string.
Dim labelChar As String
labelChar = Chr(charCode)
GetNextLabel = String(charCount, labelChar)
End If
End Function
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Thanks Brian. Interesting method. I had been doing some reading about ASCII character codes and was trying to figure out how i was going to wrap the labels after Z.
I'll give it a bash when i get back to it.
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
---------------------------------------------------------------------------------------------------------------------------
Inventor 2010 Certified Professional
Currently using 2023 Pro
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Just for completness i wanted to say thanks, again. I used what you provided and it works a charm ![]()
PS: I was also reading through an old post on ModTheMachine about writing VBA for best performance and timing which meant i had to go back and look at some of my existing code. Everyday's a school day.
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
---------------------------------------------------------------------------------------------------------------------------
Inventor 2010 Certified Professional
Currently using 2023 Pro
