FEM-Design 0.0.7__tar.gz → 0.0.8__tar.gz

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 (23) hide show
  1. {fem_design-0.0.7/src → fem_design-0.0.8}/FEM_Design.egg-info/PKG-INFO +6 -4
  2. fem_design-0.0.8/FEM_Design.egg-info/SOURCES.txt +19 -0
  3. fem_design-0.0.8/FEM_Design.egg-info/requires.txt +1 -0
  4. {fem_design-0.0.7 → fem_design-0.0.8}/PKG-INFO +6 -4
  5. {fem_design-0.0.7/src → fem_design-0.0.8}/femdesign/comunication.py +1 -1
  6. {fem_design-0.0.7 → fem_design-0.0.8}/pyproject.toml +15 -4
  7. fem_design-0.0.8/test/test_analysis.py +29 -0
  8. fem_design-0.0.8/test/test_command.py +169 -0
  9. fem_design-0.0.8/test/test_pipe.py +37 -0
  10. fem_design-0.0.7/src/FEM_Design.egg-info/SOURCES.txt +0 -16
  11. fem_design-0.0.7/src/femdesign/database.py +0 -63
  12. {fem_design-0.0.7/src → fem_design-0.0.8}/FEM_Design.egg-info/dependency_links.txt +0 -0
  13. {fem_design-0.0.7/src → fem_design-0.0.8}/FEM_Design.egg-info/top_level.txt +0 -0
  14. {fem_design-0.0.7 → fem_design-0.0.8}/LICENSE +0 -0
  15. {fem_design-0.0.7 → fem_design-0.0.8}/README.md +0 -0
  16. {fem_design-0.0.7/src → fem_design-0.0.8}/femdesign/__init__.py +0 -0
  17. {fem_design-0.0.7/src → fem_design-0.0.8}/femdesign/calculate/__init__.py +0 -0
  18. {fem_design-0.0.7/src → fem_design-0.0.8}/femdesign/calculate/analysis.py +0 -0
  19. {fem_design-0.0.7/src → fem_design-0.0.8}/femdesign/calculate/command.py +0 -0
  20. {fem_design-0.0.7/src → fem_design-0.0.8}/femdesign/calculate/fdscript.py +0 -0
  21. {fem_design-0.0.7/src → fem_design-0.0.8}/femdesign/utilities/__init__.py +0 -0
  22. {fem_design-0.0.7/src → fem_design-0.0.8}/femdesign/utilities/filehelper.py +0 -0
  23. {fem_design-0.0.7 → fem_design-0.0.8}/setup.cfg +0 -0
@@ -1,19 +1,21 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: FEM-Design
3
- Version: 0.0.7
3
+ Version: 0.0.8
4
4
  Summary: The FEM-Design API package
5
5
  Author-email: FEM-Design <femdesign.api@strusoft.com>
6
6
  Maintainer-email: Marco Pellegrino <marco.pellegrino@strusoft.com>, Illyés Zoltán <sinnach@strusoft.hu>
7
+ License: MIT
7
8
  Project-URL: Homepage, https://femdesign-api-docs.onstrusoft.com
8
9
  Project-URL: Repository, https://github.com/strusoft/femdesign-api/tree/master/FemDesign.Python
9
10
  Project-URL: Issues, https://github.com/strusoft/femdesign-api/issues
10
11
  Keywords: fem,fea,structures,strusoft,FEM-Design API
11
12
  Classifier: Programming Language :: Python :: 3
12
- Classifier: License :: OSI Approved :: MIT License
13
- Classifier: Operating System :: Microsoft
13
+ Classifier: Operating System :: Microsoft :: Windows
14
14
  Requires-Python: >=3.8
15
15
  Description-Content-Type: text/markdown
16
16
  License-File: LICENSE
17
+ Requires-Dist: pywin32>=306
18
+ Dynamic: license-file
17
19
 
18
20
 
19
21
 
