API RDm engine solver error

API RDm engine solver error

1234eddie
Advocate Advocate
1,494 Views
4 Replies
Message 1 of 5

API RDm engine solver error

1234eddie
Advocate
Advocate

Hi all,

 

I'm currently working on a script to do the steel verification using the API. Im working with this inside a python schript.

I got some good examples(excel vba) but my script won't work. This is the error i get:

Error.png

this is what is written inside the API SDK document of the steel design(written for C#)

API document steel design.JPG

 

This is how i have written it in my code:

Line 48  RDmEngine.Solve()

I guess that i'm missing the part which says 'Nothing' but dont know how to write it/how to add it.

 

This is the full code i'm using.

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

from System import Environment
user = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
clr.AddReferenceToFileAndPath(user +r"\Dynamo\Dynamo Core\1.3\packages\Structural Analysis for Dynamo\bin\RSA\Interop.RobotOM.dll")
from RobotOM import *
from System import Object
#The inputs to this node will be stored as a list in the IN variables.
objects = IN[0]
#File = IN[1]
#Location = IN[2]
application = RobotApplicationClass()
project = application.Project
structure = project.Structure
labels = structure.Labels
application.Project.ViewMngr.Refresh()
project.CalcEngine.AnalysisParams.IgnoreWarnings = True
calcEngine = project.CalcEngine
calcEngine.AutoGenerateModel = True
calcEngine.UseStatusWindow = True
calcEngine.Calculate()
#project.SaveAs(Location+"\\"+ File +".rtd")
#project.Save()
#project.SaveAs("D:\\Werk\Robot\Dynamo files ontwikkeling\BFS-optimo learn\Modellen\test 7\Modeltest.rtd")
RDMServer = IRDimServer
RDMServer = application.Kernel.GetExtension("RDimServer")
#RDMServer = (IRDimServerMode.I_DSM_STEEL)#werkt niet
RDMServer.Mode = 1
RDmEngine = IRDimCalcEngine
RDmEngine = RDMServer.CalculEngine
#optional use it if you want to set calculation parameters by the code
RDMCalpar = IRDimCalcParam
RDMCalCnf = IRDimCalcConf
RDMCalpar = RDmEngine.GetCalcParam()
RDMCalCnf = RDmEngine.GetCalcConf()
RdmStream = IRDimStream
RdmStream = RDMServer.Connection.GetStream()
RdmStream.Clear()
RdmStream.WriteText("all")
#RDMCalpar.SetObjsList(1,RdmStream)
RDMCalpar.SetObjsList(IRDimCalcParamVerifType.I_DCPVT_MEMBERS_VERIF, RdmStream)
RDMCalpar.SetLimitState(IRDimCalcParamLimitStateType.I_DCPLST_ULTIMATE,1)
RdmStream.Clear()
RdmStream.WriteText("1to6")
RDMCalpar.SetLoadsList(RdmStream)
RDmEngine.Solve()
RdmAllResObjType = IRDimAllResObjectType
RdmAllRes = IRDimAllRes
RdmDetRes = IRDimDetailedRes
RdmAllRes = RDmEngine.Results()
RdmAllResObjType = 1
#RdmAllResObjType = RdmAllRes.ObjectsType(IRDimAllResObjectType.I_DAROT_VERIFIED_MEMBER)
#ObjCnt = RdmAllRes.ObjectsCount
UsrNo = RdmAllRes.ObjectsUsrNo(1)
RDmRetValue = IRDimMembCalcRetValue
RDmRetRes = IRDimDetailedRes
RdmDetRes = RdmAllRes.Get(1)
Case = RdmDetRes.GovernCaseName
Ratio = RdmDetRes.Ratio

OUT = RdmAllRes, Case, Ratio
#OUT = "goed bezig"

 Maybe @Rafal.Gaweda  or others know a solution?

 

All files are attached.

 

Thanks in advance 

Gr Edward

Accepted solutions (1)
1,495 Views
4 Replies
Replies (4)
Message 2 of 5

1234eddie
Advocate
Advocate

Hello all,

 

@cool.stuff  @chjpcoi 
I hope someone of you can help me with this or tag someone who may know how to solve is?

Many thanks in advance

Gr Edward

0 Likes
Message 3 of 5

1234eddie
Advocate
Advocate

@JacquesGaudin @Anonymous @Anonymous @klavs @chjpcoi

I have seen your names in some related topics to API.

I hope someone of you recognise my problem and maybe how to solve it?

or know others who can.

 

tanks in advance

 

 

0 Likes
Message 4 of 5

JacquesGaudin
Advocate
Advocate

I would try this:

 

 

RDmEngine.Solve(None)

 

JacquesGaudin_0-1597329086244.png

 

 

0 Likes
Message 5 of 5

1234eddie
Advocate
Advocate
Accepted solution

@JacquesGaudin  thanks for your reply.

i tried your option, but it's gives the same error.

 

But i found the solution(don't know why it's working).

RDmEngine.Solve(RdmStream)

with this it's running and i  get the results i want.

 

File is attached.