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.
- RS2Scripting-11.23.0.dist-info/License.txt +20 -0
- RS2Scripting-11.23.0.dist-info/METADATA +147 -0
- RS2Scripting-11.23.0.dist-info/RECORD +188 -0
- RS2Scripting-11.23.0.dist-info/WHEEL +5 -0
- RS2Scripting-11.23.0.dist-info/top_level.txt +1 -0
- rs2/BaseModel.py +46 -0
- rs2/Units.py +6 -0
- rs2/__init__.py +0 -0
- rs2/_common/Client.py +67 -0
- rs2/_common/ProxyObject.py +12 -0
- rs2/_common/__init__.py +0 -0
- rs2/_common/documentProxy.py +5 -0
- rs2/interpreter/InterpreterEnums.py +86 -0
- rs2/interpreter/InterpreterGraphEnums.py +54 -0
- rs2/interpreter/InterpreterModel.py +328 -0
- rs2/interpreter/RS2Interpreter.py +78 -0
- rs2/interpreter/_UtilityResult.py +20 -0
- rs2/interpreter/__init__.py +0 -0
- rs2/interpreter/queryResults/HistoryQueryResults.py +30 -0
- rs2/interpreter/queryResults/MaterialQueryResults.py +67 -0
- rs2/interpreter/queryResults/MeshResults.py +12 -0
- rs2/interpreter/queryResults/TimeQueryResults.py +111 -0
- rs2/interpreter/queryResults/__init__.py +0 -0
- rs2/interpreter/supportResults/BoltResult.py +49 -0
- rs2/interpreter/supportResults/CompositeResult.py +24 -0
- rs2/interpreter/supportResults/JointResult.py +25 -0
- rs2/interpreter/supportResults/LinerResult.py +33 -0
- rs2/interpreter/supportResults/__init__.py +0 -0
- rs2/modeler/Model.py +350 -0
- rs2/modeler/RS2Modeler.py +81 -0
- rs2/modeler/__init__.py +0 -0
- rs2/modeler/properties/AbsoluteStageFactorGettersInterface.py +31 -0
- rs2/modeler/properties/AbsoluteStageFactorInterface.py +49 -0
- rs2/modeler/properties/CompositeProperty.py +81 -0
- rs2/modeler/properties/DiscreteFunction.py +43 -0
- rs2/modeler/properties/MaterialJoint.py +25 -0
- rs2/modeler/properties/MaterialJointOptions.py +28 -0
- rs2/modeler/properties/PropertyEnums.py +376 -0
- rs2/modeler/properties/RelativeStageFactorInterface.py +50 -0
- rs2/modeler/properties/ShearNormalFunction.py +45 -0
- rs2/modeler/properties/SnowdenAnisotropicFunction.py +56 -0
- rs2/modeler/properties/StructuralInterface.py +59 -0
- rs2/modeler/properties/UserDefinedWaterMode.py +21 -0
- rs2/modeler/properties/__init__.py +0 -0
- rs2/modeler/properties/bolt/Bolt.py +33 -0
- rs2/modeler/properties/bolt/EndAnchored.py +59 -0
- rs2/modeler/properties/bolt/FullyBonded.py +66 -0
- rs2/modeler/properties/bolt/PlainStrandCable.py +112 -0
- rs2/modeler/properties/bolt/Swellex.py +136 -0
- rs2/modeler/properties/bolt/Tieback.py +192 -0
- rs2/modeler/properties/bolt/__init__.py +0 -0
- rs2/modeler/properties/joint/BartonBandis.py +143 -0
- rs2/modeler/properties/joint/BartonBandisMaterial.py +82 -0
- rs2/modeler/properties/joint/DisplacementDependent.py +134 -0
- rs2/modeler/properties/joint/GeosyntheticHyperbolic.py +147 -0
- rs2/modeler/properties/joint/GeosyntheticHyperbolicMaterial.py +93 -0
- rs2/modeler/properties/joint/HyperbolicSoftening.py +202 -0
- rs2/modeler/properties/joint/Joint.py +57 -0
- rs2/modeler/properties/joint/MaterialDependent.py +128 -0
- rs2/modeler/properties/joint/MohrCoulomb.py +211 -0
- rs2/modeler/properties/joint/MohrCoulombMaterial.py +115 -0
- rs2/modeler/properties/joint/NoneSlip.py +103 -0
- rs2/modeler/properties/joint/__init__.py +0 -0
- rs2/modeler/properties/liner/CableTruss.py +199 -0
- rs2/modeler/properties/liner/Geosynthetic.py +167 -0
- rs2/modeler/properties/liner/Liner.py +31 -0
- rs2/modeler/properties/liner/ReinforcedConcrete.py +291 -0
- rs2/modeler/properties/liner/StandardBeam.py +268 -0
- rs2/modeler/properties/liner/__init__.py +0 -0
- rs2/modeler/properties/material/InitialConditions.py +152 -0
- rs2/modeler/properties/material/MaterialProperty.py +49 -0
- rs2/modeler/properties/material/StageFactors.py +100 -0
- rs2/modeler/properties/material/__init__.py +0 -0
- rs2/modeler/properties/material/datum/BaseDatum.py +23 -0
- rs2/modeler/properties/material/datum/Datum.py +79 -0
- rs2/modeler/properties/material/datum/PeakResidualDatum.py +31 -0
- rs2/modeler/properties/material/datum/SimpleDatum.py +17 -0
- rs2/modeler/properties/material/datum/__init__.py +0 -0
- rs2/modeler/properties/material/hydraulic/FEAGroundwater/Brooks.py +106 -0
- rs2/modeler/properties/material/hydraulic/FEAGroundwater/Constant.py +54 -0
- rs2/modeler/properties/material/hydraulic/FEAGroundwater/FEAGroundwater.py +82 -0
- rs2/modeler/properties/material/hydraulic/FEAGroundwater/Fredlund.py +117 -0
- rs2/modeler/properties/material/hydraulic/FEAGroundwater/Gardner.py +106 -0
- rs2/modeler/properties/material/hydraulic/FEAGroundwater/Genuchten.py +124 -0
- rs2/modeler/properties/material/hydraulic/FEAGroundwater/Simple.py +91 -0
- rs2/modeler/properties/material/hydraulic/FEAGroundwater/UserDefined.py +10 -0
- rs2/modeler/properties/material/hydraulic/FEAGroundwater/__init__.py +0 -0
- rs2/modeler/properties/material/hydraulic/Hydraulic.py +41 -0
- rs2/modeler/properties/material/hydraulic/StaticGroundwater.py +85 -0
- rs2/modeler/properties/material/hydraulic/__init__.py +0 -0
- rs2/modeler/properties/material/stiffness/ChSoil.py +45 -0
- rs2/modeler/properties/material/stiffness/Custom.py +83 -0
- rs2/modeler/properties/material/stiffness/CySoil.py +45 -0
- rs2/modeler/properties/material/stiffness/DoubleYield.py +45 -0
- rs2/modeler/properties/material/stiffness/HardeningSoil.py +73 -0
- rs2/modeler/properties/material/stiffness/HardeningSoilSmallStrainStiffness.py +73 -0
- rs2/modeler/properties/material/stiffness/Isotropic.py +122 -0
- rs2/modeler/properties/material/stiffness/ManzariAndDafalias.py +38 -0
- rs2/modeler/properties/material/stiffness/NonLinearHyperbolic.py +117 -0
- rs2/modeler/properties/material/stiffness/NonLinearIsotropic.py +255 -0
- rs2/modeler/properties/material/stiffness/Norsand.py +45 -0
- rs2/modeler/properties/material/stiffness/Orthotropic.py +180 -0
- rs2/modeler/properties/material/stiffness/Pm4Sand.py +80 -0
- rs2/modeler/properties/material/stiffness/Pm4Silt.py +87 -0
- rs2/modeler/properties/material/stiffness/SoftSoil.py +24 -0
- rs2/modeler/properties/material/stiffness/SoftSoilCreep.py +24 -0
- rs2/modeler/properties/material/stiffness/Stiffness.py +53 -0
- rs2/modeler/properties/material/stiffness/SwellingRock.py +52 -0
- rs2/modeler/properties/material/stiffness/TransverselyIsotropic.py +145 -0
- rs2/modeler/properties/material/stiffness/ViscoElastic.py +59 -0
- rs2/modeler/properties/material/stiffness/__init__.py +0 -0
- rs2/modeler/properties/material/strength/AnisotropicLinear.py +150 -0
- rs2/modeler/properties/material/strength/BarcelonaBasic.py +176 -0
- rs2/modeler/properties/material/strength/BartonBandisStrength.py +59 -0
- rs2/modeler/properties/material/strength/BoundingSurfacePlasticity.py +66 -0
- rs2/modeler/properties/material/strength/CamClay.py +113 -0
- rs2/modeler/properties/material/strength/ChSoilStrength.py +66 -0
- rs2/modeler/properties/material/strength/CySoilStrength.py +94 -0
- rs2/modeler/properties/material/strength/DiscreteFunction.py +41 -0
- rs2/modeler/properties/material/strength/DoubleYieldStrength.py +94 -0
- rs2/modeler/properties/material/strength/DruckerPrager.py +113 -0
- rs2/modeler/properties/material/strength/Finn.py +129 -0
- rs2/modeler/properties/material/strength/GeneralizedAnisotropic.py +20 -0
- rs2/modeler/properties/material/strength/GeneralizedHoekBrown.py +195 -0
- rs2/modeler/properties/material/strength/HardeningSoilStrength.py +101 -0
- rs2/modeler/properties/material/strength/HardeningSoilWithSmallStrainStiffness.py +101 -0
- rs2/modeler/properties/material/strength/HoekBrown.py +102 -0
- rs2/modeler/properties/material/strength/Hyperbolic.py +59 -0
- rs2/modeler/properties/material/strength/JointedGeneralizedHoekBrown.py +198 -0
- rs2/modeler/properties/material/strength/JointedMohrCoulomb.py +116 -0
- rs2/modeler/properties/material/strength/ManzariAndDafaliasStrength.py +108 -0
- rs2/modeler/properties/material/strength/ModifiedCamClay.py +113 -0
- rs2/modeler/properties/material/strength/MohrCoulombStrength.py +113 -0
- rs2/modeler/properties/material/strength/MohrCoulombWithCap.py +112 -0
- rs2/modeler/properties/material/strength/NorSandStrength.py +101 -0
- rs2/modeler/properties/material/strength/PM4SandStrength.py +178 -0
- rs2/modeler/properties/material/strength/PM4SiltStrength.py +241 -0
- rs2/modeler/properties/material/strength/PowerCurve.py +101 -0
- rs2/modeler/properties/material/strength/Shansep.py +172 -0
- rs2/modeler/properties/material/strength/ShearNormalFunction.py +21 -0
- rs2/modeler/properties/material/strength/SnowdenModAnisotropicLinear.py +78 -0
- rs2/modeler/properties/material/strength/SoftSoilCreepStrength.py +87 -0
- rs2/modeler/properties/material/strength/SoftSoilStrength.py +80 -0
- rs2/modeler/properties/material/strength/SofteningHardeningModel.py +150 -0
- rs2/modeler/properties/material/strength/Strength.py +185 -0
- rs2/modeler/properties/material/strength/SwellingRockStrength.py +122 -0
- rs2/modeler/properties/material/strength/VerticalStressRatio.py +94 -0
- rs2/modeler/properties/material/strength/__init__.py +0 -0
- rs2/modeler/properties/material/thermal/Thermal.py +74 -0
- rs2/modeler/properties/material/thermal/__init__.py +0 -0
- rs2/modeler/properties/material/thermal/conductivity/Conductivity.py +27 -0
- rs2/modeler/properties/material/thermal/conductivity/ConstantConductivity.py +31 -0
- rs2/modeler/properties/material/thermal/conductivity/CoteAndKonrad.py +45 -0
- rs2/modeler/properties/material/thermal/conductivity/Derives.py +17 -0
- rs2/modeler/properties/material/thermal/conductivity/Johansen.py +45 -0
- rs2/modeler/properties/material/thermal/conductivity/JohansenLu.py +24 -0
- rs2/modeler/properties/material/thermal/conductivity/Tabular.py +31 -0
- rs2/modeler/properties/material/thermal/conductivity/__init__.py +0 -0
- rs2/modeler/properties/material/thermal/heatcapacity/ConstantHeatCapacity.py +38 -0
- rs2/modeler/properties/material/thermal/heatcapacity/CustomHeatCapacity.py +38 -0
- rs2/modeler/properties/material/thermal/heatcapacity/HeatCapacity.py +21 -0
- rs2/modeler/properties/material/thermal/heatcapacity/JameNewman.py +24 -0
- rs2/modeler/properties/material/thermal/heatcapacity/__init__.py +0 -0
- rs2/modeler/properties/material/thermal/soilunfrozenwatercontent/CustomWaterContent.py +13 -0
- rs2/modeler/properties/material/thermal/soilunfrozenwatercontent/Konrad.py +31 -0
- rs2/modeler/properties/material/thermal/soilunfrozenwatercontent/SoilUnfrozenWaterContent.py +23 -0
- rs2/modeler/properties/material/thermal/soilunfrozenwatercontent/TiceAnderson.py +31 -0
- rs2/modeler/properties/material/thermal/soilunfrozenwatercontent/__init__.py +0 -0
- rs2/modeler/properties/material/thermal/soilunfrozenwatercontent/hydraulic/BrooksWaterContent.py +24 -0
- rs2/modeler/properties/material/thermal/soilunfrozenwatercontent/hydraulic/FredlundWaterContent.py +31 -0
- rs2/modeler/properties/material/thermal/soilunfrozenwatercontent/hydraulic/GardnerWaterContent.py +24 -0
- rs2/modeler/properties/material/thermal/soilunfrozenwatercontent/hydraulic/GenuchtenWaterContent.py +38 -0
- rs2/modeler/properties/material/thermal/soilunfrozenwatercontent/hydraulic/HydraulicModel.py +37 -0
- rs2/modeler/properties/material/thermal/soilunfrozenwatercontent/hydraulic/SimpleWaterContent.py +17 -0
- rs2/modeler/properties/material/thermal/soilunfrozenwatercontent/hydraulic/__init__.py +0 -0
- rs2/modeler/properties/pile/Beam.py +34 -0
- rs2/modeler/properties/pile/Elastic.py +45 -0
- rs2/modeler/properties/pile/ForceDisplacement.py +59 -0
- rs2/modeler/properties/pile/Linear.py +59 -0
- rs2/modeler/properties/pile/MaterialDependentPile.py +87 -0
- rs2/modeler/properties/pile/MohrCoulombPile.py +94 -0
- rs2/modeler/properties/pile/MultiLinear.py +56 -0
- rs2/modeler/properties/pile/Pile.py +63 -0
- rs2/modeler/properties/pile/__init__.py +0 -0
- rs2/modeler/properties/propertyProxy.py +283 -0
- rs2/utilities/ApplicationManager.py +64 -0
- rs2/utilities/ColorPicker.py +78 -0
- rs2/utilities/__init__.py +0 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
class QueryPointResult:
|
|
2
|
+
def __init__(self, x_location, y_location, time, value):
|
|
3
|
+
self.x_location = x_location
|
|
4
|
+
self.y_location = y_location
|
|
5
|
+
self.time = time
|
|
6
|
+
self.value = value
|
|
7
|
+
|
|
8
|
+
def GetXCoordinate(self) -> float:
|
|
9
|
+
'''
|
|
10
|
+
Returns the X-Coordinate of the query point
|
|
11
|
+
'''
|
|
12
|
+
return self.x_location
|
|
13
|
+
|
|
14
|
+
def GetYCoordinate(self) -> float:
|
|
15
|
+
'''
|
|
16
|
+
Returns the Y-Coordinate of the query point
|
|
17
|
+
'''
|
|
18
|
+
return self.y_location
|
|
19
|
+
|
|
20
|
+
def GetStageTime(self) -> float:
|
|
21
|
+
'''
|
|
22
|
+
Returns the dynamic stage time of the query point
|
|
23
|
+
'''
|
|
24
|
+
return self.time
|
|
25
|
+
|
|
26
|
+
def GetValue(self) -> float:
|
|
27
|
+
'''
|
|
28
|
+
Returns the value of the time query point
|
|
29
|
+
'''
|
|
30
|
+
return self.value
|
|
31
|
+
|
|
32
|
+
class QueryLineResult:
|
|
33
|
+
def __init__(self, list_node_values):
|
|
34
|
+
list_node_value_obj = []
|
|
35
|
+
for node_value in list_node_values:
|
|
36
|
+
list_node_value_obj.append(QueryPointResult(*node_value))
|
|
37
|
+
self.query_values = list_node_value_obj
|
|
38
|
+
|
|
39
|
+
def GetNodeValues(self) -> list[QueryPointResult]:
|
|
40
|
+
'''
|
|
41
|
+
| Returns a list[QueryPointResult] representing result at this node part of the time query line
|
|
42
|
+
| To get the x-coordinate, y-coordinate, dynamic stage time, or value, please call the supporting class methods:
|
|
43
|
+
|
|
44
|
+
* QueryPointResult.GetXCoordinate()
|
|
45
|
+
* QueryPointResult.GetYCoordinate()
|
|
46
|
+
* QueryPointResult.GetStageTime()
|
|
47
|
+
* QueryPointResult.GetValue()
|
|
48
|
+
'''
|
|
49
|
+
return self.query_values
|
|
50
|
+
|
|
51
|
+
class TimeQueryPointResults:
|
|
52
|
+
# Stores all time query points result for specific stage
|
|
53
|
+
def __init__(self, entity_ID, query_point_values):
|
|
54
|
+
self.entity_ID = entity_ID
|
|
55
|
+
# Construct QueryPointResult objects
|
|
56
|
+
query_values_obj = []
|
|
57
|
+
for value in query_point_values:
|
|
58
|
+
query_values_obj.append(QueryPointResult(*value))
|
|
59
|
+
self.query_values = query_values_obj
|
|
60
|
+
|
|
61
|
+
def GetUniqueIdentifier(self) -> int:
|
|
62
|
+
'''
|
|
63
|
+
Returns the unique identifier for the time query point
|
|
64
|
+
'''
|
|
65
|
+
return self.entity_ID
|
|
66
|
+
|
|
67
|
+
def GetAllValues(self) -> list[QueryPointResult]:
|
|
68
|
+
'''
|
|
69
|
+
| Returns a list[QueryPointResult] representing result at all nodes of the time query point
|
|
70
|
+
| To get the x-coordinate, y-coordinate, dynamic stage time, or value, please call the supporting class methods:
|
|
71
|
+
|
|
72
|
+
* QueryPointResult.GetXCoordinate()
|
|
73
|
+
* QueryPointResult.GetYCoordinate()
|
|
74
|
+
* QueryPointResult.GetStageTime()
|
|
75
|
+
* QueryPointResult.GetValue()
|
|
76
|
+
'''
|
|
77
|
+
return self.query_values
|
|
78
|
+
|
|
79
|
+
class TimeQueryLineResults:
|
|
80
|
+
# Stores all time query line result for specific stage
|
|
81
|
+
def __init__(self, entity_ID, list_query_line_data):
|
|
82
|
+
self.entity_ID = entity_ID
|
|
83
|
+
# Construct QueryPointResult objects
|
|
84
|
+
list_query_line_obj = []
|
|
85
|
+
for list_line_node_data in list_query_line_data:
|
|
86
|
+
list_query_line_obj.append(QueryLineResult(list_line_node_data))
|
|
87
|
+
self.line_data = list_query_line_obj
|
|
88
|
+
|
|
89
|
+
def GetUniqueIdentifier(self) -> int:
|
|
90
|
+
'''
|
|
91
|
+
Returns the unique identifier for the time query point
|
|
92
|
+
'''
|
|
93
|
+
return self.entity_ID
|
|
94
|
+
|
|
95
|
+
def GetAllNodeObjects(self) -> list[QueryLineResult]:
|
|
96
|
+
'''
|
|
97
|
+
Returns a list[QueryLineResult] representing nodes making up the time query line
|
|
98
|
+
|
|
99
|
+
To get list of node values associated with a specific node, please call the supported class method:
|
|
100
|
+
|
|
101
|
+
* QueryLineResult.GetNodeValues()
|
|
102
|
+
|
|
103
|
+
| The above returns a list[QueryPointResult] representing result at this node part of the time query line
|
|
104
|
+
| To get the x-coordinate, y-coordinate, dynamic stage time, or value, please call the supporting class methods:
|
|
105
|
+
|
|
106
|
+
* QueryPointResult.GetXCoordinate()
|
|
107
|
+
* QueryPointResult.GetYCoordinate()
|
|
108
|
+
* QueryPointResult.GetStageTime()
|
|
109
|
+
* QueryPointResult.GetValue()
|
|
110
|
+
'''
|
|
111
|
+
return self.line_data
|
|
File without changes
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
from rs2.interpreter._UtilityResult import *
|
|
3
|
+
|
|
4
|
+
class BoltElementYieldStatus(Enum):
|
|
5
|
+
BOLT_ELEMENT_NOT_YIELDED = 0
|
|
6
|
+
BOLT_ELEMENT_TYPE_UNKNOWN_YIELDED = 1
|
|
7
|
+
BOLT_ELEMENT_TENSION_YIELDED = 2
|
|
8
|
+
BOLT_ELEMENT_SHEAR_YIELDED = 4
|
|
9
|
+
BOLT_ELEMENT_TENSIONANDSHEAR_YIELDED = BOLT_ELEMENT_TENSION_YIELDED + BOLT_ELEMENT_SHEAR_YIELDED
|
|
10
|
+
BOLT_ELEMENT_UNDEFINED_YIELDED = -1
|
|
11
|
+
|
|
12
|
+
class BoltYieldingResult:
|
|
13
|
+
def __init__(self, start_x, start_y, end_x, end_y, yielding_flag):
|
|
14
|
+
self.start_x = start_x #0
|
|
15
|
+
self.start_y = start_y #1
|
|
16
|
+
self.end_x = end_x #2
|
|
17
|
+
self.end_y = end_y #3
|
|
18
|
+
self.yielding_flag = BoltElementYieldStatus(yielding_flag) #4
|
|
19
|
+
ResetInvalid.validate(self)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class BoltForceDisplacementResult:
|
|
23
|
+
def __init__(self, location_x, location_y, distance, axial_force, axial_stress, shear_force, rock_displacement, bolt_displacement):
|
|
24
|
+
self.location_x = location_x #0
|
|
25
|
+
self.location_y = location_y #1
|
|
26
|
+
self.distance = distance #2
|
|
27
|
+
self.axial_force = axial_force #3
|
|
28
|
+
self.axial_stress = axial_stress #4
|
|
29
|
+
self.shear_force = shear_force #5
|
|
30
|
+
self.rock_displacement = rock_displacement #6
|
|
31
|
+
self.bolt_displacement = bolt_displacement #7
|
|
32
|
+
ResetInvalid.validate(self)
|
|
33
|
+
|
|
34
|
+
class BoltResult:
|
|
35
|
+
def __init__(self, entity_id, entity_data, yielding_results: BoltYieldingResult, force_displacement_results: BoltForceDisplacementResult):
|
|
36
|
+
if len(entity_data) == 0 or len(entity_data[0]) == 0:
|
|
37
|
+
assert False, 'location not defined'
|
|
38
|
+
return
|
|
39
|
+
location_tensor = entity_data[0][0]
|
|
40
|
+
start_x, start_y, end_x, end_y = location_tensor
|
|
41
|
+
|
|
42
|
+
self.entity_id = entity_id
|
|
43
|
+
self.start_x = start_x
|
|
44
|
+
self.start_y = start_y
|
|
45
|
+
self.end_x = end_x
|
|
46
|
+
self.end_y = end_y
|
|
47
|
+
self.yielding_results: BoltYieldingResult = yielding_results
|
|
48
|
+
self.force_displacement_results: BoltForceDisplacementResult = force_displacement_results
|
|
49
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from rs2.interpreter.supportResults.LinerResult import LinerResult
|
|
2
|
+
from rs2.interpreter.supportResults.JointResult import JointResult
|
|
3
|
+
|
|
4
|
+
class PileResult:
|
|
5
|
+
def __init__(self, entity_id, joint_result: JointResult, liner_result: LinerResult):
|
|
6
|
+
self.entity_id = entity_id
|
|
7
|
+
self.joint_result: JointResult = joint_result
|
|
8
|
+
self.liner_result: LinerResult = liner_result
|
|
9
|
+
|
|
10
|
+
class CompositeResult:
|
|
11
|
+
def __init__(self, entity_id, joint_result: JointResult, liner_result: LinerResult):
|
|
12
|
+
self.entity_id = entity_id
|
|
13
|
+
self.joint_result: JointResult = joint_result
|
|
14
|
+
self.liner_result: LinerResult = liner_result
|
|
15
|
+
|
|
16
|
+
class StructuralResult:
|
|
17
|
+
def __init__(self, entity_id, joint_result: JointResult, liner_result: LinerResult):
|
|
18
|
+
self.entity_id = entity_id
|
|
19
|
+
self.joint_result: JointResult = joint_result
|
|
20
|
+
self.liner_result: LinerResult = liner_result
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from rs2.interpreter._UtilityResult import *
|
|
2
|
+
|
|
3
|
+
class JointElementResult:
|
|
4
|
+
def __init__(self, start_x, start_y, end_x, end_y, distance, normal_stress, shear_stress,confining_stress, normal_displacement, shear_displacement, yielded):
|
|
5
|
+
self.start_x = start_x
|
|
6
|
+
self.start_y = start_y
|
|
7
|
+
self.end_x = end_x
|
|
8
|
+
self.end_y = end_y
|
|
9
|
+
self.distance = distance
|
|
10
|
+
self.normal_stress = normal_stress
|
|
11
|
+
self.shear_stress = shear_stress
|
|
12
|
+
self.confining_stress = confining_stress
|
|
13
|
+
self.normal_displacement = normal_displacement
|
|
14
|
+
self.shear_displacement = shear_displacement
|
|
15
|
+
self.yielded = bool(yielded)
|
|
16
|
+
ResetInvalid.validate(self)
|
|
17
|
+
|
|
18
|
+
class JointResult:
|
|
19
|
+
def __init__(self, entity_id, joint_element_results: JointElementResult):
|
|
20
|
+
self.entity_id = entity_id
|
|
21
|
+
self.joint_element_results: JointElementResult = joint_element_results
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from rs2.interpreter._UtilityResult import *
|
|
2
|
+
|
|
3
|
+
class LinerElementResult:
|
|
4
|
+
def __init__(self,composite_layer, node_start, node_end, start_x, start_y, end_x, end_y, distance,axial_force, moment1, moment_mid, moment2, shear_force, displacement_total, displacement_x, displacement_y,
|
|
5
|
+
axi_sym_force, axi_sym_moment,beam_yield,temperature):
|
|
6
|
+
|
|
7
|
+
self.composite_layer = int(composite_layer) #0
|
|
8
|
+
self.node_start = int(node_start) #1
|
|
9
|
+
self.node_end = int(node_end)#2
|
|
10
|
+
self.start_x = start_x#3
|
|
11
|
+
self.start_y = start_y#4
|
|
12
|
+
self.end_x = end_x#5
|
|
13
|
+
self.end_y = end_y#6
|
|
14
|
+
self.distance = distance#7
|
|
15
|
+
|
|
16
|
+
self.axial_force = axial_force#8
|
|
17
|
+
self.moment1 = moment1#9
|
|
18
|
+
self.moment_mid = moment_mid#10
|
|
19
|
+
self.moment2 = moment2#11
|
|
20
|
+
self.shear_force = shear_force#12
|
|
21
|
+
self.displacement_total = displacement_total#13
|
|
22
|
+
self.displacement_x = displacement_x#14
|
|
23
|
+
self.displacement_y = displacement_y#15
|
|
24
|
+
self.axi_sym_force = axi_sym_force#16
|
|
25
|
+
self.axi_sym_moment = axi_sym_moment#17
|
|
26
|
+
self.beam_yield = bool(beam_yield)#18
|
|
27
|
+
self.temperature = temperature#25
|
|
28
|
+
ResetInvalid.validate(self)
|
|
29
|
+
|
|
30
|
+
class LinerResult:
|
|
31
|
+
def __init__(self, entity_id, liner_element_results: LinerElementResult):
|
|
32
|
+
self.entity_id = entity_id
|
|
33
|
+
self.liner_element_results: LinerElementResult = liner_element_results
|
|
File without changes
|
rs2/modeler/Model.py
ADDED
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
from rs2.modeler.properties.bolt.Bolt import BoltProperty
|
|
2
|
+
from rs2.modeler.properties.liner.Liner import LinerProperty
|
|
3
|
+
from rs2.modeler.properties.joint.Joint import JointProperty
|
|
4
|
+
from rs2.modeler.properties.pile.Pile import PileProperty
|
|
5
|
+
from rs2.modeler.properties.StructuralInterface import StructuralInterfaceProperty
|
|
6
|
+
from rs2.modeler.properties.CompositeProperty import CompositeProperty
|
|
7
|
+
|
|
8
|
+
from rs2.modeler.properties.material.MaterialProperty import MaterialProperty
|
|
9
|
+
from rs2.modeler.properties.ShearNormalFunction import ShearNormalFunction
|
|
10
|
+
from rs2.modeler.properties.UserDefinedWaterMode import UserDefinedWaterMode
|
|
11
|
+
from rs2.modeler.properties.DiscreteFunction import DiscreteFunction
|
|
12
|
+
|
|
13
|
+
from rs2.BaseModel import BaseModel
|
|
14
|
+
|
|
15
|
+
class Model(BaseModel):
|
|
16
|
+
"""
|
|
17
|
+
:ref:`Model Example`
|
|
18
|
+
"""
|
|
19
|
+
def getBoltPropertyByName(self, boltName : str) -> BoltProperty:
|
|
20
|
+
'''
|
|
21
|
+
| Returns a Bolt Property object based on its name.
|
|
22
|
+
'''
|
|
23
|
+
|
|
24
|
+
boltObjectID = self._callFunction('getBoltPropertyByName', [boltName], keepReturnValueReference=True)
|
|
25
|
+
return BoltProperty(self._client, boltObjectID, self._documentProxy._ID)
|
|
26
|
+
|
|
27
|
+
def getLinerPropertyByName(self, linerName : str) -> LinerProperty:
|
|
28
|
+
'''
|
|
29
|
+
| Returns a Liner Property object based on its name.
|
|
30
|
+
'''
|
|
31
|
+
linerObjectID = self._callFunction('getLinerPropertyByName', [linerName], keepReturnValueReference=True)
|
|
32
|
+
return LinerProperty(self._client, linerObjectID, self._documentProxy._ID)
|
|
33
|
+
|
|
34
|
+
def getJointPropertyByName(self, jointName : str) -> JointProperty:
|
|
35
|
+
'''
|
|
36
|
+
| Returns a Joint Property object based on its name.
|
|
37
|
+
'''
|
|
38
|
+
jointObjectID = self._callFunction('getJointPropertyByName', [jointName], keepReturnValueReference=True)
|
|
39
|
+
return JointProperty(self._client, jointObjectID, self._documentProxy._ID)
|
|
40
|
+
|
|
41
|
+
def getPilePropertyByName(self, pileName : str) -> PileProperty:
|
|
42
|
+
'''
|
|
43
|
+
| Returns a Pile Property object based on its name.
|
|
44
|
+
'''
|
|
45
|
+
pileObjectID = self._callFunction('getPilePropertyByName', [pileName], keepReturnValueReference=True)
|
|
46
|
+
return PileProperty(self._client, pileObjectID, self._documentProxy._ID)
|
|
47
|
+
|
|
48
|
+
def getStructuralInterfacePropertyByName(self, structuralName : str) -> StructuralInterfaceProperty:
|
|
49
|
+
'''
|
|
50
|
+
| Returns a Structural Interface Property object based on its name.
|
|
51
|
+
'''
|
|
52
|
+
structuralInterfaceObjectID = self._callFunction('getStructuralPropertyByName', [structuralName], keepReturnValueReference=True)
|
|
53
|
+
return StructuralInterfaceProperty(self._client, structuralInterfaceObjectID, self._documentProxy._ID)
|
|
54
|
+
|
|
55
|
+
def getCompositeLinerPropertyByName(self, compositeName : str) -> CompositeProperty:
|
|
56
|
+
'''
|
|
57
|
+
| Returns a Composite Liner Property object based on its name.
|
|
58
|
+
'''
|
|
59
|
+
compositeLinerObjectID = self._callFunction('getCompositePropertyByName', [compositeName], keepReturnValueReference=True)
|
|
60
|
+
return CompositeProperty(self._client, compositeLinerObjectID, self._documentProxy._ID)
|
|
61
|
+
|
|
62
|
+
def getMaterialPropertyByName(self, materialName : str) -> MaterialProperty:
|
|
63
|
+
'''
|
|
64
|
+
| Returns a Material Property object based on its name.
|
|
65
|
+
'''
|
|
66
|
+
materialObjectID = self._callFunction('getMaterialPropertyByName', [materialName], keepReturnValueReference=True)
|
|
67
|
+
return MaterialProperty(self._client, materialObjectID, self._documentProxy._ID)
|
|
68
|
+
|
|
69
|
+
def getAllBoltProperties(self) -> list[BoltProperty]:
|
|
70
|
+
|
|
71
|
+
'''
|
|
72
|
+
| Returns a list of all Bolt Property objects
|
|
73
|
+
'''
|
|
74
|
+
activeBoltProperties = []
|
|
75
|
+
boltObjectIDList = self._callFunction('getAllBoltProperties', [], keepReturnValueReference=True)
|
|
76
|
+
for boltObjectID in boltObjectIDList:
|
|
77
|
+
activeBoltProperties.append(BoltProperty(self._client, boltObjectID, self._documentProxy._ID))
|
|
78
|
+
return activeBoltProperties
|
|
79
|
+
|
|
80
|
+
def getAllLinerProperties(self) -> list[LinerProperty]:
|
|
81
|
+
'''
|
|
82
|
+
| Returns a list of all Liner Property objects
|
|
83
|
+
'''
|
|
84
|
+
activeLinerProperties = []
|
|
85
|
+
linerObjectIDList = self._callFunction('getAllLinerProperties', [], keepReturnValueReference=True)
|
|
86
|
+
for linerObjectID in linerObjectIDList:
|
|
87
|
+
activeLinerProperties.append(LinerProperty(self._client, linerObjectID, self._documentProxy._ID))
|
|
88
|
+
return activeLinerProperties
|
|
89
|
+
|
|
90
|
+
def getAllJointProperties(self) -> list[JointProperty]:
|
|
91
|
+
'''
|
|
92
|
+
| Returns a list of all Joint Property objects
|
|
93
|
+
'''
|
|
94
|
+
activeJointProperties = []
|
|
95
|
+
jointObjectIDList = self._callFunction('getAllJointProperties', [], keepReturnValueReference=True)
|
|
96
|
+
for jointObjectID in jointObjectIDList:
|
|
97
|
+
activeJointProperties.append(JointProperty(self._client, jointObjectID, self._documentProxy._ID))
|
|
98
|
+
return activeJointProperties
|
|
99
|
+
|
|
100
|
+
def getAllPileProperties(self) -> list[PileProperty]:
|
|
101
|
+
'''
|
|
102
|
+
| Returns a list of all Pile Property objects
|
|
103
|
+
'''
|
|
104
|
+
activePileProperties = []
|
|
105
|
+
pileObjectIDList = self._callFunction('getAllPileProperties', [], keepReturnValueReference=True)
|
|
106
|
+
for pileObjectID in pileObjectIDList:
|
|
107
|
+
activePileProperties.append(PileProperty(self._client, pileObjectID, self._documentProxy._ID))
|
|
108
|
+
return activePileProperties
|
|
109
|
+
|
|
110
|
+
def getAllStructuralInterfaceProperties(self) -> list[StructuralInterfaceProperty]:
|
|
111
|
+
'''
|
|
112
|
+
| Returns a list of all Structural Interface Property objects
|
|
113
|
+
'''
|
|
114
|
+
activeStructuralProperties = []
|
|
115
|
+
structuralObjectIDList = self._callFunction('getAllStructuralProperties', [], keepReturnValueReference=True)
|
|
116
|
+
for structuralObjectID in structuralObjectIDList:
|
|
117
|
+
activeStructuralProperties.append(StructuralInterfaceProperty(self._client, structuralObjectID, self._documentProxy._ID))
|
|
118
|
+
return activeStructuralProperties
|
|
119
|
+
|
|
120
|
+
def getAllCompositeLinerProperties(self) -> list[CompositeProperty]:
|
|
121
|
+
'''
|
|
122
|
+
| Returns a list of all Composite Liner Property objects
|
|
123
|
+
'''
|
|
124
|
+
activeCompositeProperties = []
|
|
125
|
+
compositeObjectIDList = self._callFunction('getAllCompositeProperties', [], keepReturnValueReference=True)
|
|
126
|
+
for compositeObjectID in compositeObjectIDList:
|
|
127
|
+
activeCompositeProperties.append(CompositeProperty(self._client, compositeObjectID, self._documentProxy._ID))
|
|
128
|
+
return activeCompositeProperties
|
|
129
|
+
|
|
130
|
+
def getAllMaterialProperties(self) -> list[MaterialProperty]:
|
|
131
|
+
'''
|
|
132
|
+
| Returns a list of all Material Property objects
|
|
133
|
+
'''
|
|
134
|
+
activeMaterialProperties = []
|
|
135
|
+
materialObjectIDList = self._callFunction('getAllMaterialProperties', [], keepReturnValueReference=True)
|
|
136
|
+
for materialObjectID in materialObjectIDList:
|
|
137
|
+
activeMaterialProperties.append(MaterialProperty(self._client, materialObjectID, self._documentProxy._ID))
|
|
138
|
+
return activeMaterialProperties
|
|
139
|
+
|
|
140
|
+
def getShearNormalFunctions(self) -> list[ShearNormalFunction]:
|
|
141
|
+
'''
|
|
142
|
+
| Returns a list of all shear normal functions
|
|
143
|
+
'''
|
|
144
|
+
activeShearNormalFunctionProperties = []
|
|
145
|
+
shearNormalFunctionIDList = self._callFunction('getShearNormalFunctions', [], keepReturnValueReference=True)
|
|
146
|
+
for shearNormalFunctionObjectID in shearNormalFunctionIDList:
|
|
147
|
+
activeShearNormalFunctionProperties.append(ShearNormalFunction(self._client, shearNormalFunctionObjectID))
|
|
148
|
+
return activeShearNormalFunctionProperties
|
|
149
|
+
|
|
150
|
+
def getShearNormalFunctionByName(self, shearNormalFunctionName : str) -> ShearNormalFunction:
|
|
151
|
+
'''
|
|
152
|
+
| Returns a shear normal function object based on its name.
|
|
153
|
+
'''
|
|
154
|
+
shearNormalFunctionObjectID = self._callFunction('getShearNormalFunctionByName', [shearNormalFunctionName], keepReturnValueReference=True)
|
|
155
|
+
return ShearNormalFunction(self._client, shearNormalFunctionObjectID)
|
|
156
|
+
|
|
157
|
+
def createNewShearNormalFunction(self, functionName):
|
|
158
|
+
'''
|
|
159
|
+
| Creates a new shear normal function with the given name
|
|
160
|
+
'''
|
|
161
|
+
return self._callFunction('createNewShearNormalFunction', [functionName])
|
|
162
|
+
|
|
163
|
+
def deleteShearNormalFunction(self, functionName):
|
|
164
|
+
'''
|
|
165
|
+
| Deletes a shear normal function with the given name
|
|
166
|
+
'''
|
|
167
|
+
return self._callFunction('deleteShearNormalFunction', [functionName])
|
|
168
|
+
|
|
169
|
+
def renameShearNormalFunction(self, oldName, newName):
|
|
170
|
+
'''
|
|
171
|
+
| Renames a shear normal function with the given name
|
|
172
|
+
'''
|
|
173
|
+
return self._callFunction('renameShearNormalFunction', [oldName, newName])
|
|
174
|
+
|
|
175
|
+
def getUserDefinedPermeabilityAndWaterContentMode(self, name : str) -> UserDefinedWaterMode:
|
|
176
|
+
'''
|
|
177
|
+
| Returns a User Defined Water Mode object based on its name.
|
|
178
|
+
'''
|
|
179
|
+
userDefinedWaterModeObjectID = self._callFunction('getUserDefinedWaterMode', [name], keepReturnValueReference=True)
|
|
180
|
+
return UserDefinedWaterMode(self._client, userDefinedWaterModeObjectID)
|
|
181
|
+
|
|
182
|
+
def createUserDefinedPermeabilityAndWaterContentMode(self, name : str) -> UserDefinedWaterMode:
|
|
183
|
+
'''
|
|
184
|
+
| Creates a User Defined Water Mode object with the given name.
|
|
185
|
+
'''
|
|
186
|
+
userDefinedWaterModeObjectID = self._callFunction('createUserDefinedWaterMode', [name], keepReturnValueReference=True)
|
|
187
|
+
return UserDefinedWaterMode(self._client, userDefinedWaterModeObjectID)
|
|
188
|
+
|
|
189
|
+
def deleteUserDefinedPermeabilityAndWaterContentMode(self, name : str):
|
|
190
|
+
'''
|
|
191
|
+
| Deletes a User Defined Water Mode object with the given name.
|
|
192
|
+
'''
|
|
193
|
+
return self._callFunction('deleteUserDefinedWaterMode', [name])
|
|
194
|
+
|
|
195
|
+
def renameUserDefinedPermeabilityAndWaterContentMode(self, oldName : str, newName : str):
|
|
196
|
+
'''
|
|
197
|
+
| Renames a User Defined Water Mode object with the given name.
|
|
198
|
+
'''
|
|
199
|
+
return self._callFunction('renameUserDefinedWaterMode', [oldName, newName])
|
|
200
|
+
|
|
201
|
+
def AddHistoryQueryPoint(self, x: float, y: float, history_query_name: str):
|
|
202
|
+
'''
|
|
203
|
+
:ref:`History Query Example`
|
|
204
|
+
|
|
205
|
+
| Add a new History Query point to your model with the specified coordinates and label name
|
|
206
|
+
|
|
207
|
+
'''
|
|
208
|
+
return self._callFunction('AddHistoryQueryPoint', [x, y, history_query_name])
|
|
209
|
+
|
|
210
|
+
def RemoveHistoryQueryPoint(self, history_query_name: str):
|
|
211
|
+
'''
|
|
212
|
+
:ref:`History Query Example`
|
|
213
|
+
|
|
214
|
+
| Remove a History Query point from your model by label name.
|
|
215
|
+
|
|
216
|
+
'''
|
|
217
|
+
return self._callFunction('RemoveHistoryQueryPoint', [history_query_name])
|
|
218
|
+
|
|
219
|
+
def AddTimeQueryLine(self, points: list[list[float]], points_on_line: int) -> str:
|
|
220
|
+
'''
|
|
221
|
+
:ref:`Time Query Example`
|
|
222
|
+
|
|
223
|
+
| Add a new Time Query Line to your model with the specified coordinates
|
|
224
|
+
|
|
225
|
+
Warning:
|
|
226
|
+
points_on_line must be between 1 and 10 inclusive.
|
|
227
|
+
|
|
228
|
+
'''
|
|
229
|
+
return self._callFunction('AddTimeQueryLine', [points, points_on_line])
|
|
230
|
+
|
|
231
|
+
def RemoveTimeQueryLine(self, IDs_toRemove: list[str]):
|
|
232
|
+
'''
|
|
233
|
+
:ref:`Time Query Example`
|
|
234
|
+
|
|
235
|
+
| Removes Time Query Line(s) from your model using provided list of IDs.
|
|
236
|
+
|
|
237
|
+
'''
|
|
238
|
+
return self._callFunction('RemoveTimeQueryLine', [IDs_toRemove])
|
|
239
|
+
|
|
240
|
+
def AddTimeQueryPoint(self, x: float, y: float) -> str:
|
|
241
|
+
'''
|
|
242
|
+
:ref:`Time Query Example`
|
|
243
|
+
|
|
244
|
+
| Add a new Time Query Point to your model with the specified x and y coordinates
|
|
245
|
+
|
|
246
|
+
'''
|
|
247
|
+
return self._callFunction('AddTimeQueryPoint', [x, y])
|
|
248
|
+
|
|
249
|
+
def RemoveTimeQueryPoint(self, IDs_toRemove: list[str]):
|
|
250
|
+
'''
|
|
251
|
+
:ref:`Time Query Example`
|
|
252
|
+
|
|
253
|
+
| Removes Time Query Point(s) from your model using provided list of IDs.
|
|
254
|
+
|
|
255
|
+
'''
|
|
256
|
+
return self._callFunction('RemoveTimeQueryPoint', [IDs_toRemove])
|
|
257
|
+
|
|
258
|
+
def compute(self):
|
|
259
|
+
'''
|
|
260
|
+
| Saves the file if modified and then runs compute. Replaces any existing results.
|
|
261
|
+
|
|
262
|
+
Warning:
|
|
263
|
+
All objects retrieved from the interpreter for this file will be invalidated after this call.
|
|
264
|
+
If you have an interpreter model open, you should close, compute, and then re-open the model.
|
|
265
|
+
|
|
266
|
+
.. code-block:: python
|
|
267
|
+
|
|
268
|
+
interpreterModel.close()
|
|
269
|
+
model.compute()
|
|
270
|
+
interpreterModel = modeler.openFile('C:/previouslyOpened.fez')
|
|
271
|
+
|
|
272
|
+
'''
|
|
273
|
+
return self._callFunction('compute', [False])
|
|
274
|
+
|
|
275
|
+
def computeGroundWater(self):
|
|
276
|
+
'''
|
|
277
|
+
| Saves the file if modified and then runs groundwater compute. Replaces any existing results.
|
|
278
|
+
|
|
279
|
+
Warning:
|
|
280
|
+
All objects retrieved from the interpreter for this file will be invalidated after this call.
|
|
281
|
+
If you have an interpreter model open, you should close, compute, and then re-open the model.
|
|
282
|
+
|
|
283
|
+
.. code-block:: python
|
|
284
|
+
|
|
285
|
+
interpreterModel.close()
|
|
286
|
+
model.compute()
|
|
287
|
+
interpreterModel = modeler.openFile('C:/previouslyOpened.fez')
|
|
288
|
+
'''
|
|
289
|
+
return self._callFunction('compute', [True])
|
|
290
|
+
|
|
291
|
+
def saveAs(self, fileName : str):
|
|
292
|
+
'''
|
|
293
|
+
| Saves the model using the given file name.
|
|
294
|
+
|
|
295
|
+
Example:
|
|
296
|
+
|
|
297
|
+
.. code-block:: python
|
|
298
|
+
|
|
299
|
+
model.saveAs('C:/simple_3_stage.fez')
|
|
300
|
+
'''
|
|
301
|
+
formattedFileName = fileName.replace('/', '\\')
|
|
302
|
+
self._enforceFeaFezEnding(formattedFileName)
|
|
303
|
+
return self._callFunction('saveAs', [formattedFileName])
|
|
304
|
+
|
|
305
|
+
def getDiscreteFunctions(self) -> list[DiscreteFunction]:
|
|
306
|
+
'''
|
|
307
|
+
| Returns a list of all discrete functions
|
|
308
|
+
'''
|
|
309
|
+
activeDiscreteFunctionProperties = []
|
|
310
|
+
discreteFunctionIDList = self._callFunction('getDiscreteFunctions', [], keepReturnValueReference=True)
|
|
311
|
+
for discreteFunctionObjectID in discreteFunctionIDList:
|
|
312
|
+
activeDiscreteFunctionProperties.append(DiscreteFunction(self._client, discreteFunctionObjectID))
|
|
313
|
+
return activeDiscreteFunctionProperties
|
|
314
|
+
|
|
315
|
+
def getDiscreteFunctionByName(self, discreteFunctionName : str) -> DiscreteFunction:
|
|
316
|
+
'''
|
|
317
|
+
| Returns a discrete function object based on its name.
|
|
318
|
+
'''
|
|
319
|
+
discreteFunctionObjectID = self._callFunction('getDiscreteFunctionByName', [discreteFunctionName], keepReturnValueReference=True)
|
|
320
|
+
return DiscreteFunction(self._client, discreteFunctionObjectID)
|
|
321
|
+
|
|
322
|
+
def createNewDiscreteFunction(self, functionName):
|
|
323
|
+
'''
|
|
324
|
+
| Creates a new discrete function with the given name
|
|
325
|
+
'''
|
|
326
|
+
return self._callFunction('createNewDiscreteFunction', [functionName])
|
|
327
|
+
|
|
328
|
+
def deleteDiscreteFunction(self, functionName):
|
|
329
|
+
'''
|
|
330
|
+
| Deletes a discrete function with the given name
|
|
331
|
+
'''
|
|
332
|
+
return self._callFunction('deleteDiscreteFunction', [functionName])
|
|
333
|
+
|
|
334
|
+
def renameDiscreteFunction(self, oldName, newName):
|
|
335
|
+
'''
|
|
336
|
+
| Renames a discrete function with the given name
|
|
337
|
+
'''
|
|
338
|
+
return self._callFunction('renameDiscreteFunction', [oldName, newName])
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
def ResetProperties(self):
|
|
343
|
+
'''
|
|
344
|
+
:ref:`Get Model Units Example`
|
|
345
|
+
|
|
346
|
+
| Reset all properties for your model
|
|
347
|
+
|
|
348
|
+
'''
|
|
349
|
+
return self._callFunction('ResetProperties', [])
|
|
350
|
+
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
from rsmessages.requestFormat import functionRequest
|
|
2
|
+
from rs2._common.Client import Client
|
|
3
|
+
from rs2.modeler.Model import Model
|
|
4
|
+
from rs2.utilities.ApplicationManager import ApplicationManager
|
|
5
|
+
import winreg
|
|
6
|
+
import time
|
|
7
|
+
|
|
8
|
+
class RS2Modeler:
|
|
9
|
+
"""
|
|
10
|
+
:ref:`Modeler Example`
|
|
11
|
+
"""
|
|
12
|
+
def __init__(self, host='localhost', port=60054):
|
|
13
|
+
self.client = Client(host, port)
|
|
14
|
+
|
|
15
|
+
def openFile(self, fileName : str) -> Model:
|
|
16
|
+
'''
|
|
17
|
+
Takes in the absolute path to an rs2 file to be opened in the modeler.
|
|
18
|
+
|
|
19
|
+
Example:
|
|
20
|
+
|
|
21
|
+
.. code-block:: python
|
|
22
|
+
|
|
23
|
+
model = modeler.openFile('C:/simple_3_stage.fez')
|
|
24
|
+
'''
|
|
25
|
+
request = functionRequest('open_file', [fileName], keepReturnValueReference=True)
|
|
26
|
+
modelObjectId = self.client.callFunction(request)
|
|
27
|
+
model = Model(self.client, modelObjectId)
|
|
28
|
+
return model
|
|
29
|
+
|
|
30
|
+
@classmethod
|
|
31
|
+
def startApplication(cls, port : int, overridePathToExecutable : str = None, timeout : float = 30) -> None:
|
|
32
|
+
"""Opens the most recently installed RS2 application. Starts the python server and binds it to the given port.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
port (int): the port to bind the python server to. Use this same port when initializing RS2Modeler
|
|
36
|
+
overridePathToExecutable (str, optional): full path to the desired executable to be opened. If not provided, the latest installation of rs2 is used
|
|
37
|
+
timeout (float, optional): the maximum amount of time to wait for the application and server to start.
|
|
38
|
+
|
|
39
|
+
Raises:
|
|
40
|
+
ValueError: Port range must be between 49152 and 65535, otherwise ValueError is raised
|
|
41
|
+
TimeoutError: if timeout is provided, raises TimeoutError if not able to connect to the server within that time.
|
|
42
|
+
"""
|
|
43
|
+
appManager = ApplicationManager()
|
|
44
|
+
executablePath = overridePathToExecutable if overridePathToExecutable else cls._getApplicationPath()
|
|
45
|
+
appManager.startApplication(executablePath, port, timeout)
|
|
46
|
+
|
|
47
|
+
@staticmethod
|
|
48
|
+
def _getApplicationPath() -> str:
|
|
49
|
+
|
|
50
|
+
registry = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
|
|
51
|
+
key = winreg.OpenKey(registry, r'SOFTWARE\Rocscience\RS2 11.0')
|
|
52
|
+
installationLocation, type = winreg.QueryValueEx(key, "Install")
|
|
53
|
+
|
|
54
|
+
rs2ModelerInstallLocation = rf"{installationLocation}\RS2"
|
|
55
|
+
|
|
56
|
+
return rs2ModelerInstallLocation
|
|
57
|
+
|
|
58
|
+
def closeProgram(self, saveModels=True, timeout=30):
|
|
59
|
+
'''
|
|
60
|
+
Closes the modeler program. All unsaved models are saved by default.
|
|
61
|
+
|
|
62
|
+
Example:
|
|
63
|
+
|
|
64
|
+
.. code-block:: python
|
|
65
|
+
|
|
66
|
+
#saves all models before closing
|
|
67
|
+
modeler.closeProgram(True)
|
|
68
|
+
|
|
69
|
+
#closes the program without saving
|
|
70
|
+
modeler.closeProgram(False)
|
|
71
|
+
'''
|
|
72
|
+
request = functionRequest('closeProgram', [saveModels])
|
|
73
|
+
portUsed = self.client.callFunction(request)
|
|
74
|
+
self.client.closeConnection()
|
|
75
|
+
appManager = ApplicationManager()
|
|
76
|
+
portIsAvailable = False
|
|
77
|
+
startTime = time.time()
|
|
78
|
+
while not portIsAvailable:
|
|
79
|
+
if (time.time() - startTime) > timeout:
|
|
80
|
+
raise TimeoutError("The application did not close within the given timeout time.")
|
|
81
|
+
portIsAvailable = appManager._isPortAvailable(portUsed)
|
rs2/modeler/__init__.py
ADDED
|
File without changes
|