Automating drawings is a fairly advanced task and usually needs to be customized to a company's and/or or user's specific needs/wants. Because of this, there is not a universal, super simple solution available that fits everyone's needs, without any changes.
Did you know that, within an assembly or part document, you can select the top node in your Model Browser tree, then right click, and choose "Create Drawing View" (from that right-click menu), then it will pop-up a dialog asking you to choose which drawing document template you want to use, then when you select one, it will be ready to click/place the first base view in a new drawing for you, without having to use any code?
Here is something fairly basic that will do something similar to what the above process does.
- You need to change the path and/or file name of the drawing template file I am specifying within the code, before trying to run it.
If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kPartDocumentObject And _
ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kPartDocumentObject Then
MsgBox("This rule must be ran while a Part or Assembly is active. Exiting.",vbOKOnly+vbCritical, "WRONG DOCUMENT TYPE")
Exit Sub
End If
'Drawing Template to use - path and file name
Dim oTPath As String = ThisApplication.FileOptions.TemplatesPath
Dim oTName As String = "A-Size Standard Drawing.idw"
Dim oTemplate As String = oTPath & "\" & oTName
Dim oDDoc As DrawingDocument = ThisApplication.Documents.Add(DocumentTypeEnum.kDrawingDocumentObject, oTemplate, True)
ThisApplication.CommandManager.ControlDefinitions.Item("DrawingBaseViewCmd").Execute
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.
If you have time, please... Vote For My IDEAS 💡or you can Explore My CONTRIBUTIONS
Inventor 2021 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum
Wesley Crihfield

(Not an Autodesk Employee)