Hi, I've tried this code and it works for me..is there a way to delete the Sheet 1 then? thanks!
Nevermind found out how to do it: here it is:
basically from a single part plate this drawing will create a 2D drawing of that part...still in progress of how to put the views 🙂
Format:HTML Format Version:1.0 StartHTML: 165 EndHTML: 14502 StartFragment: 314 EndFragment: 14470 StartSelection: 314 EndSelection: 314SyntaxEditor Code Snippet
'Function CreateDrawing_PlaceViews (PartNumber As String, DrawingViewScale As Double, ViewsToPlace As String, AssemblyDrawing As Boolean, ByRef oBaseView As DrawingView, ByRef oView2 As DrawingView, ByRef oView3 As DrawingView, ByRef oView4 As DrawingView)
Dim oDrawDoc As DrawingDocument
Dim oPartDoc As Document
Dim oSheet As Sheet
Dim oTG As TransientGeometry
Dim oPoint1 As Point2d
Dim oPoint2 As Point2d
Dim oPoint3 As Point2d
Filename=ThisDoc.FileName(False)
'If this is the Assembly View, then use this Document as reference and open Drawing Template
'Otherwise use the given Part Number And invisibly open the part, Use the active drawing
If AssemblyDrawing = True Then
oPartDoc = ThisDoc.Document
oDrawDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, "C:/Vault_Work/PROJECTS/iLogic Parts-inprogress/iLogic Part Generators/Rectangular Transition Chute Generator/DrawingTemplate.idw", True)
Else If AssemblyDrawing = False
oPartDocPath = ThisDoc.Path & "\" & Filename & ".ipt"
oPartDoc = ThisApplication.Documents.Open(oPartDocPath, False)
'oDrawDoc = ThisApplication.ActiveDocument
oDrawDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, "K:\Mech\INVENTOR2016\Inventor Resources\Templates\RAUTE_2016.dwg", True)
End If
'Set a reference to the sheet format
Dim oFormat As SheetFormat
Try
oFormat = oDrawDoc.SheetFormats.Item("A-SIZE SHEET")
Catch
MessageBox.Show("Error: the named sheet format might not exist.", "iLogic")
Return
End Try
'Create a new sheet based on the sheet format using the specified model'Dim oSheet As Sheet
oSheet = oDrawDoc.Sheets.AddUsingSheetFormat(oFormat)
oSheetName = "Sheet:1"
oSheet = ThisApplication.ActiveDocument.Sheets.Item(oSheetName)
oSheet.Delete