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

Or maybe something like this since you mentioned you need to choose the template

 

 

	Imports System.IO
Dim oDoc As PartDocument
oDoc = ThisApplication.ActiveDocument

Try 'to open the drawing 
	ThisApplication.Documents.Open _
	(ThisDoc.PathAndFileName(True).Replace("ipt", "idw"))
	Return 'exit rule
Catch	
End Try

'since nothing found create it...
oNewDrawing = ThisDoc.ChangeExtension(".idw")
oTemplateFolder = ThisApplication.FileOptions.TemplatesPath
Dim oList As New ArrayList

Dim Folder As New IO.DirectoryInfo(oTemplateFolder)
For Each File As IO.FileInfo In Folder.GetFiles("*.idw", IO.SearchOption.AllDirectories)
	Dim sName As New FileInfo(File.Name)	
	oList.Add(sName.Name)
Next

oTemplate = InputListBox("Select a template", oList, oList(0),"iLogic", "List")
oTemplate = oTemplateFolder & oTemplate

Dim oDrawingDoc As DrawingDocument 
oDrawingDoc = ThisApplication.Documents.Add _
(DocumentTypeEnum.kDrawingDocumentObject, oTemplate, True)

oDrawingDoc.Activate()
Dim oSheet As Sheet 
oSheet = oDrawingDoc.Sheets.Item(1)

Dim oPoint As Point2d
oPoint = ThisApplication.TransientGeometry.CreatePoint2d(10, 10)

Dim oView As DrawingView
oView = oSheet.DrawingViews.AddBaseView(oDoc, oPoint, 1, _
ViewOrientationTypeEnum.kFrontViewOrientation, _
DrawingViewStyleEnum.kHiddenLineRemovedDrawingViewStyle)

oDrawingDoc.SaveAs(oNewDrawing, False)

MessageBox.Show("This new file saved as: "& oNewDrawing, "iLogic")