Maybe this will help:
SyntaxEditor Code Snippet
Imports Inventor.ViewOrientationTypeEnum
Imports Inventor.DrawingViewStyleEnum
Dim oDrawingDoc as DrawingDocument
Dim oPartDoc as Document
Dim oSheet As sheet
Dim oView1 as DrawingView
Dim oView2 as DrawingView
Dim oView3 as DrawingView
Dim oView4 as DrawingView
Dim oView5 as DrawingView
'Ask for scale
ViewScale = InputBox("Scale = 1 op (voor 1:20 vul 0.02 in)", "Vul schaal in", "1")
'ViewScale = 0.02
'Ask to create drawing?
dwgQuery=MsgBox("Would you like to Create a drawing for this MODEL?", vbYesNo,"Drawing Selection")
If dwgQuery = vbYes Then
oPartDoc = ThisDoc.Document
'Check to see if part is a sheetmetal part
If oPartDoc.SubType <> "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
'do nothing
Else
'ensure this part has a flat pattern
Dim oSMDef As SheetMetalComponentDefinition
oSMDef = oPartDoc.ComponentDefinition
If oSMDef.FlatPattern Is Nothing Then
'create flat pattern
oSMDef.Unfold
oSMDef.FlatPattern.ExitEdit
oSMDef.FlatPattern.FlipBaseFace
Else
'do nothing
End If
End If
'Define IDW Template File Location
oDrawingDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, "C:\Cad_Settings\Inventor_Support_files 2018\Templates\Standard.idw", True)
oSheet = oDrawingDoc.Sheets.Item(1)
' Create a new NameValueMap object
Dim oBaseViewOptions As NameValueMap
oBaseViewOptions = ThisApplication.TransientObjects.CreateNameValueMap
'True = folded view False = flat pattern view
oBaseViewOptions.Add("SheetMetalFoldedModel", False)
'Define 2d view bottom left corner points for four views
oPoint1 = ThisApplication.TransientGeometry.CreatePoint2d(9, 10) ' front view
oPoint2 = ThisApplication.TransientGeometry.CreatePoint2d(9, 14) ' top view
oPoint3 = ThisApplication.TransientGeometry.CreatePoint2d(18, 10)' right view
oPoint4 = ThisApplication.TransientGeometry.CreatePoint2d(20, 18)' flat pattern
oPoint5 = ThisApplication.TransientGeometry.CreatePoint2d(25, 25)' Iso view
oBaseView = oSheet.DrawingViews.AddBaseView(oPartDoc,oPoint1, ViewScale,kFrontViewOrientation, kHiddenLineDrawingViewStyle, "My View")
oView2 = oSheet.DrawingViews.AddProjectedView(oBaseView,oPoint2, kHiddenLineDrawingViewStyle, ViewScale)
oView3 = oSheet.DrawingViews.AddProjectedView(oBaseView,oPoint3, kHiddenLineDrawingViewStyle, ViewScale)
oView4 = oSheet.DrawingViews.AddBaseView(oPartDoc,oPoint4, ViewScale,kDefaultViewOrientation, kHiddenLineDrawingViewStyle,,, oBaseViewOptions)
oView5 = oSheet.DrawingViews.AddProjectedView(oBaseView,oPoint5, kShadedDrawingViewStyle, ViewScale)
End If
Robert
If you find this reply helpful ? It would be nice if you use the Accept as Solution or Kudos button below.