Hello Everyone,
When running my python script in dynamo for rsa, the following error occurs:
“IronPythonEvaluator.EvaluateIronPyth onScript operation failed.
Traceback (most recent call last):
File “”, line 34, in
EnvironmentError: System.Runtime.InteropServices.COMException
(0x80004005): Fout HRESULT
E_FAIL is geretourneerd voor een aanroep van een COM-onderdeel. bij
Microsoft.Scripting.ComInterop.ComRuntimeHelpers.CheckThrowException
(Int32 hresult, ExcepInfo& excepInfo, UInt32 argErr, String message)
bij CallSite.Target(Closure, CallSite, Object, Object) bij
System.Dynamic.UpdateDelegates.UpdateAndExecute2[TO,T1,TRet] (CallSitesite, TO arg0, T1 arg1)
bij CallSite.Target(Closure, CallSite, Object, Object) bij
Microsoft.Scripting.Interpreter.DynamicInstruction 3.Run(Interpreted Frameframe) bij
Microsoft.Scripting.Interpreter.Interpre ter.Run(Interpreted Frame frame) bij
Microsoft.Scripting.Interpreter.LightLa mbda.Run4[TO,T1,T2,T3,TRet](TO arg0,T1 arg1, T2 arg2, T3 arg3) bij
System.Dynamic.UpdateDelegates.UpdateAndExecute3[TO,T1,T2,TRet](CallSitesite, TO arg0, T1 arg1, T2 arg2) bij
Microsoft.Scripting.Interpreter.DynamicInstruction 4.Run(Interpreted Frameframe) bij
Microsoft.Scripting.Interpreter.Interpre ter.Run(Interpreted Frame frame) bij
Microsoft.Scripting.Interpreter.LightLambda.Run2[TO,T1,TRet](TO arg0, T1arg1) bij
Iron Python.Compiler.PythonScriptCode. RunWorker(CodeContext ctx) bij
Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope) bij
DSIron Python.Iron Python Evaluator.Eva luate(String code, IList bindingNames, IList bindingValues)”
(pardon me for the length, just trying to be as complete as possible)
The weird thing is that when I disconnect an input string → run the model → then reconnect the same input string → run the model again, the script does work without the error. It also works when I change something insignificant in the script. The problem is that I don’t want to keep doing one of the above everytime I use the script . Does someone know what i’m doing wrong?
This is my code:
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# add Robot Structural Analysis API reference
from System import Environment
#get the current user folder i.e C:\Users\<you>\AppData\Roaming
user = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
# add the reference to the interop file shipped with the package
clr.AddReferenceToFileAndPath(user +r"\Dynamo\Dynamo Core\2.13\packages\SAD\bin\RSA\interop.RobotOM.dll")
# add needed import to be able to use Robot Structural Analysis objects
from RobotOM import *
from System import Object
GrondprofielName = IN[0]
GrondprofielData = IN[1]
barNumber = IN[2]
application = RobotApplicationClass()
project = application.Project
structure = project.Structure
labels = structure.Labels
bars = structure.Bars
out = labels.Create(IRobotLabelType.I_LT_BAR_ELASTIC_GROUND, GrondprofielName)
out.Data.Ky = GrondprofielData[0]
out.Data.Kz = GrondprofielData[1]
labels.Store(out)
for i in range(len(barNumber)):
bar = structure.Bars.Get(barNumber[i])
bar.SetLabel(IRobotLabelType.I_LT_BAR_ELASTIC_GROUND, GrondprofielName)
This is my dynamo input:
Thanks in advance!