Hallo Jesse,
Maybe you can use this:
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
ViewScale = 1
'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:\Temp\my template.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
'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)
End If
'kDefaultViewOrientation = 10753 (Default folded Or flat pattern view)
'kFlatPivotRightViewOrientation = 10767
'kFlatPivotLeftViewOrientation = 10768
'kFlatPivot180ViewOrientation = 10769
'kFlatBacksideViewOrientation = 10770
'kFlatBacksidePivotRightViewOrientation = 10771
'kFlatBacksidePivotLeftViewOrientation = 10772
'kFlatBacksidePivot180ViewOrientation = 10773
I already changed it a bit, it will now only make a view from the flat pattern from the open sheetmetal part.
Robert
If you find this reply helpful ? It would be nice if you use the Accept as Solution or Kudos button below.