RS2Scripting 11.23.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. RS2Scripting-11.23.0.dist-info/License.txt +20 -0
  2. RS2Scripting-11.23.0.dist-info/METADATA +147 -0
  3. RS2Scripting-11.23.0.dist-info/RECORD +188 -0
  4. RS2Scripting-11.23.0.dist-info/WHEEL +5 -0
  5. RS2Scripting-11.23.0.dist-info/top_level.txt +1 -0
  6. rs2/BaseModel.py +46 -0
  7. rs2/Units.py +6 -0
  8. rs2/__init__.py +0 -0
  9. rs2/_common/Client.py +67 -0
  10. rs2/_common/ProxyObject.py +12 -0
  11. rs2/_common/__init__.py +0 -0
  12. rs2/_common/documentProxy.py +5 -0
  13. rs2/interpreter/InterpreterEnums.py +86 -0
  14. rs2/interpreter/InterpreterGraphEnums.py +54 -0
  15. rs2/interpreter/InterpreterModel.py +328 -0
  16. rs2/interpreter/RS2Interpreter.py +78 -0
  17. rs2/interpreter/_UtilityResult.py +20 -0
  18. rs2/interpreter/__init__.py +0 -0
  19. rs2/interpreter/queryResults/HistoryQueryResults.py +30 -0
  20. rs2/interpreter/queryResults/MaterialQueryResults.py +67 -0
  21. rs2/interpreter/queryResults/MeshResults.py +12 -0
  22. rs2/interpreter/queryResults/TimeQueryResults.py +111 -0
  23. rs2/interpreter/queryResults/__init__.py +0 -0
  24. rs2/interpreter/supportResults/BoltResult.py +49 -0
  25. rs2/interpreter/supportResults/CompositeResult.py +24 -0
  26. rs2/interpreter/supportResults/JointResult.py +25 -0
  27. rs2/interpreter/supportResults/LinerResult.py +33 -0
  28. rs2/interpreter/supportResults/__init__.py +0 -0
  29. rs2/modeler/Model.py +350 -0
  30. rs2/modeler/RS2Modeler.py +81 -0
  31. rs2/modeler/__init__.py +0 -0
  32. rs2/modeler/properties/AbsoluteStageFactorGettersInterface.py +31 -0
  33. rs2/modeler/properties/AbsoluteStageFactorInterface.py +49 -0
  34. rs2/modeler/properties/CompositeProperty.py +81 -0
  35. rs2/modeler/properties/DiscreteFunction.py +43 -0
  36. rs2/modeler/properties/MaterialJoint.py +25 -0
  37. rs2/modeler/properties/MaterialJointOptions.py +28 -0
  38. rs2/modeler/properties/PropertyEnums.py +376 -0
  39. rs2/modeler/properties/RelativeStageFactorInterface.py +50 -0
  40. rs2/modeler/properties/ShearNormalFunction.py +45 -0
  41. rs2/modeler/properties/SnowdenAnisotropicFunction.py +56 -0
  42. rs2/modeler/properties/StructuralInterface.py +59 -0
  43. rs2/modeler/properties/UserDefinedWaterMode.py +21 -0
  44. rs2/modeler/properties/__init__.py +0 -0
  45. rs2/modeler/properties/bolt/Bolt.py +33 -0
  46. rs2/modeler/properties/bolt/EndAnchored.py +59 -0
  47. rs2/modeler/properties/bolt/FullyBonded.py +66 -0
  48. rs2/modeler/properties/bolt/PlainStrandCable.py +112 -0
  49. rs2/modeler/properties/bolt/Swellex.py +136 -0
  50. rs2/modeler/properties/bolt/Tieback.py +192 -0
  51. rs2/modeler/properties/bolt/__init__.py +0 -0
  52. rs2/modeler/properties/joint/BartonBandis.py +143 -0
  53. rs2/modeler/properties/joint/BartonBandisMaterial.py +82 -0
  54. rs2/modeler/properties/joint/DisplacementDependent.py +134 -0
  55. rs2/modeler/properties/joint/GeosyntheticHyperbolic.py +147 -0
  56. rs2/modeler/properties/joint/GeosyntheticHyperbolicMaterial.py +93 -0
  57. rs2/modeler/properties/joint/HyperbolicSoftening.py +202 -0
  58. rs2/modeler/properties/joint/Joint.py +57 -0
  59. rs2/modeler/properties/joint/MaterialDependent.py +128 -0
  60. rs2/modeler/properties/joint/MohrCoulomb.py +211 -0
  61. rs2/modeler/properties/joint/MohrCoulombMaterial.py +115 -0
  62. rs2/modeler/properties/joint/NoneSlip.py +103 -0
  63. rs2/modeler/properties/joint/__init__.py +0 -0
  64. rs2/modeler/properties/liner/CableTruss.py +199 -0
  65. rs2/modeler/properties/liner/Geosynthetic.py +167 -0
  66. rs2/modeler/properties/liner/Liner.py +31 -0
  67. rs2/modeler/properties/liner/ReinforcedConcrete.py +291 -0
  68. rs2/modeler/properties/liner/StandardBeam.py +268 -0
  69. rs2/modeler/properties/liner/__init__.py +0 -0
  70. rs2/modeler/properties/material/InitialConditions.py +152 -0
  71. rs2/modeler/properties/material/MaterialProperty.py +49 -0
  72. rs2/modeler/properties/material/StageFactors.py +100 -0
  73. rs2/modeler/properties/material/__init__.py +0 -0
  74. rs2/modeler/properties/material/datum/BaseDatum.py +23 -0
  75. rs2/modeler/properties/material/datum/Datum.py +79 -0
  76. rs2/modeler/properties/material/datum/PeakResidualDatum.py +31 -0
  77. rs2/modeler/properties/material/datum/SimpleDatum.py +17 -0
  78. rs2/modeler/properties/material/datum/__init__.py +0 -0
  79. rs2/modeler/properties/material/hydraulic/FEAGroundwater/Brooks.py +106 -0
  80. rs2/modeler/properties/material/hydraulic/FEAGroundwater/Constant.py +54 -0
  81. rs2/modeler/properties/material/hydraulic/FEAGroundwater/FEAGroundwater.py +82 -0
  82. rs2/modeler/properties/material/hydraulic/FEAGroundwater/Fredlund.py +117 -0
  83. rs2/modeler/properties/material/hydraulic/FEAGroundwater/Gardner.py +106 -0
  84. rs2/modeler/properties/material/hydraulic/FEAGroundwater/Genuchten.py +124 -0
  85. rs2/modeler/properties/material/hydraulic/FEAGroundwater/Simple.py +91 -0
  86. rs2/modeler/properties/material/hydraulic/FEAGroundwater/UserDefined.py +10 -0
  87. rs2/modeler/properties/material/hydraulic/FEAGroundwater/__init__.py +0 -0
  88. rs2/modeler/properties/material/hydraulic/Hydraulic.py +41 -0
  89. rs2/modeler/properties/material/hydraulic/StaticGroundwater.py +85 -0
  90. rs2/modeler/properties/material/hydraulic/__init__.py +0 -0
  91. rs2/modeler/properties/material/stiffness/ChSoil.py +45 -0
  92. rs2/modeler/properties/material/stiffness/Custom.py +83 -0
  93. rs2/modeler/properties/material/stiffness/CySoil.py +45 -0
  94. rs2/modeler/properties/material/stiffness/DoubleYield.py +45 -0
  95. rs2/modeler/properties/material/stiffness/HardeningSoil.py +73 -0
  96. rs2/modeler/properties/material/stiffness/HardeningSoilSmallStrainStiffness.py +73 -0
  97. rs2/modeler/properties/material/stiffness/Isotropic.py +122 -0
  98. rs2/modeler/properties/material/stiffness/ManzariAndDafalias.py +38 -0
  99. rs2/modeler/properties/material/stiffness/NonLinearHyperbolic.py +117 -0
  100. rs2/modeler/properties/material/stiffness/NonLinearIsotropic.py +255 -0
  101. rs2/modeler/properties/material/stiffness/Norsand.py +45 -0
  102. rs2/modeler/properties/material/stiffness/Orthotropic.py +180 -0
  103. rs2/modeler/properties/material/stiffness/Pm4Sand.py +80 -0
  104. rs2/modeler/properties/material/stiffness/Pm4Silt.py +87 -0
  105. rs2/modeler/properties/material/stiffness/SoftSoil.py +24 -0
  106. rs2/modeler/properties/material/stiffness/SoftSoilCreep.py +24 -0
  107. rs2/modeler/properties/material/stiffness/Stiffness.py +53 -0
  108. rs2/modeler/properties/material/stiffness/SwellingRock.py +52 -0
  109. rs2/modeler/properties/material/stiffness/TransverselyIsotropic.py +145 -0
  110. rs2/modeler/properties/material/stiffness/ViscoElastic.py +59 -0
  111. rs2/modeler/properties/material/stiffness/__init__.py +0 -0
  112. rs2/modeler/properties/material/strength/AnisotropicLinear.py +150 -0
  113. rs2/modeler/properties/material/strength/BarcelonaBasic.py +176 -0
  114. rs2/modeler/properties/material/strength/BartonBandisStrength.py +59 -0
  115. rs2/modeler/properties/material/strength/BoundingSurfacePlasticity.py +66 -0
  116. rs2/modeler/properties/material/strength/CamClay.py +113 -0
  117. rs2/modeler/properties/material/strength/ChSoilStrength.py +66 -0
  118. rs2/modeler/properties/material/strength/CySoilStrength.py +94 -0
  119. rs2/modeler/properties/material/strength/DiscreteFunction.py +41 -0
  120. rs2/modeler/properties/material/strength/DoubleYieldStrength.py +94 -0
  121. rs2/modeler/properties/material/strength/DruckerPrager.py +113 -0
  122. rs2/modeler/properties/material/strength/Finn.py +129 -0
  123. rs2/modeler/properties/material/strength/GeneralizedAnisotropic.py +20 -0
  124. rs2/modeler/properties/material/strength/GeneralizedHoekBrown.py +195 -0
  125. rs2/modeler/properties/material/strength/HardeningSoilStrength.py +101 -0
  126. rs2/modeler/properties/material/strength/HardeningSoilWithSmallStrainStiffness.py +101 -0
  127. rs2/modeler/properties/material/strength/HoekBrown.py +102 -0
  128. rs2/modeler/properties/material/strength/Hyperbolic.py +59 -0
  129. rs2/modeler/properties/material/strength/JointedGeneralizedHoekBrown.py +198 -0
  130. rs2/modeler/properties/material/strength/JointedMohrCoulomb.py +116 -0
  131. rs2/modeler/properties/material/strength/ManzariAndDafaliasStrength.py +108 -0
  132. rs2/modeler/properties/material/strength/ModifiedCamClay.py +113 -0
  133. rs2/modeler/properties/material/strength/MohrCoulombStrength.py +113 -0
  134. rs2/modeler/properties/material/strength/MohrCoulombWithCap.py +112 -0
  135. rs2/modeler/properties/material/strength/NorSandStrength.py +101 -0
  136. rs2/modeler/properties/material/strength/PM4SandStrength.py +178 -0
  137. rs2/modeler/properties/material/strength/PM4SiltStrength.py +241 -0
  138. rs2/modeler/properties/material/strength/PowerCurve.py +101 -0
  139. rs2/modeler/properties/material/strength/Shansep.py +172 -0
  140. rs2/modeler/properties/material/strength/ShearNormalFunction.py +21 -0
  141. rs2/modeler/properties/material/strength/SnowdenModAnisotropicLinear.py +78 -0
  142. rs2/modeler/properties/material/strength/SoftSoilCreepStrength.py +87 -0
  143. rs2/modeler/properties/material/strength/SoftSoilStrength.py +80 -0
  144. rs2/modeler/properties/material/strength/SofteningHardeningModel.py +150 -0
  145. rs2/modeler/properties/material/strength/Strength.py +185 -0
  146. rs2/modeler/properties/material/strength/SwellingRockStrength.py +122 -0
  147. rs2/modeler/properties/material/strength/VerticalStressRatio.py +94 -0
  148. rs2/modeler/properties/material/strength/__init__.py +0 -0
  149. rs2/modeler/properties/material/thermal/Thermal.py +74 -0
  150. rs2/modeler/properties/material/thermal/__init__.py +0 -0
  151. rs2/modeler/properties/material/thermal/conductivity/Conductivity.py +27 -0
  152. rs2/modeler/properties/material/thermal/conductivity/ConstantConductivity.py +31 -0
  153. rs2/modeler/properties/material/thermal/conductivity/CoteAndKonrad.py +45 -0
  154. rs2/modeler/properties/material/thermal/conductivity/Derives.py +17 -0
  155. rs2/modeler/properties/material/thermal/conductivity/Johansen.py +45 -0
  156. rs2/modeler/properties/material/thermal/conductivity/JohansenLu.py +24 -0
  157. rs2/modeler/properties/material/thermal/conductivity/Tabular.py +31 -0
  158. rs2/modeler/properties/material/thermal/conductivity/__init__.py +0 -0
  159. rs2/modeler/properties/material/thermal/heatcapacity/ConstantHeatCapacity.py +38 -0
  160. rs2/modeler/properties/material/thermal/heatcapacity/CustomHeatCapacity.py +38 -0
  161. rs2/modeler/properties/material/thermal/heatcapacity/HeatCapacity.py +21 -0
  162. rs2/modeler/properties/material/thermal/heatcapacity/JameNewman.py +24 -0
  163. rs2/modeler/properties/material/thermal/heatcapacity/__init__.py +0 -0
  164. rs2/modeler/properties/material/thermal/soilunfrozenwatercontent/CustomWaterContent.py +13 -0
  165. rs2/modeler/properties/material/thermal/soilunfrozenwatercontent/Konrad.py +31 -0
  166. rs2/modeler/properties/material/thermal/soilunfrozenwatercontent/SoilUnfrozenWaterContent.py +23 -0
  167. rs2/modeler/properties/material/thermal/soilunfrozenwatercontent/TiceAnderson.py +31 -0
  168. rs2/modeler/properties/material/thermal/soilunfrozenwatercontent/__init__.py +0 -0
  169. rs2/modeler/properties/material/thermal/soilunfrozenwatercontent/hydraulic/BrooksWaterContent.py +24 -0
  170. rs2/modeler/properties/material/thermal/soilunfrozenwatercontent/hydraulic/FredlundWaterContent.py +31 -0
  171. rs2/modeler/properties/material/thermal/soilunfrozenwatercontent/hydraulic/GardnerWaterContent.py +24 -0
  172. rs2/modeler/properties/material/thermal/soilunfrozenwatercontent/hydraulic/GenuchtenWaterContent.py +38 -0
  173. rs2/modeler/properties/material/thermal/soilunfrozenwatercontent/hydraulic/HydraulicModel.py +37 -0
  174. rs2/modeler/properties/material/thermal/soilunfrozenwatercontent/hydraulic/SimpleWaterContent.py +17 -0
  175. rs2/modeler/properties/material/thermal/soilunfrozenwatercontent/hydraulic/__init__.py +0 -0
  176. rs2/modeler/properties/pile/Beam.py +34 -0
  177. rs2/modeler/properties/pile/Elastic.py +45 -0
  178. rs2/modeler/properties/pile/ForceDisplacement.py +59 -0
  179. rs2/modeler/properties/pile/Linear.py +59 -0
  180. rs2/modeler/properties/pile/MaterialDependentPile.py +87 -0
  181. rs2/modeler/properties/pile/MohrCoulombPile.py +94 -0
  182. rs2/modeler/properties/pile/MultiLinear.py +56 -0
  183. rs2/modeler/properties/pile/Pile.py +63 -0
  184. rs2/modeler/properties/pile/__init__.py +0 -0
  185. rs2/modeler/properties/propertyProxy.py +283 -0
  186. rs2/utilities/ApplicationManager.py +64 -0
  187. rs2/utilities/ColorPicker.py +78 -0
  188. rs2/utilities/__init__.py +0 -0
