Dim oCompDef As SheetMetalComponentDefinition
oCompDef = oDoc.ComponentDefinition
If oCompDef.HasFlatPattern = False Then
MessageBox.Show("Please create flat pattern")
Exit Sub
End If
Dim oDrawingDoc As DrawingDocument = ThisApplication.Documents.Add(DocumentTypeEnum.kDrawingDocumentObject,templateFile,True)
oDrawingDoc.Activate()
Dim oSheet As Sheet = oDrawingDoc.Sheets.Item(1)
Dim oView1, oView2, oView3 As DrawingView
Dim oTopRightPoint As Point2d = ThisApplication.TransientGeometry.CreatePoint2d(oSheet.Width * 2 / 3, oSheet.Height * 2 / 3)
Dim oLeftPoint As Point2d = ThisApplication.TransientGeometry.CreatePoint2d(oSheet.Width / 3, oSheet.Height / 2)
oView1 = oSheet.DrawingViews.AddBaseView(oDoc, oTopRightPoint, 1/8, ViewOrientationTypeEnum.kIsoTopRightViewOrientation, DrawingViewStyleEnum.kShadedDrawingViewStyle)
oView2 = oSheet.DrawingViews.AddBaseView(oDoc, oTopRightPoint, 1/8, ViewOrientationTypeEnum.kFlatBacksideViewOrientation, DrawingViewStyleEnum.kHiddenLineRemovedDrawingViewStyle)
Dim oProjectedPoint As Point2d = ThisApplication.TransientGeometry.CreatePoint2d(oView2.Center.X, oView2.Center.Y -10)
oView3 = oSheet.DrawingViews.AddProjectedView(oView2, oProjectedPoint, DrawingViewStyleEnum.kFromBaseDrawingViewStyle)
I am creating an iLogic rule to automatically create drawings and place a couple of views. We are working with sheet metal and I would like to place a flat view. However, when I run my code, it says "the parameter is incorrect". I've narrowed this down to being the flat view orientation parameter (the red text).
The ipt does have a flat pattern (and I also check if it has one in the code). If I try and edit the view that it does place (Iso Top Right), the flat pattern bubble is greyed out. But if I manually create a new base view, I can select flat pattern.
Any ideas what I'm doing wrong?