Robot Structural Analysis Forum
Welcome to Autodesk’s Robot Structural Analysis Forums. Share your knowledge, ask questions, and explore popular Robot Structural Analysis topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Calculation of Steel Design, CPython3

11 REPLIES 11
SOLVED
Reply
Message 1 of 12
stefanyC6JZ7
554 Views, 11 Replies

Calculation of Steel Design, CPython3

Hi all, 

We are currently upgrading our scripts from IronPhyton 2 to CPhyton 3.

I am trying to get the calculations of steel in Robot with Dynamo, CPython3 version. I want to achieve a result like the figure shows. 

stefanyC6JZ7_0-1661179707064.png

But I get the following AttributeError : type object 'RDimServer' has no attribute 'IRDimCalcEngine' [' File "<string>", line 36, in <module>\n'].

 

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

from System import Environment
user = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
sys.path.append(user+r"\Dynamo\Dynamo Core\2.11\packages\Structural Analysis for Dynamo\bin\RSA\Interop.RobotOM.d11")

clr.AddReference('interop.RobotOM')
#clr.AddReference(user+r"\Dynamo\Dynamo Core\2.11\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
RDmEngine2 = RDimServer.IRDimCalcEngine
#optional use it if you want to set calculation parameters by the code
RDMCalpar = IRDimCalcParam
RDMCalCnf = IRDimCalcConf
RDMCalpar = RDmEngine.GetCalcParam()
RDMCalCnf = RDimEngine.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("1to7")
RDMCalpar.SetLoadsList(RdmStream)
RDmEngine.Solve(RdmStream)
#RDmEngine.Solve(None)
RdmAllResObjType = IRDimAllResObjectType
RdmAllRes = IRDimAllRes
#RdmDetRes = IRDimDetailedRes
RdmAllRes = RDmEngine.Results()
RdmAllResObjType = 1
#RdmAllResObjType = RdmAllRes.ObjectsType(IRDimAllResObjectType.I_DAROT_VERIFIED_MEMBER)
ObjCnt = RdmAllRes.ObjectsCount
RDmRetValue = IRDimMembCalcRetValue
RDmDetRes = IRDimDetailedRes
RDmDetRes = RdmAllRes.Get("1")
#RDmRetRes = RDmEngine.Results(1)
#RdmDetRes = RdmAllRes.Get(1)
Case = RDmDetRes.GovernCaseName
Ratio = RDmDetRes.Ratio
RdmCodeRes = object
RdmCodeRes = RDmDetRes.CodeResults
Nbyrd = RdmCodeRes.BuckStrenNbyrd
#OUT = 
OUT = RdmAllRes, RdmStream, Case, Ratio, Nbyrd
#OUT = "goed bezig"

Could you help me to review what is wrong with the code? 

Thank you in advance. 

 

Best Regard, 

 

Stefany 

 

11 REPLIES 11
Message 2 of 12
stefanyC6JZ7
in reply to: stefanyC6JZ7

Hi all, 

I have seen your names in similar topics, maybe one of you can help me out?

@JacquesGaudin @cool.stuff @chjpcoi 

 

Thank you in advance. 

 

Best regards, 

Stefany 

Message 3 of 12

I don't think you need this line at all. Maybe try to comment it.

 

 

RDmEngine2 = RDimServer.IRDimCalcEngine

 

 

 

The error says that the type `RDimServer` doesn't have any attribute named IRDimCalcEngine which is expected according to the API doc.

 

Did you mean this?

 

RDmEngine2 = IRDimCalcEngine

 

 

But even then RDmEngine2 is not used elsewhere in the script...

Message 4 of 12

Hi @JacquesGaudin., 

Thank you for your answer. You are right, it is not necessary the RDmEngine2, so I have commented those lines, to continue with the script. However, now I am stuck with line 15, I get the following error, "No method matches given arguments for WriteText: ()" 

