Community
' create a drawing Imports Inventor.ViewOrientationTypeEnum Imports Inventor.DrawingViewStyleEnum Dim oDrawingDoc as DrawingDocument Dim oPartDoc as Document Dim oSheet As sheet Dim oView1 as DrawingView ViewScale = 1/1 dwgQuery=MsgBox("Would you like to Create a drawing for this MODEL?", vbYesNo,"Drawing Selection") If dwgQuery = vbYes Then oPartDoc = ThisDoc.Document 'Define IDW Template File Location oDrawingDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, "d:\Work12\TEMPLATES\PPPI-PART BORDER NL.idw", True) 'oDrawingDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, "", True) oSheet = oDrawingDoc.Sheets.Item(1) ' Create a new NameValueMap object Dim oBaseViewOptions As NameValueMap oBaseViewOptions = ThisApplication.TransientObjects.CreateNameValueMap oBaseViewOptions.Add("SheetMetalFoldedModel", False) 'Define 2d view bottom left corner points for four views oPoint1 = ThisApplication.TransientGeometry.CreatePoint2d(10, 12) ' front view oBaseView = oSheet.DrawingViews.AddBaseView(oPartDoc,oPoint1, ViewScale,kFrontViewOrientation, kShadedHiddenLineDrawingViewStyle, "My View") oSheet.PartsLists.Add(oView1, ThisApplication.TransientGeometry.CreatePoint2d(27,20.625)) End If
Please take a look at the code below, can someone tell me what am I doing wrong?
???oSheet.PartsLists.Add(oView1, ThisApplication.TransientGeometry.CreatePoint2d(27,20.625))
Thank you
Solved! Go to Solution.
Solved by Vladimir.Ananyev. Go to Solution.
In your command oSheet.PartsLists.Add(oView1, ... )
oView1 object is undefined.
Replace it with the reference to the existing drawing view, e.g. oBaseView.
cheers,