With this rule, activated in a part or assembly file, you will create a drawing file and place the part in the drawing.
Dim oDoc As Document ' Part Document or Assembly Document
oDoc = ThisDoc.Document
'Create a drawing from the drawing template
Dim templateFile As String
templateFile = "w:\03 FORMATS & TEMPLATES\02 Inventor\Templates\Document Template.idw" '''Place the path of your template idw
Dim oDrawingDoc As DrawingDocument = ThisApplication.Documents.Add(DocumentTypeEnum.kDrawingDocumentObject,templateFile,True)
oDrawingDoc.Activate()
Dim oSheet As Sheet = oDrawingDoc.Sheets.Item(1)
Dim oPoint1 As Point2d
oPoint1 = ThisApplication.TransientGeometry.CreatePoint2d(5, 5)
Dim oView As DrawingView
oView = oSheet.DrawingViews.AddBaseView(oDoc,oPoint1, 1, ViewOrientationTypeEnum.kBottomViewOrientation, DrawingViewStyleEnum.kHiddenLineDrawingViewStyle)
oDoc.ReleaseReference
Call oDoc.Close(True)
I hope it will help you extract the part of the code you need.
regards!!!
Please accept as solution and give likes if applicable.
I am attaching my Upwork profile for specific queries.
Sergio Daniel Suarez
Mechanical Designer
| Upwork Profile | LinkedIn