@@ -0,0 +1,19 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ FEM_Design.egg-info/PKG-INFO
5
+ FEM_Design.egg-info/SOURCES.txt
6
+ FEM_Design.egg-info/dependency_links.txt
7
+ FEM_Design.egg-info/requires.txt
8
+ FEM_Design.egg-info/top_level.txt
9
+ femdesign/__init__.py
10
+ femdesign/comunication.py
11
+ femdesign/calculate/__init__.py
12
+ femdesign/calculate/analysis.py
13
+ femdesign/calculate/command.py
14
+ femdesign/calculate/fdscript.py
15
+ femdesign/utilities/__init__.py
16
+ femdesign/utilities/filehelper.py
17
+ test/test_analysis.py
18
+ test/test_command.py
19
+ test/test_pipe.py
@@ -0,0 +1 @@
1
+ pywin32>=306
@@ -1,19 +1,21 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: FEM-Design
3
- Version: 0.0.7
3
+ Version: 0.0.8
4
4
  Summary: The FEM-Design API package
5
5
  Author-email: FEM-Design <femdesign.api@strusoft.com>
6
6
  Maintainer-email: Marco Pellegrino <marco.pellegrino@strusoft.com>, Illyés Zoltán <sinnach@strusoft.hu>
7
+ License: MIT
7
8
  Project-URL: Homepage, https://femdesign-api-docs.onstrusoft.com
8
9
  Project-URL: Repository, https://github.com/strusoft/femdesign-api/tree/master/FemDesign.Python
9
10
  Project-URL: Issues, https://github.com/strusoft/femdesign-api/issues
10
11
  Keywords: fem,fea,structures,strusoft,FEM-Design API
11
12
  Classifier: Programming Language :: Python :: 3
12
- Classifier: License :: OSI Approved :: MIT License
13
- Classifier: Operating System :: Microsoft
13
+ Classifier: Operating System :: Microsoft :: Windows
14
14
  Requires-Python: >=3.8
15
15
  Description-Content-Type: text/markdown
16
16
  License-File: LICENSE
17
+ Requires-Dist: pywin32>=306
18
+ Dynamic: license-file
17
19
 
18
20
 
19
21
 
@@ -298,7 +298,7 @@ class Verbosity(Enum):
298
298
 
299
299
  class FemDesignConnection(_FdConnect):
