- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
my code below to create drawings from assembly is giving error and though i tried hard I haven't been able to fix or find out what is wrong with it.
Sub btnGenerateDrawing_Click()
' Set reference to active document.
' This assumes the active document is an assembly
Dim oAssemblyDoc As Inventor.AssemblyDocument
Set oAssemblyDoc = ThisApplication.ActiveDocument
' Get assembly component definition
Dim oCompDef As Inventor.ComponentDefinition
Set oCompDef = oAssemblyDoc.ComponentDefinition
' Get all occurrences from component definition for Assembly document
Dim oCompOcc As ComponentOccurrence
For Each oCompOcc In oCompDef.Occurrences
'------ Locating the Template ------'
strLocation = ThisApplication.FileOptions.TemplatesPath
Set oDrgDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, strLocation & "MasterBeam.idw")
Dim oSheet As Sheet
Set oSheet = oDrgDoc.Sheets.Item(1)
Dim oPoint1 As Point2d
Set oPoint1 = ThisApplication.TransientGeometry.CreatePoint2d(15#, 25#)
Dim oPoint2 As Point2d
Set oPoint2 = ThisApplication.TransientGeometry.CreatePoint2d(15#, 15#)
Dim oView1 As DrawingView
Set oView1 = oSheet.DrawingViews.AddBaseView(oCompOcc, oPoint1, 0.1, kBottomViewOrientation, kHiddenLineDrawingViewStyle)
It opens up the template but when it reaches on the line highlighted red it gives error of type mismatch. I have tried a lot to look around on this and other forums but couldn't find out what is wrong.
best regards,
sam
Solved! Go to Solution.