Hello,
i'm trying to retrieve CodeResults using RobotOM steel API. My code (at the failure lines) goes like this:
....
....
IRDimDetailedRes RDmDetRes;
RDmDetRes = (IRDimDetailedRes) RdmAllRes.Get(49); //get a specific bar
IRDimCodeResEC3 RdmCodeRes;
RdmCodeRes = (IRDimCodeResEC3) RDmDetRes.CodeResults;
double MPl = RdmCodeRes.PlastMomStrenMplyrd;
When i run my code I get this error message:
error: Unable to cast COM object of type 'System.__ComObject' to interface type 'RobotOM.IRDimCodeResEC3'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{21F70924-8B6C-470F-A19F-5DC40565936D}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)). (line: 186)
Am i using the wrong Code interface? Do i have to instansiate the codeparams for the specific code before that?
Thanks in advance.
Rafal,
still that interface does not exist. I've also tried updating the com interface (from autodesks support page/COM hotfix)
but no change...
// new object Robot application
RobotApplication robApp;
robApp = new RobotApplicationClass();
robApp.Interactive = 1;
if (robApp.Project.IsActive == 0)
{
System.Windows.Forms.MessageBox.Show("ERROR : Open an instance of Robot with the Model you would like to Design");
return;
}
// Dim robapp As IRobotStructure
IRobotStructure str;
str = robApp.Project.Structure;
int res = robApp.Project.Structure.Results.Available;
if (res == 0){
RobotCalcEngine CalcEngine; //
CalcEngine = robApp.Project.CalcEngine; // Calculation Engine
CalcEngine.Calculate(); // Run Calculations
}
IRDimServer server = (IRDimServer) robApp.Kernel.GetExtension("RDimServer");
server.Mode = IRDimServerMode.I_DSM_STEEL;
IRDimCalcEngine RDMEngine;
RDMEngine = server.CalculEngine;
IRDimCalcParam RDmCalPar;
IRDimCalcConf RDmCalCnf;
RDmCalPar = RDMEngine.GetCalcParam();
RDmCalCnf = RDMEngine.GetCalcConf();
RDimStream RdmStream; //Data stream for setting parameters
RdmStream = server.Connection.GetStream();
RdmStream.Clear();
//Calculate results for all sections
RdmStream.WriteText("all");
RDmCalPar.SetObjsList(IRDimCalcParamVerifType.I_DCPVT_MEMBERS_VERIF, RdmStream);//members verification
RDmCalPar.SetLimitState(IRDimCalcParamLimitStateType.I_DCPLST_ULTIMATE, 1);//Set Limit State
RdmStream.Clear();
RdmStream.WriteText("9"); //Set Load Case
RDmCalPar.SetLoadsList(RdmStream);
RDMEngine.SetCalcConf(RDmCalCnf);
RDMEngine.SetCalcParam(RDmCalPar);
RDMEngine.Solve(null); //Solve Calculations for defined members
IRDimAllRes RdmAllRes;
IRDimDetailedRes RdmDetRes;
RdmAllRes = RDMEngine.Results();
IRDimDetailedRes RDmDetRes;
RDmDetRes = (IRDimDetailedRes) RdmAllRes.Get(49);
//IRDimCodeResEC3
IRDimCodeResE32 RdmCodeRes;
RdmCodeRes = (IRDimCodeResE32) RDmDetRes.CodeResults;
double Mply = RdmCodeRes.PlastMomStrenMplyrd;
What is the code set in Job Prefereces?
It should be ENV 1993-1-2005/AC:2009
One more hint: check whether the results for selected bar exist (not null)
Rafal,
i'm using that code and that i'm calculating design resluts for all the bars. Could you please send me the list of parent interfaces used in the API for Eurocode design codes? Or does IRDimEurocodeE32 superseeds all the previous eurocode interfaces?
IRDimCodeResEC3 - old eurocode
IRDimCodeResEC32 - new one and all NADs. You should be able to get results for all NADs but setting some country specific data for calculations may not be possible.
There are also interfaces for PN, ASD, CM66 codes in Robot.