RDMServer.Mode = 1
RDmEngine = IRDimCalcEngine
#RDmEngine2 = RDimServer.IRDimCalcEngine
#RDmEngine2 = IRDimCalcEngine
#optional use it if you want to set calculation parameters by the code
RDMCalpar = IRDimCalcParam
RDMCalCnf = IRDimCalcConf
RDMCalpar = RDmEngine.GetCalcParam
RDimCalcParam = RDmEngine.SetCalcConf
RDMCalCnf = RDmEngine.GetCalcConf
#RdmStream = IRDimServer.Connection.GetStream
#RDmStream = IRDimMembDefData(IRDimStream)
RDmStream = IRDimStream
RdmStream.Clear
RdmStream.WriteText("all")
I_DCPVT_MEMBERS_VERIF = 1 

 Could you help me to check why it is not working?. 

I was checking the RobotAPI documentation of steel and it says that WriteText is part of the IRDimStream interface.

Thank you in advance. 

 

 

Best regards, 

Stefany 

 

Message 5 of 12

You have some typos here. Could you please fix them before we have a look at what is going on?

 

RDMServer.Mode = 1
RDmEngine = IRDimCalcEngine
#RDmEngine2 = RDimServer.IRDimCalcEngine
#RDmEngine2 = IRDimCalcEngine
#optional use it if you want to set calculation parameters by the code
RDMCalpar = IRDimCalcParam
RDMCalCnf = IRDimCalcConf
RDMCalpar = RDmEngine.GetCalcParam
RDimCalcParam = RDmEngine.SetCalcConf
RDMCalCnf = RDmEngine.GetCalcConf
#RdmStream = IRDimServer.Connection.GetStream
#RDmStream = IRDimMembDefData(IRDimStream)
RDmStream = IRDimStream
RDmStream.Clear()  # <- Capital D in RDmStream and added brackets to call the function
RDmStream.WriteText("all")  # <- Capital D in RDmStream, should work with a string argument, not quite sure why it's complaining
I_DCPVT_MEMBERS_VERIF = 1 

 

Message 6 of 12

Hi @JacquesGaudin

 

Thank you for your reply. Now, I corrected the typos of the script. However, I still get the following error:

"TypeError : not enough arguments [' File "<string>", line 48, in <module>\n']", please see figure below. 

 

stefanyC6JZ7_0-1661334215424.png

Could you help me to check what is going wrong? 

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

from System import Environment
user = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
#sys.path.append(user+r"\Dynamo\Dynamo Core\2.11\packages\Structural Analysis for Dynamo\bin\RSA\Interop.RobotOM.d11")