300
300
  def __init__(self,
301
- fd_path : str = r"C:\Program Files\StruSoft\FEM-Design 23\fd3dstruct.exe",
301
+ fd_path : str = r"C:\Program Files\StruSoft\FEM-Design 24\fd3dstruct.exe",
302
302
  pipe_name : str ="FdPipe1",
303
303
  verbose : Verbosity = Verbosity.SCRIPT_LOG_LINES,
304
304
  output_dir : str = None,
@@ -1,6 +1,10 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
1
5
  [project]
2
6
  name = "FEM-Design"
3
- version = "0.0.7"
7
+ version = "0.0.8"
4
8
  authors = [
5
9
  { name="FEM-Design", email="femdesign.api@strusoft.com" },
6
10
  ]
@@ -11,14 +15,21 @@ maintainers = [
11
15
  description = "The FEM-Design API package"
12
16
  readme = "README.md"
13
17
  requires-python = ">=3.8"
18
+ dependencies = [
19
+ "pywin32>=306",
20
+ ]
14
21
  classifiers = [
15
22
  "Programming Language :: Python :: 3",
16
- "License :: OSI Approved :: MIT License",
17
- "Operating System :: Microsoft",
23
+ "Operating System :: Microsoft :: Windows",
18
24
  ]
25
+ license = {text = "MIT"}
19
26
  keywords = ["fem", "fea", "structures", "strusoft", "FEM-Design API"]
20
27
 
21
28
  [project.urls]
22
29
  Homepage = "https://femdesign-api-docs.onstrusoft.com"
23
30
  Repository = "https://github.com/strusoft/femdesign-api/tree/master/FemDesign.Python"
24
- Issues = "https://github.com/strusoft/femdesign-api/issues"
31
+ Issues = "https://github.com/strusoft/femdesign-api/issues"
32
+
33
+ [tool.setuptools.packages.find]
34
+ include = ["femdesign*"]
35
+ exclude = ["test*", "packaging*"]
@@ -0,0 +1,29 @@
1
+ from femdesign.calculate.command import *
2
+ from femdesign.calculate.analysis import Analysis, CombSettings, Design
3
+
4
+ def test_design():
5
+ xmlDesign = Design(True, True, True).to_xml_element()
6
+
7
+ assert xmlDesign.tag == "design"
8
+ assert xmlDesign.attrib == {}
9
+ assert xmlDesign.text == None
10
+
11
+ assert xmlDesign.find("autodesign") != None
12
+ assert xmlDesign.find("autodesign").text == "true"
13
+ assert xmlDesign.find("check").text == "true"
14
+ assert xmlDesign.find("gmax") == None
15
+ assert xmlDesign.find("cmax") != None
16
+
17
+
18
+ xmlDesign = Design(False, False, False).to_xml_element()
19
+
20
+ assert xmlDesign.tag == "design"
21
+ assert xmlDesign.attrib == {}
22
+ assert xmlDesign.text == None
23
+
24
+ assert xmlDesign.find("autodesign") != None
25
+ assert xmlDesign.find("autodesign").text == "false"
26
+ assert xmlDesign.find("check").text == "false"
27
+
28
+ assert xmlDesign.find("gmax") != None
29
+ assert xmlDesign.find("cmax") == None
@@ -0,0 +1,169 @@
1
+ from femdesign.calculate.command import *
2
+ from femdesign.calculate.analysis import Analysis, CombSettings
3
+
4
+ def test_cmd_open():
5
+ file_path = "myFilePath.str"
6
+ xmlCmdOpen = CmdOpen(file_path).to_xml_element()
7
+
8
+ assert xmlCmdOpen.tag == "cmdopen"
9
+ assert xmlCmdOpen.attrib.get("command") == "; CXL CS2SHELL OPEN"
10
+
11
+ filename = xmlCmdOpen.find("filename")
12
+ assert filename.text == os.path.join( os.getcwd(), file_path )
13
+
14
+ def test_cmd_child():
15
+ file_path = "template.dsc"
16
+ xmlCmdChild = CmdChild("template.dsc").to_xml_element()
17
+
18
+ assert xmlCmdChild.tag == "cmdchild"
19
+ assert xmlCmdChild.text == os.path.join( os.getcwd(), file_path)
20
+
21
+ try:
22
+ xmlCmdChild = CmdChild("template.3dm").to_xml_element()
23
+ except Exception as e:
24
+ assert isinstance(e, ValueError)
25
+ assert str(e) == "file_name must have suffix .dsc"
26
+
27
+ def test_cmd_save():
28
+ file_path = "myFilePath.str"
29
+ xmlCmdSave = CmdSave(file_path).to_xml_element()
30
+
31
+ assert xmlCmdSave.tag == "cmdsave"
32
+ assert xmlCmdSave.attrib.get("command") == "; CXL CS2SHELL SAVE"
33
+
34
+ filename = xmlCmdSave.find("filename")
35
+ assert filename.text == os.path.join( os.getcwd(), file_path )
36
+
37
+ def test_cmd_user():
38
+ for user in User:
39
+ xmlCmdUser = CmdUser(user).to_xml_element()
40
+
41
+ assert xmlCmdUser.attrib.get("command") == f"; CXL $MODULE {user.name}"
42
+ assert xmlCmdUser.tag == "cmduser"
43
+
44
+ def test_cmd_end_session():
45
+ xmlCmdEndSession = CmdEndSession().to_xml_element()
46
+
47
+ assert xmlCmdEndSession.tag == "cmdendsession"
48
+ assert xmlCmdEndSession.text == None
49
+ assert xmlCmdEndSession.attrib == {}
50
+
51
+ def test_analysis():
52
+ xmlAnalysis = Analysis.StaticAnalysis().to_xml_element()
53
+
54
+ assert xmlAnalysis.tag == "analysis"
55
+
56
+ assert xmlAnalysis.attrib.get("calcCase") == "1"
57
+ assert xmlAnalysis.attrib.get("calcComb") == "1"
58
+ assert xmlAnalysis.find("Comb") is None
59
+ assert xmlAnalysis.attrib.get("calcStab") == "0"
60
+
61
+ xmlAnalysis = Analysis.StaticAnalysis(True, True).to_xml_element()
62
+ assert xmlAnalysis.attrib.get("calcCase") == "1"
63
+ assert xmlAnalysis.attrib.get("calcComb") == "1"
64
+ assert xmlAnalysis.find("comb") is None
65
+
66
+ xmlAnalysis = Analysis.StaticAnalysis(True, False).to_xml_element()
67
+ assert xmlAnalysis.attrib.get("calcCase") == "1"
68
+ assert xmlAnalysis.attrib.get("calcComb") == "0"
69
+ assert xmlAnalysis.find("comb") is None
70
+
71
+ xmlAnalysis = Analysis.FrequencyAnalysis().to_xml_element()
72
+ assert xmlAnalysis.attrib.get("calcFreq") == "1"
73
+ assert xmlAnalysis.find("comb") is None
74
+ assert xmlAnalysis.find("freq") is not None
75
+
76
+ def test_cmd_proj_descr():
77
+ xmlCmdProjDescr = CmdProjDescr("Test project", "Test project description", "Test designer", "Test signature", "Comment", None).to_xml_element()
78
+
79
+ xmlCmdProjDescr.tag == "cmdprojdescr"
80
+
81
+ assert xmlCmdProjDescr.attrib.get("szProject") == "Test project"
82
+ assert xmlCmdProjDescr.attrib.get("szDescription") == "Test project description"
83
+ assert xmlCmdProjDescr.attrib.get("szDesigner") == "Test designer"
84
+ assert xmlCmdProjDescr.attrib.get("szSignature") == "Test signature"
85
+ assert xmlCmdProjDescr.attrib.get("szComment") == "Comment"
86
+
87
+ assert xmlCmdProjDescr.attrib.get("read") == "0"
88
+ assert xmlCmdProjDescr.attrib.get("reset") == "0"
89
+
90
+ assert xmlCmdProjDescr.find("item") is None
91
+
92
+ items = {"a": "a_txt", "b": "b_txt"}
93
+ xmlCmdProjDescr = CmdProjDescr(None, None, None, None, None, items, 0, 0).to_xml_element()
94
+
95
+ xmlCmdProjDescr.tag == "cmdprojdescr"
96
+
97
+ assert xmlCmdProjDescr.attrib.get("szProject") == None
98
+ assert xmlCmdProjDescr.attrib.get("szDescription") == None
99
+ assert xmlCmdProjDescr.attrib.get("szDesigner") == None
100
+ assert xmlCmdProjDescr.attrib.get("szSignature") == None
101
+ assert xmlCmdProjDescr.attrib.get("szComment") == None
102
+
103
+ assert xmlCmdProjDescr.attrib.get("read") == "0"
104
+ assert xmlCmdProjDescr.attrib.get("reset") == "0"
105
+
106
+ assert xmlCmdProjDescr.find("item") is not None
107
+ assert len( xmlCmdProjDescr.findall("item") ) == 2
108
+
109
+ def test_cmd_listgen():
110
+ xmlCmdListGen = CmdListGen("bscfile.bsc", "outfile.csv", None, True, True, True).to_xml_element()
111
+
112
+ assert xmlCmdListGen.tag == "cmdlistgen"
113
+ assert xmlCmdListGen.attrib.get("bscfile") == os.path.join( os.getcwd(), "bscfile.bsc" )
114
+ assert xmlCmdListGen.attrib.get("outfile") == os.path.join( os.getcwd(), "outfile.csv" )
115
+ assert xmlCmdListGen.attrib.get("regional") == "1"
116
+ assert xmlCmdListGen.attrib.get("fillcells") == "1"
117
+ assert xmlCmdListGen.attrib.get("headers") == "1"
118
+ assert xmlCmdListGen.find("GUID") is None
119
+ assert len( xmlCmdListGen.findall("GUID") ) == 0
120
+
121
+
122
+ guids = [uuid.uuid4(), uuid.uuid4()]
123
+ xmlCmdListGen = CmdListGen("result.bsc", "outfile.csv", guids, False, False, False).to_xml_element()
124
+
125
+ assert xmlCmdListGen.tag == "cmdlistgen"
126
+ assert xmlCmdListGen.attrib.get("bscfile") == os.path.join( os.getcwd(), "result.bsc" )
127
+ assert xmlCmdListGen.attrib.get("outfile") == os.path.join( os.getcwd(), "outfile.csv" )
128
+ assert xmlCmdListGen.attrib.get("regional") == "0"
129
+ assert xmlCmdListGen.attrib.get("fillcells") == "0"
130
+ assert xmlCmdListGen.attrib.get("headers") == "0"
131
+ assert xmlCmdListGen.find("GUID") is not None
132
+ assert len( xmlCmdListGen.findall("GUID") ) == 2
133
+
134
+ xmlCmdListGen = CmdListGen("result.bsc").to_xml_element()
135
+
136
+ assert xmlCmdListGen.tag == "cmdlistgen"
137
+ assert xmlCmdListGen.attrib.get("bscfile") == os.path.join( os.getcwd(), "result.bsc" )
138
+ assert xmlCmdListGen.attrib.get("outfile") == os.path.join( os.getcwd(), "result.csv" )
139
+ assert xmlCmdListGen.attrib.get("regional") == "1"
140
+ assert xmlCmdListGen.attrib.get("fillcells") == "1"
141
+ assert xmlCmdListGen.attrib.get("headers") == "1"
142
+ assert xmlCmdListGen.find("GUID") is None
143
+ assert len( xmlCmdListGen.findall("GUID") ) == 0
144
+
145
+ def test_cmd_config():
146
+ file_path = "config.xml"
147
+ xmlCmdConfig = CmdConfig(file_path).to_xml_element()
148
+
149
+ assert xmlCmdConfig.tag == "cmdconfig"
150
+ assert xmlCmdConfig.attrib.get("file") == os.path.join( os.getcwd(), file_path )
151
+
152
+ def test_cmd_interaction_surface():
153
+ guid = uuid.uuid4()
154
+
155
+ xmlCmdInteractionSurface = CmdInteractionSurface(guid, "surface.txt", 0.0, False).to_xml_element()
156
+
157
+ assert xmlCmdInteractionSurface.tag == "cmdinteractionsurface"
158
+ assert xmlCmdInteractionSurface.attrib.get("guid") == str(guid)
159
+ assert xmlCmdInteractionSurface.attrib.get("outfile") == os.path.join( os.getcwd(), "surface.txt" )
160
+ assert xmlCmdInteractionSurface.attrib.get("offset") == "0.0"
161
+ assert xmlCmdInteractionSurface.attrib.get("fUlt") == "false"
162
+
163
+ xmlCmdInteractionSurface = CmdInteractionSurface(guid, "surface.txt", 5.2, True).to_xml_element()
164
+
165
+ assert xmlCmdInteractionSurface.tag == "cmdinteractionsurface"
166
+ assert xmlCmdInteractionSurface.attrib.get("guid") == str(guid)
167
+ assert xmlCmdInteractionSurface.attrib.get("outfile") == os.path.join( os.getcwd(), "surface.txt" )
168
+ assert xmlCmdInteractionSurface.attrib.get("offset") == "5.2"
169
+ assert xmlCmdInteractionSurface.attrib.get("fUlt") == "true"
@@ -0,0 +1,37 @@
1
+ from femdesign.calculate.command import *
2
+ from femdesign.calculate.analysis import Analysis, CombSettings, Design
3
+ from femdesign.comunication import FemDesignConnection
4
+ import pytest
5
+
6
+ def test_pipe():
7
+ connection = FemDesignConnection(output_dir="test", minimized=True)
8
+ assert connection.output_dir == os.path.join( os.getcwd(), "test" )
9
+
10
+ connection._output_dir = None
11
+ assert connection.output_dir == os.path.join( os.getcwd(), "FEM-Design API" )
12
+
13
+ ## assert that connection.open() raises an error
14
+ try:
15
+ connection.Open("myModel.str")
16
+ except Exception as e:
17
+ assert isinstance(e, FileNotFoundError)
18
+ assert str(e) == "File myModel.str not found"
19
+
20
+ try:
21
+ connection.Open("myModel.3dm")
22
+ except Exception as e:
23
+ assert isinstance(e, ValueError)
24
+ assert str(e) == "file_name must have extension .struxml or .str"
25
+
26
+ connection.__exit__()
27
+
28
+ def test_interaction_surface():
29
+ connection = FemDesignConnection(minimized=True)
30
+ connection.Open(r"test/assets/concrete_beam.struxml")
31
+ guid = "c71d1619-420a-46fe-bbb7-423bf20fdcda"
32
+ connection.GenerateInteractionSurface(guid, "test/assets/interaction_surface.txt", 0.5, True)
33
+
34
+ assert os.path.exists("test/assets/interaction_surface.txt")
35
+ assert os.path.getsize("test/assets/interaction_surface.txt") > 0
36
+
37
+ os.remove("test/assets/interaction_surface.txt")
@@ -1,16 +0,0 @@
1
- LICENSE
2
- README.md
3
- pyproject.toml
4
- src/FEM_Design.egg-info/PKG-INFO
5
- src/FEM_Design.egg-info/SOURCES.txt
6
- src/FEM_Design.egg-info/dependency_links.txt
7
- src/FEM_Design.egg-info/top_level.txt
8
- src/femdesign/__init__.py
9
- src/femdesign/comunication.py
10
- src/femdesign/database.py
11
- src/femdesign/calculate/__init__.py
12
- src/femdesign/calculate/analysis.py
13
- src/femdesign/calculate/command.py
14
- src/femdesign/calculate/fdscript.py
15
- src/femdesign/utilities/__init__.py
16
- src/femdesign/utilities/filehelper.py
@@ -1,63 +0,0 @@
1
- import xml.etree.ElementTree as ET
2
- import uuid
3
- import datetime
4
-
5
- namespace = {'': 'urn:strusoft'}
6
-
7
- class Database:
8
- def __init__(self, country):
9
- self.struxml_version = "01.00.000"
10
- self.source_software = f"FEM-Design API SDK {self.get_version()}"
11
- self.start_time = "1970-01-01T00:00:00.000"
12
- self.end_time = datetime.datetime.now(datetime.UTC).strftime("%Y-%m-%dT%H:%M:%S.%f")[:-3]
13
- self.guid = str(uuid.uuid4())
14
- self.convert_id = "00000000-0000-0000-0000-000000000000"
15
- self.standard = "EC"
16
- self.country = country
17
- self.end = ""
18
-
19
- def get_version(self):
20
- return "0.1.0"
21
-
22
- @property
23
- def eurocode(self):
24
- return self._root.attrib["standard"]
25
-
26
- @property
27
- def country(self):
28
- return self._root.attrib["country"]
29
-
30
- @property
31
- def source_software(self):
32
- return self._root.attrib["source_software"]
33
-
34
- @property
35
- def entities(self):
36
- return self._root.findall(".//entities", namespace)
37
-
38
- @property
39
- def sections(self):
40
- return self._root.findall(".//sections", namespace)
41
-
42
- @property
43
- def materials(self):
44
- return self._root.findall(".//materials", namespace)
45
-
46
- @property
47
- def bars(self):
48
- return self._root.findall(".//bar", namespace)
49
-
50
- def serialise_to_xml(self):
51
- return ET.tostring(self._root, encoding="UTF-8")
52
-
53
- # private void Initialize(Country country)
54
- # {
55
- # this.StruxmlVersion = "01.00.000";
56
- # this.SourceSoftware = $"FEM-Design API SDK {Assembly.GetExecutingAssembly().GetName().Version.ToString()}";
57
- # this.StartTime = "1970-01-01T00:00:00.000";
58
- # this.EndTime = System.DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.fff", CultureInfo.InvariantCulture);
59
- # this.Guid = System.Guid.NewGuid();
60
- # this.ConvertId = "00000000-0000-0000-0000-000000000000";
61
- # this.Standard = "EC";
62
- # this.Country = country;
63
- # this.End = "";
File without changes
File without changes
File without changes