Message 1 of 6

Not applicable
06-27-2017
12:17 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I've tried searching in the forum and basically this is where I kinda get the code where I modified it to suit my needs but I keep on getting this error:
Error in rule: drawing view test, in document: L19-4949 PLATE, CENTER BRACKET.ipt
Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
--so basically from part, I'd run this rule and it opens the drawing fine to the border that I want, then that error appears. Any help, insight is greatly appreciated.
Thanks in advance!!
Joel
Format:HTML Format Version:1.0 StartHTML: 165 EndHTML: 17334 StartFragment: 314 EndFragment: 17302 StartSelection: 314 EndSelection: 314SyntaxEditor Code Snippet
Dim oDrawDoc As DrawingDocument Dim oPartDoc As Document Dim oSheet As Sheet 'Dim oTG As TransientGeometry Dim oPoint1 As Point2d Dim oPoint2 As Point2d Dim oPoint3 As Point2d Filename = ThisDoc.FileName(False) 'If this is the Assembly View, then use this Document as reference and open Drawing Template 'Otherwise use the given Part Number And invisibly open the part, Use the active drawing If AssemblyDrawing = True Then oPartDoc = ThisDoc.Document oDrawDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, "C:/Vault_Work/PROJECTS/iLogic Parts-inprogress/iLogic Part Generators/Rectangular Transition Chute Generator/DrawingTemplate.idw", True) Else If AssemblyDrawing = False oPartDocPath = ThisDoc.Path & "\" & Filename & ".ipt" oPartDoc = ThisApplication.Documents.Open(oPartDocPath, False) 'oDrawDoc = ThisApplication.ActiveDocument oDrawDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, "K:\Mech\INVENTOR2016\Inventor Resources\Templates\RAUTE_2016.dwg", True) End If 'Set a reference to the sheet format Dim oFormat As SheetFormat Try oFormat = oDrawDoc.SheetFormats.Item("A-SIZE SHEET") Catch MessageBox.Show("Error: the named sheet format might not exist.", "iLogic") Return End Try 'Create a new sheet based on the sheet format using the specified model'Dim oSheet As Sheet oSheet = oDrawDoc.Sheets.AddUsingSheetFormat(oFormat) oSheetName = "Sheet:1" oSheet = ThisApplication.ActiveDocument.Sheets.Item(oSheetName) oSheet.Delete oTG = ThisApplication.TransientGeometry 'Dim oTG As TransientGeometry'Set points in order to get wanted View (ie. if 'Y' is the same and 'X' is greater or less, you will get a Side View) oPoint1 = oTG.CreatePoint2d(5, 5) DrawingViewScale = 1 'Create the Base View oBaseView = oSheet.DrawingViews.AddBaseView(oPartDoc, oPoint1, DrawingViewScale, ViewOrientationTypeEnum.kFrontViewOrientation, DrawingViewStyleEnum.kHiddenLineDrawingViewStyle, "Master")
Solved! Go to Solution.