#clr.AddReference('interop.RobotOM')
clr.AddReference(user+r"\Dynamo\Dynamo Core\2.11\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 = IRDimServerMode
RDMServer = application.Kernel.GetExtension("RDimServer")
#RDMServer = (IRDimServerMode.I_DSM_STEEL)#werkt niet
RDMServer.Mode = 1
RDmEngine = IRDimCalcEngine
#RDmEngine = IRDimCalcEngine(IRDimServer.CalculEngine)
#RDmEngine2 = IRDimCalcEngine
#optional use it if you want to set calculation parameters by the code
RDMCalpar = IRDimCalcParam
RDMCalCnf = IRDimCalcConf
RDMCalpar = RDmEngine.GetCalcParam
RDimCalcParam = RDmEngine.SetCalcConf
RDMCalCnf = RDmEngine.GetCalcConf
RDmStream = IRDimConnection.GetStream
#RDmStream = IRDimMembDefData(IRDimStream)
RDmStream = IRDimStream
RDmStream.Clear()  # <- Capital D in RDmStream and added brackets to call the function
RDmStream.WriteText("all") # <- Capital D in RDmStream, should work with a string argument, not quite sure why it's complaining
#RDMCalpar.SetObjsList(1,RDmStream)
RDMCalpar.SetObjsList(IRDimCalcParamVerifType.I_DCPVT_MEMBERS_VERIF, RDmStream)
RDMCalpar.SetLimitState(IRDimCalcParamLimitStateType.I_DCPLST_ULTIMATE,1)
RDmStream.Clear()
RDmStream.WriteText("1to7")

RDMCalpar.SetLoadList(RDmStream)
RDmEngine.Solve(RDmStream)
#RDmEngine.Solve(None)
RDmAllResObjType = IRDimAllResObjectType
RDmAllRes = IRDimAllRes
#RDmDetRes = IRDimDetailedRes
RDmAllRes = RDmEngine.Results()
RDmAllResObjType = 1
#RDmAllResObjType = RdmAllRes.ObjectsType(IRDimAllResObjectType.I_DAROT_VERIFIED_MEMBER)
ObjCnt = RDmAllRes.ObjectsCount
RDmRetValue = IRDimMembCalcRetValue
RDmDetRes = IRDimDetailedRes
RDmDetRes = IRDimAllRes.Get("1")
#RDmRetRes = RDmEngine.Results(1)
#RdmDetRes = RdmAllRes.Get(1)
Case = RDmDetRes.GovernCaseName
Ratio = RDmDetRes.I_DMRVT_Ratio
RDmCodeRes = object
RDmCodeRes = RDmDetRes.CodeResults
Nbyrd = RDmCodeRes.BuckStrenNbyrd
#OUT = 
OUT = RdmAllRes, RdmStream, Case, Ratio, Nbyrd
#OUT = "goed bezig"

 

Thank you in advance for your help. 

 

Best Regards, 

Stefany

 

Message 7 of 12

There is a problem in your code with the definition of RDmStream. It assigns the type to the variable rather than an instance of the type. 

 

In Python the methods of a class are usually called with the instance itself as a first argument, but if you call the method from the type, then the instance argument is not there and that messes up the method call.

 

I changed your code to the following. I hope it works.

 

RDmStream = IRDimStream(RDMServer.Connection.GetStream())  # Setting RDmStream to an instance of IRDim Stream

 

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

from System import Environment
user = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)

clr.AddReference(user+r"\Dynamo\Dynamo Core\2.11\packages\Structural Analysis for Dynamo\bin\RSA\Interop.RobotOM.dll")

from RobotOM import *
from System import Object

objects = IN[0]

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()

RDMServer = IRDimServerMode
RDMServer = application.Kernel.GetExtension("RDimServer")
RDMServer.Mode = 1
RDmEngine = IRDimCalcEngine

RDMCalpar = IRDimCalcParam
RDMCalCnf = IRDimCalcConf
RDMCalpar = RDmEngine.GetCalcParam
RDimCalcParam = RDmEngine.SetCalcConf
RDMCalCnf = RDmEngine.GetCalcConf
RDmStream = IRDimConnection.GetStream

RDmStream = IRDimStream(RDMServer.Connection.GetStream())
RDmStream.Clear()
RDmStream.WriteText("all")

RDMCalpar.SetObjsList(IRDimCalcParamVerifType.I_DCPVT_MEMBERS_VERIF, RDmStream)
RDMCalpar.SetLimitState(IRDimCalcParamLimitStateType.I_DCPLST_ULTIMATE,1)
RDmStream.Clear()
RDmStream.WriteText("1to7")

RDMCalpar.SetLoadList(RDmStream)
RDmEngine.Solve(RDmStream)

RDmAllResObjType = IRDimAllResObjectType
RDmAllRes = IRDimAllRes

RDmAllRes = RDmEngine.Results()
RDmAllResObjType = 1

ObjCnt = RDmAllRes.ObjectsCount
RDmRetValue = IRDimMembCalcRetValue
RDmDetRes = IRDimDetailedRes
RDmDetRes = IRDimAllRes.Get("1")

Case = RDmDetRes.GovernCaseName
Ratio = RDmDetRes.I_DMRVT_Ratio
RDmCodeRes = object
RDmCodeRes = RDmDetRes.CodeResults
Nbyrd = RDmCodeRes.BuckStrenNbyrd

OUT = RdmAllRes, RdmStream, Case, Ratio, Nbyrd

 

