06-03-2021
07:24 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
06-03-2021
07:24 PM
As for creating a new drawing if the one isn't found, I'm not sure that we can access the create new view interfaces via automation, but something like this should get you started in creating the drawing.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Dim oDoc As PartDocument
oDoc = ThisApplication.ActiveDocument
Try
ThisApplication.Documents.Open _
(ThisDoc.PathAndFileName(True).Replace("ipt", "idw"))
Return 'exit rule
Catch
End Try
oNewDrawing = ThisDoc.ChangeExtension(".idw")
oTemplateFolder = ThisApplication.FileOptions.TemplatesPath
oTemplate = oTemplateFolder & "Standard.idw"
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")