viktor.external.sap2000
SAP2000Analysis
- class viktor.external.sap2000.sap2000.SAP2000Analysis(script=None, script_key='', files=None, output_filenames=None)
Bases:
PythonAnalysisNew in 14.17.0SAP2000Analysis can be used to evaluate a SAP2000-python script on third-party infrastructure. The script is expected to be blocking, i.e. if the script is invoked from command prompt, it should wait until the executable is finished. The default behaviour, is that the python script is defined within the app and send to the worker to be executed on third-party infrastructure. If desired (due to security considerations) the worker can be configured to only run local scripts. These scripts must be defined the in worker configuration file and can be selected through the script_key.
Usage:
script = vkt.File.from_path(Path(__file__).parent / "run_sap2000.py") files = [ ('input1.txt', file1), ] analysis = SAP2000Analysis(script=script, files=files, output_filenames=["output.txt"]) analysis.execute(timeout=60) output_file = analysis.get_output_file("output.txt")Exceptions which can be raised during calculation:
viktor.errors.LicenseError: no license availableviktor.errors.ExecutionError: generic error. Error message provides more information
- Parameters:
script (
File) – Script file that is transferred to the working directory on the server.script_key (
str) – The key of the script that needs to be run. Only use this when the worker is configured to run local scripts. This key should be present in the configuration file of the worker.files (
List[Tuple[str,BytesIO|File]]) – Additional files that are transferred to the working directory on the server. Each file is a tuple containing the content and the filename which is used to save on the infrastructure.output_filenames (
List[str]) – A list of filenames (including extension) that are to be transferred back to the app. This filename is relative to the working directory.
Either one of ‘script’ or ‘script_key’ should be defined.
- Raises:
ValueError – when neither ‘script’ or ‘script_key’ is included OR when both are included.
SAP2000Connection
- class viktor.external.sap2000.sap2000.SAP2000Connection(session)
Bases:
_CSIConnectionNew in 14.32.0The
sapobject returned byconnect(), used to control SAP2000 through the SAP2000 OAPI. Use the default OAPI calls with comtypes syntax. Each call returns the OAPI result: the status code, or[*out_params, status]when the call has output parameters.Warning
Do not instantiate this class directly; obtain it from
connect().
connect
- viktor.external.sap2000.sap2000.connect(timeout=60)
- New in 14.32.0
Connect to SAP2000 running on a connected VIKTOR worker and control it through the SAP2000 OAPI directly from your app, as shown below.
Warning
This is a BETA feature.
Requires a worker of kind
sap2000connect. Declare it in your viktor.config.toml:worker_integrations = [ "sap2000connect", ]Usage:
import viktor as vkt with vkt.sap2000.connect(timeout=60) as sap: ret = sap.InitializeNewModel(vkt.sap2000.eUnits.kN_m_C) # a call returns the status code [beam_name, ret] = sap.FrameObj.AddByCoord(0, 0, 0, 6, 0, 0, "", "Default", "Beam", "Global") [pt_i, pt_j, ret] = sap.FrameObj.GetPoints(beam_name, "", "") # ...or out-params, then status sap.File.Save("model.sdb") # use a relative filename, not an absolute pathNote
The OAPI members you call on
sap(e.g.sap.FrameObj.AddByCoord) mirror the SAP2000 OAPI and are surfaced through IDE autocomplete rather than listed here. Look them up in the SAP2000 OAPI reference: the CSI OAPI help file (.chm) in your SAP2000 installation directory (e.g.C:/Program Files/Computers and Structures/SAP2000 <version>/), or on CSI’s developer site.- Parameters:
timeout (
int) – per-call timeout in seconds.- Return type:
Exceptions which can be raised during execution:
viktor.errors.ExecutionError: generic error. Error message provides more information. A host whose SAP2000 license is not activated also fails this way: SAP2000 blocks on an interactive sign-in dialog that the worker cannot answer, so starting it up times out.viktor.errors.WorkerSessionError: the session was lost (e.g. its SAP2000 instance was torn down). The session cannot be resumed; start a new one to continue.TimeoutError: a call took longer than
timeout
OAPI enum values, generated from SAP2000 27.1.0 (Ultimate).
e2DFrameType
e3DFrameType
eBridgeCodeAASHTO
- class viktor.external.sap2000.enums.eBridgeCodeAASHTO(*values)
Bases:
IntEnumNew in 14.32.0SAP2000 OAPI
eBridgeCodeAASHTOvalues, mirroring the CSiAPIv1 names so code reads like the OAPI docs.- AASHTO_LRFD_2007 = 1
- AASHTO_LRFD_2012 = 2
- AASHTO_LRFD_2014 = 3
- AASHTO_LRFD_2017 = 4
- AASHTO_LRFD_2020 = 5
- AASHTO_STD_2002 = 0
eBridgeCodeInterims
- class viktor.external.sap2000.enums.eBridgeCodeInterims(*values)
Bases:
IntEnumNew in 14.32.0SAP2000 OAPI
eBridgeCodeInterimsvalues, mirroring the CSiAPIv1 names so code reads like the OAPI docs.- Interim_2011 = 1
- Interim_2012 = 2
- Interim_2013 = 3
- Interim_2014 = 4
- Interim_2015 = 5
- NoInterims = 0
eBridgeObjectBentPart
eBridgeObjectFoundationPart
eBridgeObjectType
eBridgeObjectUserPointType
eBridgeResponseDesignRating
- class viktor.external.sap2000.enums.eBridgeResponseDesignRating(*values)
Bases:
IntEnumNew in 14.32.0SAP2000 OAPI
eBridgeResponseDesignRatingvalues, mirroring the CSiAPIv1 names so code reads like the OAPI docs.- Design_Crack_Bot_Crack_Width = 55
- Design_Crack_Top_Bot_Crack_Widths = 56
- Design_Crack_Top_Crack_Width = 54
- Design_Fatigue_Bot_Flange_Lateral_Bending_Stress_Range = 75
- Design_Fatigue_Bot_Flange_Tensile_Stress_Range_Without_FLB = 74
- Design_Fatigue_DC_Ratio_Web_Shear = 76
- Design_Fatigue_Top_Flange_Tensile_Stress_Range_Without_FLB = 73
- Design_Flexure_Moment_About_Horizontal_Axis_M3 = 64
- Design_Principal_Stress_Beam_Web_Bot = 61
- Design_Principal_Stress_Beam_Web_Top = 60
- Design_Principal_Stress_Envelope = 57
- Design_Principal_Stress_Neutral_Axis = 62
- Design_Principal_Stress_Web_Bot = 59
- Design_Principal_Stress_Web_Top = 58
- Design_Shear_Controlling_DC_Ratio = 43
- Design_Shear_Controlling_Shear_DC_Ratio = 34
- Design_Shear_Controlling_Torsion_DC_Ratio = 35
- Design_Shear_Demand_Concrete_Shear_Capacity_Ratio = 33
- Design_Shear_Longit_Rebar_Area = 45
- Design_Shear_Longit_Rebar_Area_Beam = 50
- Design_Shear_Longit_Rebar_Area_Bot_Flange = 48
- Design_Shear_Longit_Rebar_Area_Bot_Slab = 46
- Design_Shear_Longit_Rebar_Area_Slab = 49
- Design_Shear_Longit_Rebar_Area_Top_Slab = 47
- Design_Shear_Longit_Torsional_Rebar_Area_PerL = 51
- Design_Shear_Rebar_Area_PerL = 44
- Design_Shear_Required_Extra_Longit_Rebar_Area = 37
- Design_Shear_Required_Extra_Longit_Rebar_Area_Beam = 42
- Design_Shear_Required_Extra_Longit_Rebar_Area_Bot_Slab = 39
- Design_Shear_Required_Extra_Longit_Rebar_Area_For_Torsion = 38
- Design_Shear_Required_Extra_Longit_Rebar_Area_Slab = 41
- Design_Shear_Required_Extra_Longit_Rebar_Area_Top_Slab = 40
- Design_Shear_Required_Extra_Shear_Rebar_Area_PerL = 36
- Design_Shear_Torsion_Plus_Shear_Rebar_Area_PerL = 53
- Design_Shear_Torsion_Rebar_Area_PerL = 52
- Design_Strength_DC_Ratio_FlexureShearInteract_Neg = 71
- Design_Strength_DC_Ratio_FlexureShearInteract_Pos = 70
- Design_Strength_DC_Ratio_Negative_Moment = 66
- Design_Strength_DC_Ratio_Net_Section_Fracture_Neg = 69
- Design_Strength_DC_Ratio_Net_Section_Fracture_Pos = 68
- Design_Strength_DC_Ratio_Positive_Moment = 65
- Design_Strength_DC_Ratio_Shear = 67
- Design_Strength_Total_Nominal_Shear_Force_6_10_10_4_2 = 72
- Design_Tendon_Stress_Controlling_DC_Ratio = 63
- Rating_ASM_Rating = 94
- Rating_Flexure = 81
- Rating_Flexure_Factored_Moment_Resistance = 82
- Rating_Flexure_Factored_Moment_Resistance_UMr = 83
- Rating_Flexure_Live_load_Capacity_Factor_F = 84
- Rating_LFM_Service_Rating = 96
- Rating_LFM_Strength_Rating = 95
- Rating_MinRebar_Flexure_Rating = 92
- Rating_MinRebar_Min_Of_Abs_1_2Mcr_And_Abs_1_33Mu_For_Neg = 91
- Rating_MinRebar_Min_Of_Abs_1_2Mcr_And_Abs_1_33Mu_For_Pos = 90
- Rating_Service = 93
- Rating_Service_Flexure_Rating = 89
- Rating_Shear = 77
- Rating_Shear_Factored_Shear_Resistance = 78
- Rating_Shear_Factored_Shear_Resistance_UVr = 79
- Rating_Shear_Live_load_Capacity_Factor_F = 80
- Rating_Strength_Flexure_Rating = 86
- Rating_Strength_Live_load_Capacity_Factor_F_Moment_M3 = 87
- Rating_Strength_Live_load_Capacity_Factor_F_Shear_V2 = 88
- Rating_Strength_Shear_Rating = 85
- S11_Longitudinal_Beam_Bot_Center = 39
- S11_Longitudinal_Beam_Bot_Envelope = 32
- S11_Longitudinal_Beam_Bot_Left = 29
- S11_Longitudinal_Beam_Bot_Right = 31
- S11_Longitudinal_Beam_Top_Center = 10
- S11_Longitudinal_Beam_Top_Envelope = 12
- S11_Longitudinal_Beam_Top_Left = 9
- S11_Longitudinal_Beam_Top_Right = 11
- S11_Longitudinal_Bot_Center = 15
- S11_Longitudinal_Bot_Envelope = 18
- S11_Longitudinal_Bot_Left = 13
- S11_Longitudinal_Bot_Left_Corner = 14
- S11_Longitudinal_Bot_Right = 16
- S11_Longitudinal_Bot_Right_Corner = 17
- S11_Longitudinal_Girder_Bot_Envelope = 21
- S11_Longitudinal_Girder_Bot_Left = 19
- S11_Longitudinal_Girder_Bot_Right = 20
- S11_Longitudinal_Slab_Bot_Beam_Center = 24
- S11_Longitudinal_Slab_Bot_Beam_Left = 23
- S11_Longitudinal_Slab_Bot_Beam_Right = 25
- S11_Longitudinal_Slab_Bot_Center = 26
- S11_Longitudinal_Slab_Bot_Envelope = 28
- S11_Longitudinal_Slab_Bot_Left = 22
- S11_Longitudinal_Slab_Bot_Right = 27
- S11_Longitudinal_Slab_Top_Beam_Center = 6
- S11_Longitudinal_Slab_Top_Center = 5
- S11_Longitudinal_Slab_Top_Envelope = 8
- S11_Longitudinal_Slab_Top_Left = 4
- S11_Longitudinal_Slab_Top_Right = 7
- S11_Longitudinal_Top_Center = 1
- S11_Longitudinal_Top_Envelope = 3
- S11_Longitudinal_Top_Left = 0
- S11_Longitudinal_Top_Right = 2
eBridgeResponseDisplDOF
- class viktor.external.sap2000.enums.eBridgeResponseDisplDOF(*values)
Bases:
IntEnumNew in 14.32.0SAP2000 OAPI
eBridgeResponseDisplDOFvalues, mirroring the CSiAPIv1 names so code reads like the OAPI docs.- Avg_Longitudinal_Rotation = 4
- Longitudinal_Displacement = 2
- Longitudinal_Rotation = 3
- Transverse_Displacement = 1
- Vertical_Displacement = 0
eBridgeResponseDisplLoc
- class viktor.external.sap2000.enums.eBridgeResponseDisplLoc(*values)
Bases:
IntEnumNew in 14.32.0SAP2000 OAPI
eBridgeResponseDisplLocvalues, mirroring the CSiAPIv1 names so code reads like the OAPI docs.- Left_Web = 5
- Left_Web_Bottom = 4
- Left_Web_Top = 3
- Right_Web = 8
- Right_Web_Bottom = 7
- Right_Web_Top = 6
- Slab_Center = 9
- Web = 2
- Web_Bottom = 1
- Web_Top = 0
eBridgeResponseForce
- class viktor.external.sap2000.enums.eBridgeResponseForce(*values)
Bases:
IntEnumNew in 14.32.0SAP2000 OAPI
eBridgeResponseForcevalues, mirroring the CSiAPIv1 names so code reads like the OAPI docs.- Axial_Force_P = 1
- Moment_About_Horizontal_Axis_M3 = 6
- Moment_About_Vertical_Axis_M2 = 5
- Shear_Horizontal_V3 = 3
- Shear_Vertical_V2 = 2
- Torsion_T = 4
eBridgeResponsePart
- class viktor.external.sap2000.enums.eBridgeResponsePart(*values)
Bases:
IntEnumNew in 14.32.0SAP2000 OAPI
eBridgeResponsePartvalues, mirroring the CSiAPIv1 names so code reads like the OAPI docs.- All_Beams = 7
- All_Girders = 6
- All_Slabs = 9
- All_Webs = 8
- Beam = 3
- Entire_Bridge_Section = 1
- Entire_Section_Plus_All_Girders = 10
- Girder = 2
- Slab = 5
- Web = 4
eBridgeResponseStress
- class viktor.external.sap2000.enums.eBridgeResponseStress(*values)
Bases:
IntEnumNew in 14.32.0SAP2000 OAPI
eBridgeResponseStressvalues, mirroring the CSiAPIv1 names so code reads like the OAPI docs.- S11_Lateral_Bending_Bot = 25
- S11_Lateral_Bending_Top = 22
- S11_Lateral_Bending_Top_ULeft = 23
- S11_Lateral_Bending_Top_URight = 24
- S11_Longitudinal_Bot_Beam_Left = 16
- S11_Longitudinal_Bot_Beam_Right = 17
- S11_Longitudinal_Bot_Center = 14
- S11_Longitudinal_Bot_Envelope = 18
- S11_Longitudinal_Bot_Left = 13
- S11_Longitudinal_Bot_Right = 15
- S11_Longitudinal_Top_Beam_Center = 3
- S11_Longitudinal_Top_Bot_Center = 20
- S11_Longitudinal_Top_Bot_Left = 19
- S11_Longitudinal_Top_Bot_Right = 21
- S11_Longitudinal_Top_Center = 1
- S11_Longitudinal_Top_Envelope = 4
- S11_Longitudinal_Top_Left = 0
- S11_Longitudinal_Top_Right = 2
- S11_Longitudinal_Top_ULeft_Center = 6
- S11_Longitudinal_Top_ULeft_Envelope = 8
- S11_Longitudinal_Top_ULeft_Left = 5
- S11_Longitudinal_Top_ULeft_Right = 7
- S11_Longitudinal_Top_URight_Center = 10
- S11_Longitudinal_Top_URight_Envelope = 12
- S11_Longitudinal_Top_URight_Left = 9
- S11_Longitudinal_Top_URight_Right = 11