Message 1 of 8

Not applicable
09-30-2015
02:32 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
A previous employee set up an ilogic macro for writing a flat pattern dxf. The macro looks to an excel spreadsheet to get the name of the folder to save to. However it stopped working and we get the following error:
Error in rule: Publish, in document: K070001.idw
Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
Here is the code, anybody know what is wrong here? I had an intro to ilogic class a year ago and haven't touched it since so we are stumped...
Format:HTML Format Version:1.0 StartHTML: 165 EndHTML: 25427 StartFragment: 314 EndFragment: 25395 StartSelection: 314 EndSelection: 314SyntaxEditor Code Snippet
trigger = iTrigger0 oType=Left(ThisDoc.FileName(False),3) GoExcel.Open("S:\DRAWINGS\Folder Types.xlsx", "Sheet1") For rowPN = 1 To 200 If (GoExcel.CellValue("A" & rowPN) = oType) Then oFile = GoExcel.CellValue("C" & rowPN) Exit For End If Next oFolder = "S:\DRAWINGS\NOT RELEASED\" & oFile If Not System.IO.Directory.Exists(oFolder) Then System.IO.Directory.CreateDirectory(oFolder) End If Dim DWGAddIn As TranslatorAddIn DWGAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC4-122E-11D5-8E91-0010B541CD80}") Dim oDocument As Document oDocument = ThisApplication.ActiveDocument Dim oContext As TranslationContext oContext = ThisApplication.TransientObjects.CreateTranslationContext oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism Dim oOptions As NameValueMap oOptions = ThisApplication.TransientObjects.CreateNameValueMap Dim oDataMedium As DataMedium oDataMedium = ThisApplication.TransientObjects.CreateDataMedium If DWGAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then oOptions.Value("DwgVersion") = 25 Dim strIniFile As String strIniFile = "S:\DRAWINGS\DWG export.ini" oOptions.Value("Export_Acad_IniFile") = strIniFile End If path_and_name = oFolder & "\" & ThisDoc.FileName(False) oDataMedium.FileName = path_and_name & ".dwg" DWGAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium) ThisDoc.Document.SaveAs(oFolder & "\" & ThisDoc.FileName(False) & (".pdf") , True) Dim doc As Document = ThisDrawing.ModelDocument Dim oSheetMetalComp As Inventor.SheetMetalComponentDefinition oSheetMetalComp = doc.ComponentDefinition Dim oFlatPattern As FlatPattern oFlatPattern = oSheetMetalComp.FlatPattern If oFlatPattern IsNot Nothing Then Dim iLogicAuto As Object = iLogicVb.Automation If (iLogicAuto Is Nothing) Then Exit Sub Dim ruleName As String = "DXF" Dim rule As Object = iLogicAuto.GetRule(doc, ruleName) Dim i As Integer = iLogicAuto.RunRuleDirect(rule) End If MessageBox.Show(oFolder, "File Saved To")
Solved! Go to Solution.