Message 8 of 12

Hi @JacquesGaudin,

 

Thank you for your reply. I have changed the code as you suggested, but now I get the following error:

"AttributeError : '__ComObject' object has no attribute 'Connection' [' File "<string>", line 38, in <module>\n']".

 

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

from System import Environment
user = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)

clr.AddReference(user+r"\Dynamo\Dynamo Core\2.11\packages\Structural Analysis for Dynamo\bin\RSA\Interop.RobotOM.dll")

from RobotOM import *
from System import Object

objects = IN[0]

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()

RDMServer = IRDimServerMode
RDMServer = application.Kernel.GetExtension("RDimServer")
RDMServer.Mode = 1
RDmEngine = IRDimCalcEngine

RDMCalpar = IRDimCalcParam
RDMCalCnf = IRDimCalcConf
RDMCalpar = RDmEngine.GetCalcParam
RDimCalcParam = RDmEngine.SetCalcConf
RDMCalCnf = RDmEngine.GetCalcConf
RDmStream = IRDimConnection.GetStream

RDmStream = IRDimStream(RDMServer.Connection.GetStream())
RDmStream.Clear()
RDmStream.WriteText("all")

RDMCalpar.SetObjsList(IRDimCalcParamVerifType.I_DCPVT_MEMBERS_VERIF, RDmStream)
RDMCalpar.SetLimitState(IRDimCalcParamLimitStateType.I_DCPLST_ULTIMATE,1)
RDmStream.Clear()
RDmStream.WriteText("1to7")

RDMCalpar.SetLoadList(RDmStream)
RDmEngine.Solve(RDmStream)

RDmAllResObjType = IRDimAllResObjectType
RDmAllRes = IRDimAllRes

RDmAllRes = RDmEngine.Results()
RDmAllResObjType = 1

ObjCnt = RDmAllRes.ObjectsCount
RDmRetValue = IRDimMembCalcRetValue
RDmDetRes = IRDimDetailedRes
RDmDetRes = IRDimAllRes.Get("1")

Case = RDmDetRes.GovernCaseName
Ratio = RDmDetRes.I_DMRVT_Ratio
RDmCodeRes = object
RDmCodeRes = RDmDetRes.CodeResults
Nbyrd = RDmCodeRes.BuckStrenNbyrd

OUT = RdmAllRes, RdmStream, Case, Ratio, Nbyrd

I have tried to change it into two different ways but I still do not get the script working properly. 

RDmStream = IRDimStream(IRDimServer.Connection.GetStream())

First I changed line 38, but I get the following error:

" instance property must be accessed through a class instance [' File "<string>", line 38, in <module>\n']"

RDmStream = IRDimStream(IRDimConnection.GetStream())

Then, I changed same line, but the following error appears: 

"Warning: TypeError : not enough arguments [' File "<string>", line 38, in <module>\n']"

 

Could you help me to check what is going wrong with the script?

 

 

Thank you in advance.

Best regards, 

Stefany 

 

 

Message 9 of 12

The error message says that `RDmServer` is a plain COM object and doesn't have any attribute named Connection.

 

"AttributeError : '__ComObject' object has no attribute 'Connection' [' File "<string>", line 38, in <module>\n']".

 

So, as previously explianed the fix is to cast to the expected type, in this instance IRDimServer:

 

RDMServer = IRDimServer(application.Kernel.GetExtension("RDimServer"))

 

Most of the errors you encounter are of this type. I'm going to be away for two weeks so try and understand how to fix them by yourself. If there is something you don't understand, I can answer your question until tonight.

 

The revised script:

 

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

from System import Environment
user = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)

clr.AddReference(user+r"\Dynamo\Dynamo Core\2.11\packages\Structural Analysis for Dynamo\bin\RSA\Interop.RobotOM.dll")

from RobotOM import *
from System import Object

objects = IN[0]

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()

RDMServer = IRDimServer(application.Kernel.GetExtension("RDimServer"))
RDMServer.Mode = 1
RDmEngine = IRDimCalcEngine

