06-14-2021
07:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
06-14-2021
07:25 AM
Maybe just something like this.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Imports System.IO
Dim oDoc As Document
oDoc = ThisApplication.ActiveDocument
oExt = Right(oDoc.FullDocumentName,3) 'get file extension
Try 'to open the drawing
ThisApplication.Documents.Open _
(ThisDoc.PathAndFileName(True).Replace(oExt, "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
Logger.Info(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)