-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRCsection_strength.py
More file actions
78 lines (74 loc) · 3.37 KB
/
Copy pathRCsection_strength.py
File metadata and controls
78 lines (74 loc) · 3.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# coding=windows-1252
import clr; import os; import time; import math
import ctypes; # for dialog boxes
from winreg import * # for registry access
addr = r"SOFTWARE\Classes\NextFEM Designer\shell\open\command"
aReg = ConnectRegistry(None, HKEY_LOCAL_MACHINE)
aKey = OpenKey(aReg, addr); vkey = QueryValueEx(aKey,None)
dir=os.path.split(vkey[0].replace('"','').replace("%1","").strip())[0]
# support for cleaning screen: call clear()
clear = lambda: os.system('cls')
def msgbox(title, text, style):
return ctypes.windll.user32.MessageBoxW(0, text, title, style)
# instance of NextFEM API
clr.AddReference(dir + "\\NextFEMapi.dll")
import NextFEMapi
from System.Collections.Generic import Dictionary
from System import String
nf=NextFEMapi.API()
# wait for licenses to load
while nf.loading:
print("Loading...")
time.sleep(1)
# path for saving models - be sure the folder already exists
savedir = r"C:\NextFEM models" + "\\"
def model43():
"""moment-curvature of RC section
"""
global nf
from operator import length_hint
nf.newModel()
nf.modelName="model43"
# set units
nf.setUnits("m","kN")
# get sections and material
se=nf.addRectSection(0.3,0.5)
matID = nf.addMatFromLib("C25/30")
nf.setSectionMaterial(se,matID); nf.renameSection(se,"RCsect","EN")
# add rebar (longitudinal)
desMat=nf.addDesignMatFromLib("B450C")
diam = 14; areaB=nf.convertValue(math.pi*pow(diam,2) / 4,"mm^2","m^2")
cover=0.04; rebN=6
# pattern: Top=0, Bottom=1, Equal spacing=2, Wall=3, Lateral=4, Left=5, Right=6
nf.addRebarPatternInSection(2,se,rebN,cover,desMat,areaB)
# add stirrups/hoops
spacing=0.2; # m
nf.addStirrupBarsInSection(se,2,2,areaB,spacing,desMat)
# image
nf.saveSectionImage(se,savedir + "RCsect")
# set axial force N and a sign of moment in section for strength calculation (+ tension, - compression)
N=-90; Mzz=1; Myy=0
# from here on, Concrete module license is required ------------------------------------------------------------
# to save image of neutral axis, use: https://www.nextfem.it/api/html/M_NextFEMapi_API_getSectionResMoments3.htm
# 0 plastic, 1 elastic, 2 thermal-plastic, 3 thermal-elastic, 4 elastic limit, 5 thermal-elastic limit
res=nf.getSectionResMoments3(se,0,N,Mzz,Myy,savedir + "RCsect_ultimate",0)
print("Calculate strength in ultimate conditions --------------------------------------")
for i in range(0,length_hint(res.checkNames)):
print(res.checkNames[i] + " = " + str(res.values[i]))
# Optional. Domain type for image: 0 for Myy_Mzz, 1 for N_Myy, 2 for N_Mzz
res1=nf.getSectionResMoments3(se,4,N,Mzz,Myy,savedir + "RCsect_yielding",0)
print("Calculate strength in yielding conditions --------------------------------------")
for i in range(0,length_hint(res1.checkNames)):
print(res1.checkNames[i] + " = " + str(res1.values[i]))
# get domain points
plotNMz=nf.getSectionResDomainPoints(0,2)
x=[]; y=[];
for i in range(0,len(plotNMz)):
x.append(plotNMz[i][0]); y.append(plotNMz[i][1])
print("Plot: " + str(nf.getDataPlot(x,y,savedir + nf.modelName + "_N-Mzz.png")))
# get shear resistance
res2=nf.getSectionResShear(se)
print("VrdY=" + str(res2[0]) + " - VrdZ=" + str(res2[1]))
nf.saveModel(savedir + nf.modelName + ".nxs"); # save in NextFEM Section Analyzer format
model43()
input("Press key to close...")