Skip to content

Commit 0a4dc73

Browse files
authored
Merge pull request #7 from 1nforgiven2103/main
minor_functions_impl
2 parents 1831eb6 + f267cc5 commit 0a4dc73

4 files changed

Lines changed: 200 additions & 87 deletions

File tree

openstaad/geometry.py

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -11,65 +11,65 @@ def __init__(self):
1111
self._geometry = self._staad.Geometry
1212

1313
self._functions= [
14-
"AddBeam",
15-
"AddNode",
16-
"ClearMemberSelection",
17-
"CreatePhysicalMember",
18-
"DeletePhysicalMember",
19-
"DoTranslationalRepeat",
20-
"GetAnalyticalMemberCountForPhysicalMember",
21-
"GetAnalyticalMembersForPhysicalMember",
22-
"GetBeamLength",
23-
"GetBeamList",
24-
"GetBeamsConnectedAtNode",
25-
"GetGroupCount",
26-
"GetGroupEntities",
27-
"GetGroupEntityCount",
28-
"GetGroupNames",
29-
"GetIntersectBeamsCount",
30-
"GetLastBeamNo",
31-
"GetLastNodeNo",
32-
"GetLastPhysicalMemberNo",
33-
"GetMemberCount",
34-
"GetMemberIncidence",
35-
"GetNodeCoordinates",
36-
"GetNodeCount",
37-
"GetNodeDistance",
38-
"GetNodeIncidence",
39-
"GetNodeList",
40-
"GetNodeNumber",
41-
"GetNoOfBeamsConnectedAtNode",
42-
"GetNoOfSelectedBeams",
43-
"GetNoOfSelectedNodes",
44-
"GetNoOfSelectedPhysicalMembers",
45-
"GetPMemberCount",
46-
"GetPhysicalMemberCount",
47-
"GetPhysicalMemberList",
48-
"GetPhysicalMemberUniqueID",
49-
"GetSelectedBeams",
50-
"GetSelectedNodes",
51-
"GetSelectedPhysicalMembers",
52-
"IntersectBeams",
53-
"SelectMultipleBeams",
54-
"SelectMultiplePhysicalMembers",
55-
"SelectPhysicalMember",
56-
"SetPhysicalMemberUniqueID",
57-
"GetLastPlateNo",
58-
"GetNoOfSelectedPlates",
59-
"GetPlateCount",
60-
"GetPlateIncidence",
61-
"GetPlateNodeCount",
62-
"GetPlateList",
63-
"GetPlateUniqueID",
64-
"GetSelectedPlates",
65-
"SelectPlate",
66-
"SelectMultiplePlates",
67-
"SetPlateUniqueID",
68-
"ClearPlateSelection",
69-
"AddPlate",
70-
"AddMultiplePlates",
71-
"DeletePlate",
72-
"GetAreaOfPlates"
14+
"AddBeam",
15+
"AddMultiplePlates",
16+
"AddNode",
17+
"AddPlate",
18+
"ClearMemberSelection",
19+
"ClearPlateSelection",
20+
"CreatePhysicalMember",
21+
"DeletePhysicalMember",
22+
"DeletePlate",
23+
"DoTranslationalRepeat",
24+
"GetAnalyticalMemberCountForPhysicalMember",
25+
"GetAnalyticalMembersForPhysicalMember",
26+
"GetAreaOfPlates",
27+
"GetBeamLength",
28+
"GetBeamList",
29+
"GetBeamsConnectedAtNode",
30+
"GetGroupCount",
31+
"GetGroupEntities",
32+
"GetGroupEntityCount",
33+
"GetGroupNames",
34+
"GetIntersectBeamsCount",
35+
"GetLastBeamNo",
36+
"GetLastNodeNo",
37+
"GetLastPhysicalMemberNo",
38+
"GetLastPlateNo",
39+
"GetMemberCount",
40+
"GetMemberIncidence",
41+
"GetNodeCoordinates",
42+
"GetNodeCount",
43+
"GetNodeDistance",
44+
"GetNodeIncidence",
45+
"GetNodeList",
46+
"GetNodeNumber",
47+
"GetNoOfBeamsConnectedAtNode",
48+
"GetNoOfSelectedBeams",
49+
"GetNoOfSelectedNodes",
50+
"GetNoOfSelectedPhysicalMembers",
51+
"GetNoOfSelectedPlates",
52+
"GetPMemberCount",
53+
"GetPhysicalMemberCount",
54+
"GetPhysicalMemberList",
55+
"GetPhysicalMemberUniqueID",
56+
"GetPlateCount",
57+
"GetPlateIncidence",
58+
"GetPlateList",
59+
"GetPlateNodeCount",
60+
"GetPlateUniqueID",
61+
"GetSelectedBeams",
62+
"GetSelectedNodes",
63+
"GetSelectedPhysicalMembers",
64+
"GetSelectedPlates",
65+
"IntersectBeams",
66+
"SelectMultipleBeams",
67+
"SelectMultiplePhysicalMembers",
68+
"SelectMultiplePlates",
69+
"SelectPhysicalMember",
70+
"SelectPlate",
71+
"SetPhysicalMemberUniqueID",
72+
"SetPlateUniqueID"
7373
]
7474

