- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I found some code and edited it to suit my needs, and it has worked flawless for several years, and now as of last week it has stopped working. And I don't understand the error message. Also it works on a different machine, but am I missing something in the code to make it work with any configuration or machine?
It copies the sketch symbols from my template to current drawing resources, and overwrites with any new. Very nice update tool.
Error Message:
Error in rule: SU_SketchSymbols, in document: TTA-001214.dwg
Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
More Info:
System.Runtime.InteropServices.COMException (0x80004005): Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at Inventor.SketchedSymbolDefinition.CopyTo(_DrawingDocument TargetDocument, Boolean ReplaceExisting)
at ThisRule.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)
Sub Main() Dim oApp As Inventor.Application oApp = ThisApplication Dim thisDWG As DrawingDocument thisDWG = oApp.ActiveDocument 'Define source path of Symbol Drawing Dim pathDWG As String pathDWG = "C:\$WorkingFolder\Templates\TitleBlockEditor.dwg" Dim sourceDWG As DrawingDocument sourceDWG = oApp.Documents.Open(pathDWG, False) Dim symbolDef As SketchedSymbolDefinition 'Copy all the symbols into active drawing For Each symbolDef In sourceDWG.SketchedSymbolDefinitions Call symbolDef.CopyTo(thisDWG, ReplaceExisting :=False) Next 'colapse browser Dim oTopNode As BrowserNode oTopNode = thisDWG.BrowserPanes.ActivePane.TopNode Dim oNode As BrowserNode For Each oNode In oTopNode.BrowserNodes ' If the node is visible and expanded, collapse it. If oNode.Visible = True And oNode.Expanded = True Then oNode.Expanded = False End If Next End Sub
Solved! Go to Solution.