RDMCalpar = IRDimCalcParam
RDMCalCnf = IRDimCalcConf
RDMCalpar = RDmEngine.GetCalcParam
RDimCalcParam = RDmEngine.SetCalcConf
RDMCalCnf = RDmEngine.GetCalcConf
RDmStream = IRDimConnection.GetStream

RDmStream = IRDimStream(RDMServer.Connection.GetStream())
RDmStream.Clear()
RDmStream.WriteText("all")

RDMCalpar.SetObjsList(IRDimCalcParamVerifType.I_DCPVT_MEMBERS_VERIF, RDmStream)
RDMCalpar.SetLimitState(IRDimCalcParamLimitStateType.I_DCPLST_ULTIMATE,1)
RDmStream.Clear()
RDmStream.WriteText("1to7")

RDMCalpar.SetLoadList(RDmStream)
RDmEngine.Solve(RDmStream)

RDmAllResObjType = IRDimAllResObjectType
RDmAllRes = IRDimAllRes

RDmAllRes = RDmEngine.Results()
RDmAllResObjType = 1

ObjCnt = RDmAllRes.ObjectsCount
RDmRetValue = IRDimMembCalcRetValue
RDmDetRes = IRDimDetailedRes
RDmDetRes = IRDimAllRes.Get("1")

Case = RDmDetRes.GovernCaseName
Ratio = RDmDetRes.I_DMRVT_Ratio
RDmCodeRes = object
RDmCodeRes = RDmDetRes.CodeResults
Nbyrd = RDmCodeRes.BuckStrenNbyrd

OUT = RdmAllRes, RdmStream, Case, Ratio, Nbyrd

 

Message 10 of 12

Hi all, 

 

Thank you for your reply. I could develop the code a bit further, and I got two results, the Ratio and Case Name. Please see the figure below. 

stefanyC6JZ7_1-1661780992641.png

 

The problem is that I also want the results from Eurocode3, for example, as red box shows in the next figure the Ny,b,Rd. But I get the following error: "AttributeError : '__ComObject' object has no attribute 'BuckStrenNbyrd'".

stefanyC6JZ7_2-1661781025774.png

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

from System import Environment
user = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)

clr.AddReference(user+r"\Dynamo\Dynamo Core\2.11\packages\Structural Analysis for Dynamo\bin\RSA\Interop.RobotOM.dll")

from RobotOM import *
from System import Object

objects = IN[0]

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()

RDMServer = IRDimServer(application.Kernel.GetExtension("RDimServer"))
RDMServer.Mode = 1
RDmEngine = IRDimCalcEngine(RDMServer.CalculEngine)
RDMCalpar = IRDimCalcParam(RDmEngine.GetCalcParam())
RDMCalCnf = IRDimCalcConf(RDmEngine.GetCalcConf())
RDmStream = IRDimStream(RDMServer.Connection.GetStream())

RDmStream.Clear()
RDmStream.WriteText("all")
RDMCalpar.SetObjsList(IRDimCalcParamVerifType.I_DCPVT_MEMBERS_VERIF, RDmStream)
RDMCalpar.SetLimitState(IRDimCalcParamLimitStateType.I_DCPLST_ULTIMATE,1)
RDmStream.Clear()
RDmStream.WriteText("1to4")

RDMCalpar.SetLoadsList(RDmStream)
RDmEngine.Solve(RDmStream)
RDmAllResObjType = IRDimAllResObjectType
RDmAllRes = IRDimAllRes(RDmEngine.Results())
IRDimAllResObjectType = 1

ObjCnt = RDmAllRes.ObjectsCount
RDmRetValue = IRDimMembCalcRetValue
RDmDetRes = IRDimDetailedRes(RDmAllRes.Get("1"))