7575
for function_name in self._functions:

openstaad/load.py

Lines changed: 76 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,30 @@ def __init__(self):
88
self._load = self._staad.Load
99

1010
self._functions= [
11-
"AddMemberConcForce",
12-
"AddResponseSpectrumLoadEx",
13-
"AddSelfWeightInXYZ",
14-
"AddWindDefinition",
15-
"ClearPrimaryLoadCase",
16-
"CreateNewPrimaryLoad",
17-
"CreateNewReferenceLoad",
18-
"DeleteDirectAnalysisDefinition",
19-
"DeleteDirectAnalysisDefinitionParameter",
20-
"DeleteWindDefinition",
21-
"GetLoadCaseTitle",
22-
"GetReferenceLoadCaseCount",
23-
"SetLoadActive",
24-
"SetReferenceLoadActive",
25-
"AddNodalLoad",
26-
"ClearReferenceLoadCase"
27-
]
11+
"AddMemberConcForce",
12+
"AddNodalLoad",
13+
"AddResponseSpectrumLoadEx",
14+
"AddSelfWeightInXYZ",
15+
"AddWindDefinition",
16+
"ClearPrimaryLoadCase",
17+
"ClearReferenceLoadCase",
18+
"CreateNewPrimaryLoad",
19+
"CreateNewReferenceLoad",
20+
"DeleteDirectAnalysisDefinition",
21+
"DeleteDirectAnalysisDefinitionParameter",
22+
"DeletePrimaryLoadCases",
23+
"DeleteWindDefinition",
24+
"GetLoadCombinationCaseCount",
25+
"GetLoadCombinationCaseNumbers",
26+
"GetLoadCaseTitle",
27+
"GetLoadListCount",
28+
"GetLoadType",
29+
"GetPrimaryLoadCaseCount",
30+
"GetReferenceLoadCaseCount",
31+
"GetReferenceLoadCaseNumbers",
32+
"SetLoadActive",
33+
"SetReferenceLoadActive"
34+
]
2835

2936
for function_name in self._functions:
3037
self._load._FlagAsMethod(function_name)
@@ -42,6 +49,15 @@ def make_safe_array_long(array):
4249

4350
return self._load.AddMemberConcForce(varBeamNo,varDirection,varForce,varD1,varD2)
4451

52+
def AddNodalLoad(self, nodes : list[int], fx : float, fy:float, fz:float, mx:float, my:float, mz:float):
53+
def make_safe_array_long(array):
54+
return automation._midlSAFEARRAY(ctypes.c_long).create(array)
55+
56+
safe_list = make_safe_array_long(nodes)
57+
varNodeNo = make_variant_vt_ref(safe_list, automation.VT_ARRAY | automation.VT_I4)
58+
59+
self._load.AddNodalLoad(varNodeNo,fx, fy, fz, mx, my, mz)
60+
4561
def AddResponseSpectrumLoadEx(self, code_number:int, modal_combination:int, set_names_1:list, set_values_1:list, spectrum_data_pairs:list[tuple],set_names_2:list=None, set_values_2:list=None):
4662
"""Adds Response Spectrum load item to the currently active load case.
4763
@@ -102,6 +118,9 @@ def ClearPrimaryLoadCase(self,load_case:int,is_reference_lc:bool=False):
102118
"""
103119
return self._load.ClearPrimaryLoadCase(load_case,is_reference_lc)
104120

