Generate EC8 General seismic case through API

Generate EC8 General seismic case through API

Anonymous
Not applicable
968 Views
5 Replies
Message 1 of 6

Generate EC8 General seismic case through API

Anonymous
Not applicable

Hello to everyone,

I have a problem when I want to generate a seismic case according to EC8 General via VBA.

The code I wrote is the following:

 

Dim EQLoad As RobotSimpleCase
    Dim ECParams As RobotSeismicAnalysis_EC8_General_Params
    Dim ModalParams As RobotModalAnalysisParams
    
    
    If Not Robapp.Visible Then
        Set Robapp = Nothing
        MsgBox "Open Robot and load Model", vbOKOnly, "ERROR"
        Exit Sub
    Else
        
        Set EQLoad = Robapp.Project.Structure.Cases.CreateSimple(100, "Modal", I_CN_EXPLOATATION, I_CAT_DYNAMIC_MODAL)
        Set ModalParams = EQLoad.GetAnalysisParams
        ModalParams.ModesCount = 20
        EQLoad.SetAnalysisParams ModalParams
        
        Set EQLoad = Robapp.Project.Structure.Cases.CreateSimple(200, "EarthQuake+X", I_CN_SEISMIC, I_CAT_DYNAMIC_SEISMIC)
        Set ECParams = EQLoad.GetAnalysisParams
        ECParams.Ag = Foglio2.Range("F9")
        ECParams.B = 0.2
        ECParams.BehaviorFactor = Foglio2.Range("F14")
        ECParams.DirectionType = I_SADT_HORIZONTAL
        ECParams.Direction.Set 1, 0, 0
        ECParams.ExcitationDir.ResolutionActive = True
        ECParams.S = Foglio2.Range("F5")
        ECParams.Spectrum = I_SAST_DIMENSIONING
        ECParams.Tb = Foglio2.Range("F6")
        ECParams.Tc = Foglio2.Range("F7")
        ECParams.Td = Foglio2.Range("F8")
        
        Set EQLoad = Robapp.Project.Structure.Cases.CreateSimple(201, "EarthQuake+Y", I_CN_SEISMIC, I_CAT_DYNAMIC_SEISMIC)
        Set ECParams = EQLoad.GetAnalysisParams
        ECParams.Ag = Foglio2.Range("F9")
        ECParams.B = 0.2
        ECParams.BehaviorFactor = Foglio2.Range("F14")
        ECParams.DirectionType = I_SADT_HORIZONTAL
        ECParams.Direction.Set 0, 1, 0
        ECParams.ExcitationDir.ResolutionActive = True
        ECParams.S = Foglio2.Range("F5")
        ECParams.Spectrum = I_SAST_DIMENSIONING
        ECParams.Tb = Foglio2.Range("F6")
        ECParams.Tc = Foglio2.Range("F7")
        ECParams.Td = Foglio2.Range("F8")

What is it wrong in it?

I receive a Type Mismatch error when the line

Set ECParams = EQLoad.GetAnalysisParams

try to run.

 

Has someone the solution or an example which explain how to do it?

 

Thank you in advance! 

0 Likes
Accepted solutions (2)
969 Views
5 Replies
Replies (5)
Message 2 of 6

Rafal.Gaweda
Autodesk Support
Autodesk Support

Hi @Anonymous

 

These Params are implemented for EN 1998-1:2004/A1:2013

 

Example code:

 

 

Dim EC_Params  As RobotSeismicAnalysis_EC_8_Params
Dim RCase As RobotSimpleCase

Set RCase = Robapp.Project.Structure.Cases.CreateSimple(Robapp.Project.Structure.Cases.FreeNumber, "Modal", I_CN_PERMANENT, I_CAT_DYNAMIC_MODAL)

Set RCase = Robapp.Project.Structure.Cases.CreateSimple(Robapp.Project.Structure.Cases.FreeNumber, "Seismic EC", I_CN_SEISMIC, I_CAT_DYNAMIC_SEISMIC)
aaa = RCase.GetSeismicCode

Set EC_Params = RCase.GetAnalysisParams

EC_Params.BehaviorFactor = 1#
EC_Params.Direction.Set 1, 1, 1
EC_Params.DirectionType = I_SADT_HORIZONTAL
EC_Params.SoilClass = I_SAST_EC_8_SOIL_A
EC_Params.SpectrumType = I_SAST_DIMENSIONING
EC_Params.StructureType = I_SAST_EC_8_B
EC_Params.ZoneType = I_SAZT_EC_8_IA

RCase.SetAnalysisParams EC_Params

 



Rafal Gaweda
0 Likes
Message 3 of 6

Anonymous
Not applicable

Hi @Rafal.Gaweda,

thank you for your reply. However, I asked for the General EC 8, not the standard. This because I need to define the Tb, Tc, Td (and so on) parameters instead of the parameters given in the other EC8 parameters.

0 Likes
Message 4 of 6

Rafal.Gaweda
Autodesk Support
Autodesk Support

Hi @Anonymous

 

So :

 

Dim EC_Params  As RobotSeismicAnalysis_EC8_General_Params
Dim RCase As RobotSimpleCase

Set RCase = Robapp.Project.Structure.Cases.CreateSimple(Robapp.Project.Structure.Cases.FreeNumber, "Modal", I_CN_PERMANENT, I_CAT_DYNAMIC_MODAL)

Set RCase = Robapp.Project.Structure.Cases.CreateSimple(Robapp.Project.Structure.Cases.FreeNumber, "Seismic EC", I_CN_SEISMIC, I_CAT_DYNAMIC_SEISMIC)

Set EC_Params = RCase.GetAnalysisParams

EC_Params.Ag = 1
EC_Params.B = 1
EC_Params.BehaviorFactor = 1
EC_Params.DirectionType = I_SADT_HORIZONTAL
EC_Params.Tb = 1
'......
RCase.SetAnalysisParams EC_Params

 



Rafal Gaweda
0 Likes
Message 5 of 6

Anonymous
Not applicable
Accepted solution

Yes, exactly what I wrote before. the problem was that when running, the program gave me an error of type mismatch.

But I found the solution: in the model, in job preferences, the code for loads was set to EC8 and not the General one. Changing this setting, the program runs correctly. 🙂

0 Likes
Message 6 of 6

Anonymous
Not applicable
Accepted solution

It is sufficient to add the following code before creating loads:

Robapp.Project.Preferences.SetActiveCode I_CT_SEISMIC_LOADS, "EN 1998-1:2004/A1:2013-General"
0 Likes