Error in rule: Main, in document: ilogiccabindebug.iam Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))

Error in rule: Main, in document: ilogiccabindebug.iam Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))

Anonymous
Not applicable
390 Views
2 Replies
Message 1 of 3

Error in rule: Main, in document: ilogiccabindebug.iam Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))

Anonymous
Not applicable

I am trying to get this code to create the pathways a lookup the member in the folders as shown. I keep getting the same error the code run fine once then it breaks. The code looks for the right floor using the width and length parameters in the assembly.

 

Sub Main
Call floor
Call roof
	
End Sub

Sub floor	
oFloor = ThisDoc.Document.ComponentDefinition.Occurrences.Item(1).Name
CFloor = "Floor - W" & FLOOR_WIDTH & " - D" & FLOOR_DEPTH & " - T44"
oPath = ThisDoc.Path & "\Floor - iAssembly - v1\"
filepath = oPath & CFloor & ".iam"
Component.Replace(oFloor, filepath, False) 
End Sub

Sub roof	
oRoof = ThisDoc.Document.ComponentDefinition.Occurrences.Item(2).Name
'Roof ApexA - W2500 x  D2000
CRoof = "Roof ApexA - W" & FLOOR_WIDTH & " x  D" & FLOOR_DEPTH
RPath = ThisDoc.Path & "\Roof (45) - Apex Type A\"
Rfilepath = RPath & CRoof & ".iam"
Component.Replace(oRoof, Rfilepath, False) 
End Sub 

HarryHagley_0-1617193696682.png

 

any ideas on how I can solve this error?

 

Thanks 

 

Harry 

0 Likes
Accepted solutions (1)
391 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor
Accepted solution

Is it possible that since you are accessing the component by its 'Index' number, that after you 'Replace' it, it is no longer at that same 'Index' number?  You may need to update the document between runs too with something like ThisDoc.Document.Update or iLogicVb.DocumentUpdate.  When you attempt to run it a second time, is it trying to replace the same component with the same document, or do you change something in the code each time?  Are there constraints and/or other dependencies to the component being replaced that may be causing it to throw an error?

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 3

Anonymous
Not applicable

 thanks so much it was a error in the assembly that was causing the issue not the code itself

0 Likes