121+
def ClearReferenceLoadCase(self,reference_load_number: int):
122+
self._load.ClearReferenceLoadCase(reference_load_number)
123+
105124
def CreateNewPrimaryLoad(self,LoadTitle:str="LOAD CASE X"):
106125
"""
107126
Creates new PRIMARY load case.
@@ -128,6 +147,9 @@ def DeleteDirectAnalysisDefinitionParameter(self,parameter_type:int=0):
128147
"""
129148
return self._load.DeleteDirectAnalysisDefinitionParameter(parameter_type)
130149

150+
def DeletePrimaryLoadCases(self,load_case:int,is_reference:bool=False):
151+
return self._load.DeletePrimaryLoadCases(load_case,is_reference)
152+
131153
def DeleteWindDefinition(self,type_No:int=0):
132154
"""
133155
Deletes Wind definition. All definitions will be deleted if this input is set as 0.
@@ -140,6 +162,42 @@ def GetLoadCaseTitle(self,lc:int=0):
140162
"""
141163
return self._load.GetLoadCaseTitle(lc)
142164

165+
def GetLoadCombinationCaseCount(self):
166+
"""
167+
Gets total number of combination load case(s) present in the current structure.
168+
"""
169+
return self._load.GetLoadCombinationCaseCount()
170+
171+
def GetLoadCombinationCaseNumbers(self):
172+
"""
173+
Gets all load combination case number(s).
174+
"""
175+
lc_case_count=self._load.GetLoadCombinationCaseCount()
176+
safe_list = make_safe_array_long(lc_case_count)
177+
lista = make_variant_vt_ref(safe_list, automation.VT_ARRAY | automation.VT_I4)
178+
179+
self._load.GetLoadCombinationCaseNumbers(lista)
180+
181+
return (lista[0])
182+
183+
def GetLoadListCount(self):
184+
"""
185+
Gets the number of existing load list(s)
186+
"""
187+
return self._load.GetLoadListCount()
188+
189+
def GetLoadType(self,load_No:int):
190+
"""
191+
Returns primary load case category(s) as an long value.
192+
"""
193+
return self._load.GetLoadType(load_No)
194+
195+
def GetPrimaryLoadCaseCount(self):
196+
"""
197+
Returns the total number of primary load cases present in the current structure.
198+
"""
199+
return self._load.GetPrimaryLoadCaseCount()
200+
143201
def GetReferenceLoadCaseCount(self):
144202
"""
145203
Returns the number of reference load case defined in Reference Load Definitions.
@@ -158,17 +216,7 @@ def SetReferenceLoadActive(self,load_case:int):
158216
"""
159217
return self._load.SetReferenceLoadActive(load_case)
160218

161-
def AddNodalLoad(self, nodes : list[int], fx : float, fy:float, fz:float, mx:float, my:float, mz:float):
162-
def make_safe_array_long(array):
163-
return automation._midlSAFEARRAY(ctypes.c_long).create(array)
164-
165-
safe_list = make_safe_array_long(nodes)
166-
varNodeNo = make_variant_vt_ref(safe_list, automation.VT_ARRAY | automation.VT_I4)
167-
168-
self._load.AddNodalLoad(varNodeNo,fx, fy, fz, mx, my, mz)
169-
170-
def ClearReferenceLoadCase(self,reference_load_number: int):
171-
self._load.ClearReferenceLoadCase(reference_load_number)
219+
172220

173221

174222

openstaad/output.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ def __init__(self):
99

1010
self._functions= [
1111
'GetMemberEndForces',
12+
'GetMinMaxAxialForce',
13+
'GetMinMaxBendingMoment',
14+
'GetMinMaxShearForce',
1215
'GetModalMassParticipationFactors',
1316
'GetModeFrequency',
17+
'GetNoOfModesExtracted',
1418
'GetSupportReactions'
1519
]
1620