@@ -0,0 +1,54 @@
1
+ from enum import Enum, auto
2
+ class HistoryQueryGraphEnums():
3
+ class VerticalAxisTypes(Enum):
4
+ HORIZONTAL_DISPLACEMENT = 4070
5
+ VERTICAL_DISPLACEMENT = 4071
6
+ HORIZONTAL_VELOCITY = 4072
7
+ VERTICAL_VELOCITY = 4073
8
+ HORIZONTAL_ACCELERATION = 4074
9
+ VERTICAL_ACCELERATION = 4075
10
+ EFFECTIVE_STRESS_XX = 4076
11
+ EFFECTIVE_STRESS_YY = 4077
12
+ EFFECTIVE_STRESS_XY = 4078
13
+ EFFECTIVE_STRESS_Z = 4079
14
+ STRAIN_XX = 4080
15
+ STRAIN_YY = 4081
16
+ STRAIN_XY = 4082
17
+ EXCESS_PORE_PRESSURE = 4083
18
+ # Water
19
+ PORE_PRESSURE = 4084
20
+ HORIZONTAL_HYDRAULIC_VELOCITY = 4085
21
+ VERTICAL_HYDRAULIC_VELOCITY = 4086
22
+ HORIZONTAL_HYDRAULIC_GRADIENT = 4087
23
+ VERTICAL_HYDRAULIC_GRADIENT = 4088
24
+ # Temperature
25
+ TEMPERATURE = 4089
26
+ HORIZONTAL_THERMAL_FLUX = 4090
27
+ VERTICAL_THERMAL_FLUX = 4091
28
+ HORIZONTAL_THERMAL_GRADIENT = 4092
29
+ VERTICAL_THERMAL_GRADIENT = 4093
30
+
31
+ class HorizontalAxisTypes(Enum):
32
+ TIME = 9094
33
+ STAGE_LOAD_PERCENTAGE = 9096
34
+
35
+ class TimeQueryGraphEnums():
36
+ class VerticalAxisTypes(Enum):
37
+ X_VELOCITY = 4041
38
+ X_DISPLACEMENT = 4042
39
+ X_ACCELERATION = 4043
40
+ Y_VELOCITY = 4044
41
+ Y_DISPLACEMENT = 4045
42
+ Y_ACCELERATION = 4046
43
+ PORE_PRESSURE = 4050
44
+ STRAIN_XX = 4055
45
+ STRAIN_YY = 4056
46
+ STRAIN_XY = 4057
47
+ TOTAL_STRESS_XX = 4058
48
+ TOTAL_STRESS_YY = 4059
49
+ TOTAL_STRESS_XY = 4060
50
+ TOTAL_STRESS_ZZ = 4061
51
+ EFFECTIVE_STRESS_XX = 4062
52
+ EFFECTIVE_STRESS_YY = 4063
53
+ EFFECTIVE_STRESS_XY = 4064
54
+ EFFECTIVE_STRESS_ZZ = 4065
@@ -0,0 +1,328 @@
1
+ from rs2.interpreter.InterpreterEnums import *
2
+ from rs2.interpreter.queryResults.MeshResults import MeshResults
3
+ from rs2.interpreter.queryResults.HistoryQueryResults import *
4
+ from rs2.interpreter.queryResults.TimeQueryResults import *
5
+ from rs2.interpreter.InterpreterGraphEnums import *
6
+ from rs2.interpreter.supportResults.JointResult import *
7
+ from rs2.interpreter.supportResults.LinerResult import *
8
+ from rs2.interpreter.supportResults.BoltResult import*
9
+ from rs2.interpreter.supportResults.CompositeResult import*
10
+ from rs2.interpreter.queryResults.MaterialQueryResults import *
11
+ from rs2.BaseModel import BaseModel
12
+
13
+ class Model(BaseModel):
14
+ """
15
+ :ref:`Model Example`
16
+ """
17
+ def saveCopyAs(self, fileName : str):
18
+ '''
19
+ Saves the model using the given file name.
20
+
21
+ Example:
22
+
23
+ .. code-block:: python
24
+
25
+ model.saveCopyAs('C:/simple_3_stage.fez')
26
+ '''
27
+ formattedFileName = fileName.replace('/', '\\')
28
+ self._enforceFeaFezEnding(formattedFileName)
29
+ return self._callFunction('saveAs', [formattedFileName])
30
+
31
+
32
+
33
+ def SetActiveStage(self, stageNumber: int):
34
+ '''
35
+ :ref:`Material Query Example`
36
+
37
+ | Change model's active stage by its stage number
38
+ '''
39
+ return self._callFunction('SetActiveStage', [stageNumber])
40
+
41
+ def SetResultType(self, resultType: ExportResultType) -> list[dict]:
42
+ """
43
+ :ref:`Get Mesh Results Example`
44
+
45
+ | Sets the export result type for your model.
46
+
47
+ Raises:
48
+ ValueError: resultType must be an enum of type ExportResultType. Any other value will raise an error
49
+
50
+ """
51
+ return self._callFunction('SetResultType', [resultType.value])
52
+
53
+ def SetUserDefinedResultType(self, resultName: str) -> list[dict]:
54
+ """
55
+ | Sets the export result type to the user defined result type name.
56
+
57
+ """
58
+ return self._callFunction('SetUserDefinedResultType', [resultName])
59
+
60
+ def GetMeshResults(self) -> MeshResults:
61
+ """
62
+ :ref:`Get Mesh Results Example`
63
+
64
+ | Returns the mesh results at all nodes for your model.
65
+
66
+ """
67
+ results = self._callFunction('GetMeshResults', [])
68
+ return MeshResults(results)
69
+
70
+ def GetHistoryQueryResults(self, hq_name: str, horizontal_axis: HistoryQueryGraphEnums.HorizontalAxisTypes, vertical_axis: HistoryQueryGraphEnums.VerticalAxisTypes,
71
+ stages: list[int]) -> dict[int, list[HistoryQueryResult]]:
72
+ """
73
+ :ref:`History Query Example`
74
+
75
+ | Returns a map of HistoryQueryResult for all input stages and history queries in your model.
76
+
77
+ Raises:
78
+ ValueError: horizontal_axis and vertical_axis must be an enum of type HistoryQueryGraphEnums.
79
+ Any other value will raise an error.
80
+
81
+ """
82
+ map_data = self._callFunction('GetHistoryQueryResults', [hq_name, horizontal_axis.value, vertical_axis.value, stages])
83
+ structured_data = {}
84
+ for stage_idx, stage_data in map_data.items():
85
+ list_stage_data_as_classObj = []
86
+ for result in stage_data:
87
+ list_stage_data_as_classObj.append(HistoryQueryResult(result[0], result[1], result[2], result[3]))
88
+
89
+ structured_data[stage_idx] = list_stage_data_as_classObj
90
+
91
+ return structured_data
92
+
93
+ def GetAllTimeQueryPointResults(self, stages: list[int],
94
+ vertical_axis: TimeQueryGraphEnums.VerticalAxisTypes
95
+ ) -> dict[int, list[TimeQueryPointResults]]:
96
+ """
97
+ :ref:`Time Query Example`
98
+
99
+ | Returns a map of TimeQueryPointResults for all input stages and time query points in your model.
100
+
101
+ | Please note points that are over an excavation at specific stages will not have data returned at those locations.
102
+
103
+ Raises:
104
+ ValueError: vertical_axis must be an enum of type TimeQueryGraphEnums. Any other value will raise an error.
105
+
106
+ """
107
+ map_data = self._callFunction('GetAllTimeQueryPointsResults',
108
+ [stages, vertical_axis.value])
109
+ structured_data = {}
110
+ for stageNumber, stageData in map_data.items():
111
+ list_stage_data_as_classObj = []
112
+ for query_point_data in stageData:
113
+ entity_id, list_node_result = query_point_data
114
+ unpack_list_data = [entity_id, list_node_result]
115
+ list_stage_data_as_classObj.append(TimeQueryPointResults(*unpack_list_data))
116
+
117
+ structured_data[stageNumber] = list_stage_data_as_classObj
118
+
119
+ return structured_data
120
+
121
+ def GetAllTimeQueryLinesResults(self, stages: list[int],
122
+ vertical_axis: TimeQueryGraphEnums.VerticalAxisTypes,
123
+ apply_post_process_scaling: bool
124
+ ) -> dict[int, list[TimeQueryLineResults]]:
125
+ """
126
+ :ref:`Time Query Example`
127
+
128
+ | Returns a map of TimeQueryLineResults for all input stages and time query lines in your model.
129
+
130
+ | Please note points that are over an excavation at specific stages will not have data returned at those locations.
131
+
132
+ Raises:
133
+ ValueError: vertical_axis must be an enum of type TimeQueryGraphEnums. Any other value will raise an error.
134
+
135
+ """
136
+ map_data = self._callFunction('GetAllTimeQueryLinesResults',
137
+ [stages, vertical_axis.value, apply_post_process_scaling])
138
+ structured_data = {}
139
+ for stageNumber, stageData in map_data.items():
140
+ list_stage_data_as_classObj = []
141
+ for line_data in stageData:
142
+ entity_id, list_line_node_data = line_data
143
+ unpack_list_data = [entity_id, list_line_node_data]
144
+ list_stage_data_as_classObj.append(TimeQueryLineResults(*unpack_list_data))
145
+
146
+ structured_data[stageNumber] = list_stage_data_as_classObj
147
+
148
+ return structured_data
149
+
150
+ def AddMaterialQuery(self, points: list[list[float]]) -> str:
151
+ """
152
+ :ref:`Material Query Example`
153
+
154
+ | Adds a material query point/line to your model using the specified coordinates in order.
155
+
156
+ | Returns a unique identifier for the newly added material query point/line.
157
+
158
+ """
159
+ return self._callFunction('AddMaterialQuery', [points])
160
+
161
+ def RemoveMaterialQuery(self, IDs_toRemove: list[str]) -> str:
162
+ """
163
+ :ref:`Material Query Example`
164
+
165
+ | Removes material query points or lines for provided list of IDs.
166
+
167
+ """
168
+ return self._callFunction('RemoveMaterialQuery', [IDs_toRemove])
169
+
170
+ def GetMaterialQueryResults(self) -> list[MaterialQueryResults]:
171
+ """
172
+ :ref:`Material Query Example`
173
+
174
+ | Returns the results for all the material queries defined in your model for active model stage and result type.
175
+ | To get results for a different stage, please call SetActiveStage(int stageNumber) before calling this function.
176
+ | To get results for a different result type, please call either before calling this function:
177
+
178
+ * SetResultType(InterpreterGraphEnums resultType)
179
+ * SetUserDefinedResultType("Your defined resultType name")
180
+
181
+ """
182
+ all_material_query_data = self._callFunction('GetMaterialQueryResults', [])
183
+ all_mat_query_data_as_classObj = []
184
+ for mat_query_data in all_material_query_data:
185
+ # This list corresponds to the data at each vertex of material query in iteration
186
+ entity_id, material_id, list_query_data = mat_query_data
187
+ unpack_list_data = [entity_id, material_id, list_query_data]
188
+ all_mat_query_data_as_classObj.append(MaterialQueryResults(*unpack_list_data))
189
+ return all_mat_query_data_as_classObj
190
+
191
+ def GetBoltResults (self, stages: list[int]) -> dict[int, list[BoltResult]]:
192
+ """
193
+ :ref:`Support Bolt Results Example`
194
+
195
+ | Returns a map of BoltResult for all input stages and support bolt defined in your model.
196
+
197
+ """
198
+ map_data = self._callFunction('GetBoltResults', [stages])
199
+ structured_data = {}
200
+ for stage_idx, stage_data in map_data.items():
201
+ structured_data[stage_idx] = []
202
+ for entity_name, entity_data in stage_data.items():
203
+ yielding_results = []
204
+ displacement_force_results = []
205
+ # location # [start = [x,y],end = [x,y]]
206
+ # yeilding
207
+ # displacement force
208
+ if len(entity_data) < 3 or len(entity_data[0]) <1 or len(entity_data[0][0]) < 4:
209
+ continue
210
+ if len(entity_data[1]) < 1 or len(entity_data[2]) < 1:
211
+ continue
212
+ for yeilding_vector in entity_data[1]:
213
+ yielding = BoltYieldingResult(*yeilding_vector)
214
+ yielding_results.append(yielding)
215
+
216
+ for displacement_force_vector in entity_data[2]:
217
+ displacement_force = BoltForceDisplacementResult(*displacement_force_vector)
218
+ displacement_force_results.append(displacement_force)
219
+ bolt_result = BoltResult(entity_name,entity_data,yielding_results, displacement_force_results)
220
+ structured_data[stage_idx].append(bolt_result)
221
+ return structured_data
222
+
223
+ def _process_joint_data(self, entity_data, entity_name):
224
+
225
+ joint_element_results = []
226
+ for joint_vector in entity_data[1]:
227
+ #joint_vector[yeilded_indx] = bool(joint_vector[yeilded_indx])
228
+ joint_element = JointElementResult(*joint_vector)
229
+ joint_element_results.append(joint_element)
230
+ joint_result = JointResult(entity_name, joint_element_results)
231
+ return joint_result
232
+
233
+ def _process_liner_data(self, entity_data, entity_name):
234
+ liner_element_results = []
235
+
236
+ for liner_vector in entity_data[0]:
237
+ liner_element = LinerElementResult(*liner_vector)
238
+ liner_element_results.append(liner_element)
239
+ liner_result = LinerResult(entity_name,liner_element_results)
240
+ return liner_result
241
+
242
+ def GetJointResults(self, stages: list[int]) -> dict[int, list[JointResult]]:
243
+ """
244
+ :ref:`Support Joint Results Example`
245
+
246
+ | Returns a map of JointResult for all input stages and support joint defined in your model.
247
+
248
+ """
249
+ map_data = self._callFunction('GetJointResults', [stages])
250
+ structured_data = {}
251
+ for stage_idx, stage_data in map_data.items():
252
+
253
+ structured_data[stage_idx] = []
254
+ for entity_name, entity_data in stage_data.items():
255
+ joint_result = self._process_joint_data(entity_data, entity_name)
256
+ structured_data[stage_idx].append(joint_result)
257
+
258
+ return structured_data
259
+
260
+ def GetLinerResults(self, stages: list[int]) -> dict[int, list[LinerResult]]:
261
+ """
262
+ :ref:`Support Liner Results Example`
263
+
264
+ | Returns a map of LinerResult for all input stages and support liner defined in your model.
265
+
266
+ """
267
+ map_data = self._callFunction('GetLinerResults', [stages])
268
+ structured_data = {}
269
+ for stage_idx, stage_data in map_data.items():
270
+
271
+ structured_data[stage_idx] = []
272
+ for entity_name, entity_data in stage_data.items():
273
+ liner_result = self._process_liner_data(entity_data, entity_name)
274
+ structured_data[stage_idx].append(liner_result)
275
+
276
+ return structured_data
277
+
278
+ def GetPileResults(self, stages: list[int]) -> dict[int, list[PileResult]]:
279
+ """
280
+ :ref:`Support Pile Results Example`
281
+
282
+ | Returns a map of PileResult for all input stages and support pile defined in your model.
283
+
284
+ """
285
+ return self._get_composition_result('GetPileResults',PileResult, stages)
286
+
287
+ def GetCompositeResults(self, stages: list[int]) -> dict[int, list[CompositeResult]]:
288
+ """
289
+ :ref:`Support Composite Results Example`
290
+
291
+ | Returns a map of CompositeResult for all input stages and support composite defined in your model.
292
+
293
+ """
294
+ return self._get_composition_result('GetCompositeResults',CompositeResult, stages)
295
+
296
+ def GetStructuralResults(self, stages: list[int]) -> dict[int, list[StructuralResult]]:
297
+ """
298
+ :ref:`Support Structural Results Example`
299
+
300
+ | Returns a map of StructuralResult for all input stages and support structural defined in your model.
301
+
302
+ """
303
+ return self._get_composition_result('GetStructuralResults',StructuralResult, stages)
304
+
305
+ def _get_composition_result(
306
+ self,
307
+ function_name: str,
308
+ ResultType,
309
+ stages: list[int]) -> dict[int, list[LinerResult]]:
310
+
311
+ map_data = self._callFunction(function_name, [stages])
312
+ structured_data = {}
313
+ for stage_idx, stage_data in map_data.items():
314
+ structured_data[stage_idx] = []
315
+ for entity_name, entity_data in stage_data.items():
316
+ liner_result = self._process_liner_data(entity_data, entity_name)
317
+ joint_result = self._process_joint_data(entity_data, entity_name)
318
+ composition_result = ResultType(entity_name,joint_result,liner_result)
319
+ structured_data[stage_idx].append(composition_result)
320
+
321
+ return structured_data
322
+
323
+
324
+ def getCriticalSRF(self):
325
+ '''
326
+ | Get Critical SRF
327
+ '''
328
+ return ResetInvalid.validate_double(self._callFunction('getCriticalSRF', []))
@@ -0,0 +1,78 @@
1
+ from rsmessages.requestFormat import functionRequest
2
+ from rs2._common.Client import Client
3
+ from rs2.utilities.ApplicationManager import ApplicationManager
4
+ from rs2.interpreter.InterpreterModel import Model
5
+ import winreg
6
+ import time
7
+
8
+ class RS2Interpreter:
9
+ def __init__(self, host = 'localhost', port=60055):
10
+ self.client = Client(host, port)
11
+
12
+ def openFile(self, fileName : str) -> Model:
13
+ '''
14
+ Takes in the absolute path to an rs2 file to be opened in the modeler.
15
+
16
+ Example:
17
+
18
+ .. code-block:: python
19
+
20
+ model = modeler.openFile('C:/simple_3_stage.fez')
21
+ '''
22
+ request = functionRequest('open_file', [fileName], keepReturnValueReference=True)
23
+ modelObjectId = self.client.callFunction(request)
24
+ model = Model(self.client, modelObjectId)
25
+ return model
26
+
27
+ @classmethod
28
+ def startApplication(cls, port : int, overridePathToExecutable : str = None, timeout : float = 30) -> None:
29
+ """Opens the most recently installed RS2 application. Starts the python server and binds it to the given port.
30
+
31
+ Args:
32
+ port (int): the port to bind the python server to. Use this same port when initializing RS2Modeler
33
+ overridePathToExecutable (str, optional): full path to the desired executable to be opened. If not provided, the latest installation of rs2 is used
34
+ timeout (float, optional): the maximum amount of time to wait for the application and server to start.
35
+
36
+ Raises:
37
+ ValueError: Port range must be between ``49152`` and ``65535``, otherwise ValueError is raised
38
+ TimeoutError: if timeout is provided, raises TimeoutError if not able to connect to the server within that time.
39
+ """
40
+ appManager = ApplicationManager()
41
+ executablePath = overridePathToExecutable if overridePathToExecutable else cls._getApplicationPath()
42
+ appManager.startApplication(executablePath, port, timeout)
43
+
44
+ @staticmethod
45
+ def _getApplicationPath() -> str:
46
+
47
+ registry = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
48
+ key = winreg.OpenKey(registry, r'SOFTWARE\Rocscience\RS2 11.0')
49
+ installationLocation, type = winreg.QueryValueEx(key, "Install")
50
+
51
+ rs2ModelerInstallLocation = rf"{installationLocation}\Interpret"
52
+
53
+ return rs2ModelerInstallLocation
54
+
55
+ def closeProgram(self, saveModels=True, timeout=30):
56
+ '''
57
+ Closes the modeler program. All unsaved models are saved by default.
58
+
59
+ Example:
60
+
61
+ .. code-block:: python
62
+
63
+ #Saves all models before closing
64
+ modeler.closeProgram(True)
65
+
66
+ #Closes without saving any models
67
+ modeler.closeProgram(False)
68
+ '''
69
+ request = functionRequest('closeProgram', [saveModels])
70
+ portUsed = self.client.callFunction(request)
71
+ self.client.closeConnection()
72
+ appManager = ApplicationManager()
73
+ portIsAvailable = False
74
+ startTime = time.time()
75
+ while not portIsAvailable:
76
+ if (time.time() - startTime) > timeout:
77
+ raise TimeoutError("The application did not close within the given timeout time.")
78
+ portIsAvailable = appManager._isPortAvailable(portUsed)
@@ -0,0 +1,20 @@
1
+ import sys
2
+
3
+ class ResetInvalid:
4
+ # used by interpretor
5
+ flt_max = 3.402823466e+38
6
+
7
+ @staticmethod
8
+ def validate(self):
9
+ for key, value in vars(self).items():
10
+ if isinstance(value, (int, float)) and value == sys.float_info.max:
11
+ setattr(self, key, None)
12
+ pass
13
+ @staticmethod
14
+ def validate_double(value):
15
+ if isinstance(value, float) and (value >= ResetInvalid.flt_max):
16
+ value = None
17
+ return value
18
+
19
+
20
+
File without changes
@@ -0,0 +1,30 @@
1
+ class HistoryQueryResult:
2
+ def __init__(self, x_location, y_location, horizontal_axis_result, vertical_axis_result):
3
+ self.horizontal_axis_result = horizontal_axis_result
4
+ self.vertical_axis_result = vertical_axis_result
5
+ self.location_x = x_location
6
+ self.location_y = y_location
7
+
8
+ def GetXCoordinate(self):
9
+ '''
10
+ Returns the X-Coordinate of the point
11
+ '''
12
+ return self.location_x
13
+
14
+ def GetYCoordinate(self):
15
+ '''
16
+ Returns the Y-Coordinate of the point
17
+ '''
18
+ return self.location_y
19
+
20
+ def GetHorizontalAxisResult(self):
21
+ '''
22
+ Returns the horizontal axis result for the specific stage
23
+ '''
24
+ return self.horizontal_axis_result
25
+
26
+ def GetVerticalAxisResult(self):
27
+ '''
28
+ Returns the vertical axis result for the specific stage
29
+ '''
30
+ return self.vertical_axis_result
@@ -0,0 +1,67 @@
1
+ from rs2.interpreter._UtilityResult import *
2
+
3
+ class QueryResult:
4
+ def __init__(self, x_location, y_location, distance, value):
5
+ self.x_location = x_location
6
+ self.y_location = y_location
7
+ self.distance = distance
8
+ self.value = value
9
+ ResetInvalid.validate(self)
10
+
11
+ def GetXCoordinate(self) -> float:
12
+ '''
13
+ Returns the X-Coordinate of the query
14
+ '''
15
+ return self.x_location
16
+
17
+ def GetYCoordinate(self) -> float:
18
+ '''
19
+ Returns the Y-Coordinate of the query
20
+ '''
21
+ return self.y_location
22
+
23
+ def GetDistance(self) -> float:
24
+ '''
25
+ Returns the distance of the query
26
+ '''
27
+ return self.distance
28
+
29
+ def GetValue(self) -> float:
30
+ '''
31
+ Returns the value of the query based on model's current result type
32
+ '''
33
+ return self.value
34
+
35
+ class MaterialQueryResults:
36
+ def __init__(self, entity_ID, material_id, query_values):
37
+ self.entity_ID = entity_ID
38
+ self.material_id = material_id
39
+ # Construct QueryResult objects
40
+ query_values_obj = []
41
+ for value in query_values:
42
+ query_values_obj.append(QueryResult(*value))
43
+ self.query_values = query_values_obj
44
+
45
+ def GetUniqueIdentifier(self) -> int:
46
+ '''
47
+ Returns the unique identifier for the material query
48
+ '''
49
+ return self.entity_ID
50
+
51
+ def GetMaterialID(self) -> int:
52
+ '''
53
+ Returns the material ID of the query
54
+ '''
55
+ return self.material_id
56
+
57
+ def GetAllValues(self) -> list[QueryResult]:
58
+ '''
59
+ | Returns a list[QueryResult] representing result at all nodes of the material query
60
+ | To get the x-coordinate, y-coordinate, distance, or value, please call the supporting class methods:
61
+
62
+ * QueryResult.GetXCoordinate()
63
+ * QueryResult.GetYCoordinate()
64
+ * QueryResult.GetDistance()
65
+ * QueryResult.GetValue()
66
+ '''
67
+ return self.query_values
@@ -0,0 +1,12 @@
1
+ class MeshResults:
2
+ results = None
3
+
4
+ def __init__(self, results):
5
+ self.results = results
6
+
7
+ def getXCoordinate(self, index):
8
+ return self.results[index][0]
9
+ def getYCoordinate(self, index):
10
+ return self.results[index][1]
11
+ def getValue(self, index):
12
+ return self.results[index][2]