Inventor: Duplicate Drawing Sheet

autodesk-inventor-automation-duplicate-drawing-sheet-post

Sometimes, in production, we need to duplicate a page in a single document, just to make a few small changes.

Or even to change the reference and not redo all the layout work.

The way to get there is relatively simple, it’s about copying a page to a temporary drawing and copying that new page to the original document.

Manually, it’s a bit heavy …

So here is a way to get there via the API:

Dim drawingDoc As DrawingDocument = g_inventorApplication.ActiveDocument

Dim tempDrawingDoc As DrawingDocument = Nothing

For Each selectedObject As Object In drawingDoc.SelectSet

    Dim sheet As Sheet = TryCast(selectedObject, Sheet)

    If Not sheet Is Nothing Then

        If tempDrawingDoc Is Nothing Then
            tempDrawingDoc = g_inventorApplication.Documents.Add(DocumentTypeEnum.kDrawingDocumentObject, , False)
        End If

        sheet.CopyTo(tempDrawingDoc).CopyTo(drawingDoc)

    End If
Next

If Not tempDrawingDoc Is Nothing Then
    tempDrawingDoc.Close(True)
End If

Once all integrated into an AddIn, the action becomes very easy.

You may also like...