Case = RDmDetRes.GovernCaseName
Ratio = RDmDetRes.Ratio
RDmCodeRes = Object
RDmCodeRes = RDmDetRes.CodeResults
Nbyrd = RDmCodeRes.BuckStrenNbyrd
#RDmCodeRes = IRDimCodeResEC3(structure(RDmCodeRes(IRDimDetailedRes.CodeResults.BuckStrenNbyrd("1"))))

OUT = Case, Ratio 



Then, I have been trying to call the attribute as line 55 shows:

RDmCodeRes = IRDimCodeResEC3(structure(RDmCodeRes(IRDimDetailedRes.CodeResults.BuckStrenNbyrd("1"))))

But, it is not working and I get the following error :" instance property must be accessed through a class instance [' File "<string>", line 55, in <module>\n']"

Could someone help me to check what is missing in the code? To get through the comObject and Class instance.

Thank you in advance.

 

 

@chjpcoi @cool.stuff @gwizdzm I have seen your names in similar topics. 

 

Best regards, 

Stefany

Message 11 of 12
1234eddie
in reply to: stefanyC6JZ7

Hi all,

 

Question is still goiing on. 

Maybe @LionelDallenne @vise92 @benameram @milczarekuba @lukasz_koc2 or others know how to get this one?

 

Thanks in advance

Gr Edward

Message 12 of 12
stefanyC6JZ7
in reply to: 1234eddie

Hi @JacquesGaudin

Thank you for your reply. We have solved the script, it is working perfectly. Thank you very much for your help solving the issues and with help from dynamo forum. 

https://forum.dynamobim.com/t/calculation-of-steel-design-cpython3/80447/7 

 

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

from System import Environment
user = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)

clr.AddReference(user+r"\Dynamo\Dynamo Core\2.11\packages\Structural Analysis for Dynamo\bin\RSA\Interop.RobotOM.dll")


from RobotOM import RobotApplicationClass, IRDimCalcParamVerifType, IRDimCalcParamLimitStateType
clr.AddReference("System.Reflection")
from System.Reflection import BindingFlags
from RobotOM import *
from System import Object

class ComObj:
    def __init__(self, obj):
        self.obj = obj
        self.typ = obj.GetType()

    def __getattr__(self, name):       
        def newm(*args):
            args = args or (None,)
            return self.typ.InvokeMember(
                name, 
                BindingFlags.InvokeMethod | BindingFlags.GetProperty, 
                None,
                self.obj,
                *args,
            )
        return newm


objects = IN[0]

application = RobotApplicationClass()
project = application.Project
project.ViewMngr.Refresh()
calc_engine = project.CalcEngine
calc_engine.AnalysisParams.IgnoreWarnings = True
calc_engine.AutoGenerateModel = True
calc_engine.UseStatusWindow = True
calc_engine.Calculate()

rdm_server = IRDimServer(application.Kernel.GetExtension("RDimServer"))
rdm_server.Mode = 1
rdm_calc_engine = IRDimCalcEngine(rdm_server.CalculEngine)
calc_param = IRDimCalcParam(rdm_calc_engine.GetCalcParam())
calc_conf = rdm_calc_engine.GetCalcConf()
stream = IRDimStream(rdm_server.Connection.GetStream())

stream.Clear()
stream.WriteText("all")
calc_param.SetObjsList(IRDimCalcParamVerifType.I_DCPVT_MEMBERS_VERIF, stream)
calc_param.SetLimitState(IRDimCalcParamLimitStateType.I_DCPLST_ULTIMATE,1)
stream.Clear()
stream.WriteText("1to4")

calc_param.SetLoadsList(stream)
rdm_calc_engine.Solve(stream)
all_results = IRDimAllRes(rdm_calc_engine.Results())

detailed_results = IRDimDetailedRes(all_results.Get("1"))
case = detailed_results.GovernCaseName
ratio = detailed_results.Ratio
code_results = ComObj(detailed_results.CodeResults)
Nbyrd = code_results.BuckStrenNbyrd()
Myelrd = code_results.ElastMomStrenMelyrd()
OUT = case, ratio, Nbyrd, Myelrd

 

Best regards, 

Stefany

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report