Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
JBMosco
in reply to: JBMosco

Thank you, that was it. Here's the revised code:

Sub Main()
	
	oFileName = ThisDoc.Path & "\Drawing Files\" & ThisDoc.FileName & ".dwg"
	
	If (System.IO.File.Exists(oFileName)) Then
		Exit Sub
	End If
	
	Template = ThisDoc.Path & "\.Resources\Templates\Sheet Metal Drawing.dwg"
	Dim oDrawingDoc As Document= ThisApplication.Documents.Add(DocumentTypeEnum.kDrawingDocumentObject, Template, False)
	Dim oSheet As Sheet = oDrawingDoc.Sheets.Item(1)
	Dim oCenter As Point2d = ThisApplication.TransientGeometry.CreatePoint2d(oSheet.Width / 2, oSheet.Height / 2)
	
	oSheet.DrawingViews.AddBaseView(ThisDoc.Document, oCenter, 1, kFrontViewOrientation, kHiddenLineRemovedDrawingViewStyle, "Front")
	oDrawingDoc.SaveAsInventorDWG(oFileName, False)
	
End Sub