Hi,
This line of code is giving me error on second run. The first run, the line works fine. However, when i run again, it will give an error. And when i open the target file, and I click on the UserParameter without doing anything and close the file. Then i run again, it will work again.
Please help.
Line 8:
oCompDoc.ComponentDefinition.Parameters.UserParameters.Item("Shell_ID").Value = oShellID
Error:
Error on line 8 in rule: Manifold Support, in document: TPAS004-R0-AS-01.iam
Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
Sub Main() Dim oDoc As AssemblyDocument = ThisDoc.Document Dim oOcc As ComponentOccurrence = oDoc.ComponentDefinition.Occurrences.ItemByName("Manifold Support") Dim oCompDoc As Document = oOcc.Definition.Document Dim oShellID As Decimal = Parameter("Shell_ID1") / 10 oCompDoc.ComponentDefinition.Parameters.UserParameters.Item("Shell_ID").Value = oShellID Parameter("MS_EL") = Parameter("N1_EL") Parameter("MS_Or") = Parameter("N1_Or") + 180 Parameter("mMS_Or") = -Parameter("MS_Or") Parameter("mMS_EL") = Parameter("MS_EL") Call UpdateModel(oDoc, oOcc) End Sub
Hi @Marcus_Chong. What does the 'UpdateModel' routine contain? And what does the 'More Info' tab of the error message say. Besides just Unspecified Error, it might specify what it was trying to do when it encountered that error, such as which stage of the code in Line 8 it has a problem with. (Was it not able to find that specific UserParameter, or was the error at the point where it tries to set its value?) This sort of sounds like the referenced document is not getting updated between runs, and you manually going into that part and clicking on that parameter is causing that referenced model to automatically update for you.
Wesley Crihfield
(Not an Autodesk Employee)
Hi @WCrihfield ,
This is the link for the files. https://we.tl/t-N1fbf8bwip
This is the file that shows the error.
Please help.
Thank you.
In these two lines place a message box before and after each call for a value and check it's value is what you expect.
Dim oShellID As Decimal = Parameter("Shell_ID1") / 10 oCompDoc.ComponentDefinition.Parameters.UserParameters.Item("Shell_ID").Value = oShellID
In addition you might need to update the document using document update or parameter update. You will find these snippets in the ilogic editor.
Hi @A.Acheson ,
This two lines is just to assign Parameter to oShellID, and then to push the parameter to designated component.
The problem is not sure why it is showing error.
I have rebuilt the model from scratch, it seems working now. I will test it out again and update here. Just wondering whether any chance due to bug or maybe something wrong with the file?
Can't find what you're looking for? Ask the community or share your knowledge.