Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Automatic comparison of details and sections alphabetically

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
485 Views, 2 Replies

Automatic comparison of details and sections alphabetically

Hi to all,
when generating drawing documentation, it is necessary to work with details and sections. If I find that one of the details or cuts does not suit me and I delete it, then it is not possible to automatically compare the individual designations so that the letters go alphabetically. Is it possible to solve this with the iLogic rule?
Thanks

2 REPLIES 2
Message 2 of 3
JhoelForshav
in reply to: Anonymous

Hi @Anonymous 

There's a VBA code posted about this by @Anonymous here:

https://forums.autodesk.com/t5/inventor-ideas/drawings-re-number-detail-amp-section-views/idi-p/6276556

 

As an iLogic rule it'd look something like this 🙂

Sub Main
Dim oDoc As DrawingDocument
Dim oSheet As Sheet
Dim oView As DrawingView
Dim iter As Long

'check if active document is a drawing
If ThisApplication.ActiveDocument.DocumentType <> kDrawingDocumentObject Then
    Exit Sub
End If

oDoc = ThisApplication.ActiveDocument


iter = 1

'Rename detail and section view identifiers on all sheets
For Each oSheet In oDoc.Sheets
    For Each oView In oSheet.DrawingViews
        If oView.ViewType = kDetailDrawingViewType Or oView.ViewType = kSectionDrawingViewType Then
            oView.Name = num2Letter(iter)
            iter = iter + 1
            If InStr(1, num2Letter(iter), "I") > 0 Or InStr(1, num2Letter(iter), "O") > 0 Or InStr(1, num2Letter(iter), "Q") > 0 Then
                iter = iter + 1
            End If
        End If
    Next oView
Next oSheet


End Sub
Public Function num2Letter(num As Long) As String
'converts long to corresponding alpha
'Ex. 1 = A, 28 = AB

remain = num Mod 26
whole = Fix(num / 26)
    
If num < 27 Then
    If remain = 0 Then
        num2Letter = "Z"
    Else
        num2Letter = Chr(remain + 64)
    End If
Else
    If remain = 0 Then
        num2Letter = Chr(whole + 63) & "Z"
    Else
        num2Letter = Chr(whole + 64) & Chr(remain + 64)
    End If
End If

End Function

 

Message 3 of 3
Anonymous
in reply to: JhoelForshav

Hello,

thank you, it works great.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report