
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello All,
Iam Getting this error when i try to generate section views using the API,
When i generate just oother views the code works fine. Can somebody look at the code and tell me what the problem is. My code is as below.
Imports Inventor.ViewOrientationTypeEnum
Imports Inventor.DrawingViewStyleEnum
Imports Inventor.PointIntentEnum
Imports Inventor.DimensionTypeEnum
Imports Inventor.DrawingCurveSegmentEnum
Imports Inventor.DrawingCurveEnum
Imports Inventor.CurveTypeEnum
Sub Main()
'Ask to create drawing?
dwgQuery=MsgBox("Would you like to Create a drawing for this MODEL?", vbYesNo,"Drawing Selection")
If dwgQuery = vbYes Then
Dim AssemblyDocName As String
AssemblyDocName = ThisDoc.FileName(False) 'without extension
'Dim userscale As String
Dim userscale As Double
userscale = 1/15
'userscale = InputBox("Enter the scale of the drawing", "Scale")
'Double.TryParse(userscale, userscale)
MessageBox.Show(AssemblyDocName, "Title")
oDrawingDoc = CreateDrawing_PlaceViews(AssemblyDocName, userscale, "Top")
End If
End Sub
Function CreateDrawing_PlaceViews (AssemblyDocName As String, userscale As Double, ViewsToPlace As String)
Dim oDrawDoc As DrawingDocument
Dim oPartDoc As Document
Dim oSheet As Sheet
Dim oTG As TransientGeometry
Dim oBaseView As DrawingView
Dim oTopView As DrawingView
Dim oRightSideView As DrawingView
Dim oDimensionalView As DrawingView
Dim oSectionView As SectionDrawingView
Dim oSketchLine As SketchLine
Dim oDrawingSketch As DrawingSketch
'Define IDW Template File Location
oPartDoc = ThisDoc.Document
oDrawDoc = ThisApplication.Documents.Add(kDrawingDocumentObject,"C:\Users\Public\Documents\Autodesk\Inventor 2013\Templates\Metric\templatemm.idw", True)
oSheet = oDrawDoc.Sheets.Item(1)
'Dim oPoint5 As Point2d
'Dim oPoint6 As Point2d
'Dim oPoint7 As Point2d
'oPoint5 = ThisApplication.TransientGeometry.CreatePoint2d(10, 16)
'oPoint6 = ThisApplication.TransientGeometry.CreatePoint2d(10, 33)
'oPoint7 = ThisApplication.TransientGeometry.CreatePoint2d(20, 33)
'Define 2d view bottom left corner points for four views
oTG = ThisApplication.TransientGeometry
oPoint1 = oTG.CreatePoint2d(10, 25)
oPoint2 = oTG.CreatePoint2d(10, 35)
oPoint3 = oTG.CreatePoint2d(20, 25)
oPoint4 = oTG.CreatePoint2d(30, 31)
oPoint5 = oTG.CreatePoint2d(10, 16)
oPoint6 = oTG.CreatePoint2d(10, 33)
oBaseView = oSheet.DrawingViews.AddBaseView(oPartDoc, oPoint1, userscale, kBottomViewOrientation, kHiddenLineDrawingViewStyle)
ViewsToPlace = "Top"
oTopView = oSheet.DrawingViews.AddProjectedView(oBaseView,oPoint2, kHiddenLineDrawingViewStyle, userscale)
oRightSideView = oSheet.DrawingViews.AddProjectedView(oBaseView,oPoint3, kHiddenLineDrawingViewStyle, userscale)
oDimensionalView = oSheet.DrawingViews.AddProjectedView(oBaseView,oPoint4, kShadedDrawingViewStyle , userscale)
oDrawingSketch = oSheet.Sketches.Add
oDrawingSketch.Edit
oSketchLine = oDrawingSketch.SketchLines.AddByTwoPoints(oPoint5, oPoint6)
oDrawingSketch.ExitEdit
oSectionView = oSheet.DrawingViews.AddSectionView(oBaseView, oDrawingSketch, oPoint6, kHiddenLineDrawingViewStyle,userscale)
'oDrawingSketch.Visible = False
'oView2 = oSheet.DrawingViews.AddSectionView(oBaseView,
' oDrawingSketch, oPoint7, kHiddenLineRemovedDrawingViewStyle)
'oDrawingSketch.Visible = False
Return DrawingDoc
End Function
Please somebody look at my code and sort me out.
Thanks and Regards,
Shiva babu
Solved! Go to Solution.