@@ -33,6 +37,57 @@ def GetMemberEndForces(self,beam, start = True, lc :int= 1,local: int = 0):
3337

3438
return x.value[0]
3539

40+
def GetMinMaxAxialForce(self, beam:int, lc: int = 1):
41+
"""
42+
Returns maximum and minimum bending moments and their locations for specified member number, load case, and bending direction.
43+
"""
44+
ddmin = ctypes.c_double()
45+
minpos = ctypes.c_double()
46+
ddmax = ctypes.c_double()
47+
maxpos = ctypes.c_double()
48+
49+
retval = self._output.GetMinMaxAxialForce(
50+
beam, lc,
51+
ctypes.byref(ddmin), ctypes.byref(minpos),
52+
ctypes.byref(ddmax), ctypes.byref(maxpos)
53+
)
54+
55+
return ddmin.value, minpos.value, ddmax.value, maxpos.value
56+
57+
def GetMinMaxBendingMoment(self, beam:int, direction: str, lc: int = 1):
58+
"""
59+
Returns maximum and minimum bending moments and their locations for specified member number, load case, and bending direction.
60+
"""
61+
ddmin = ctypes.c_double()
62+
minpos = ctypes.c_double()
63+
ddmax = ctypes.c_double()
64+
maxpos = ctypes.c_double()
65+
66+
retval = self._output.GetMinMaxBendingMoment(
67+
beam, direction, lc,
68+
ctypes.byref(ddmin), ctypes.byref(minpos),
69+
ctypes.byref(ddmax), ctypes.byref(maxpos)
70+
)
71+
72+
return ddmin.value, minpos.value, ddmax.value, maxpos.value
73+
74+
def GetMinMaxShearForce(self, beam:int, direction: str, lc: int = 1):
75+
"""
76+
Returns maximum and minimum shear force and their locations for specified member number, load case, and force direction.
77+
"""
78+
ddmin = ctypes.c_double()
79+
minpos = ctypes.c_double()
80+
ddmax = ctypes.c_double()
81+
maxpos = ctypes.c_double()
82+
83+
retval = self._output.GetMinMaxShearForce(
84+
beam, direction, lc,
85+
ctypes.byref(ddmin), ctypes.byref(minpos),
86+
ctypes.byref(ddmax), ctypes.byref(maxpos)
87+
)
88+
89+
return ddmin.value, minpos.value, ddmax.value, maxpos.value
90+
3691
def GetModalMassParticipationFactors(self, var_mode: int):
3792
"""
3893
Get the modal mass participation factors in X, Y and Z directions for a given mode.
@@ -45,6 +100,9 @@ def GetModalMassParticipationFactors(self, var_mode: int):
45100

46101
return (round(patX.value,5), round(patY.value,5), round(patZ.value,5))
47102

103+
def GetNoOfModesExtracted(self):
104+
return self._output.GetNoOfModesExtracted()
105+
48106
def GetModeFrequency(self, var_mode:int):
49107
"""
50108
Get the natural frequency (Hz) for a given mode.

openstaad/root.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ def __init__(self):
1010

1111
self._functions = [
1212
'Analyze',
13+
'AnalizeEx',
1314
'GetAnalysisStatus',
1415
'GetApplicationVersion',
1516
'GetBaseUnit',
@@ -29,6 +30,12 @@ def __init__(self):
2930
def Analyze(self):
3031
self._root.Analyze()
3132

33+
def AnalyzeEx(self,silent:int,hidden:int,wait:int):
34+
"""
35+
This extended method analyzes the currently opened .STD file. This method is equivalent to running analysis from user interface. However, it has additional three arguments to specify whether to run the analysis in silent or hidden mode. The third parameter specifies whether the method should wait for the analysis to finish or return immediately. This method may be used in conjunction with SetSilentMode(), if one wants to suppress all dialog boxes displayed from the application during running of analysis.
36+
"""
37+
self._root.AnalyzeEx(silent,hidden,wait)
38+
3239
def GetAnalysisStatus(self):
3340
"""
3441
Get analysis status for the open STAAD Model.

0 commit comments

Comments
 (0)