nextfempy 0.3.5__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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 NextFEM
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,111 @@
1
+ Metadata-Version: 2.4
2
+ Name: nextfempy
3
+ Version: 0.3.5
4
+ Summary: NextFEM REST API wrapper in pure Python
5
+ Home-page: https://github.com/NextFEM/NextFEMpy
6
+ Author: NextFEM
7
+ Author-email: info@nextfem.it
8
+ License: MIT
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: requests
14
+ Dynamic: author
15
+ Dynamic: author-email
16
+ Dynamic: classifier
17
+ Dynamic: description
18
+ Dynamic: description-content-type
19
+ Dynamic: home-page
20
+ Dynamic: license
21
+ Dynamic: license-file
22
+ Dynamic: requires-dist
23
+ Dynamic: summary
24
+
25
+ # NextFEMpy
26
+
27
+ NextFEM REST API wrapper in pure Python, to be used with NextFEM Designer or NextFEM Server.
28
+ It is a complete set of REST API call, wrapped in Python functions, distinguishing between mandatory and optional arguments.
29
+
30
+ If you're looking for NextFEMpy source, look into /nextfempy folder.
31
+ If you're looking for sample code using nextfempy, look into /samples folder.
32
+
33
+ ## Installation instructions
34
+ ```
35
+ pip install nextfempy
36
+ ```
37
+
38
+ ## Upgrading instructions
39
+ ```
40
+ pip install nextfempy --upgrade
41
+ ```
42
+
43
+ ## Usage
44
+
45
+ Before using with your local installation of NextFEM Designer, start the plugin REST API Server.
46
+
47
+ ```
48
+ from nextfempy import NextFEMrest
49
+ # connect to local copy of NextFEM Designer
50
+ nf=NextFEMapiREST.NextFEMrest()
51
+ ```
52
+
53
+ To handle a property:
54
+ ```
55
+ nf.autoMassInX=False
56
+ print(str(nf.autoMassInX))
57
+ ```
58
+
59
+ To call a NextFEM API method:
60
+
61
+ ```
62
+ nf.addOrModifyCustomData("test","Test")
63
+ print(nf.getCustomData("test"))
64
+ ```
65
+
66
+ ## Sample code
67
+
68
+ A simple 3D frame using REST API. Remember to start the plugin REST API Server in NextFEM Designer.
69
+ ```
70
+ import os
71
+ from nextfempy import NextFEMrest
72
+
73
+ # current dir, to be used eventually to save model
74
+ dir = os.path.dirname(os.path.realpath(__file__))
75
+ # connects to the open instance of NextFEM Designer with REST API server plugin running on your machine
76
+ nf=NextFEMrest()
77
+
78
+ # clear model
79
+ nf.newModel()
80
+ # material and section
81
+ mat=nf.addMatFromLib("C25/30"); print("Mat="+str(mat))
82
+ cSect=nf.addCircSection(0.2)
83
+ bSect=nf.addRectSection(0.2,0.2)
84
+ # nodes
85
+ n1=nf.addNode(0,0,0); n2=nf.addNode(0,0,3)
86
+ n3=nf.addNode(3,0,0); n4=nf.addNode(3,0,3)
87
+ n5=nf.addNode(0,3,0); n6=nf.addNode(0,3,3)
88
+ n7=nf.addNode(3,3,0); n8=nf.addNode(3,3,3)
89
+ # beams
90
+ b1=nf.addBeam(n1,n2,cSect,mat); b2=nf.addBeam(n3,n4,cSect,mat)
91
+ b3=nf.addBeam(n2,n4,bSect,mat)
92
+ b4=nf.addBeam(n5,n6,cSect,mat); b5=nf.addBeam(n7,n8,cSect,mat)
93
+ b6=nf.addBeam(n6,n8,bSect,mat)
94
+ b7=nf.addBeam(n2,n6,bSect,mat); b8=nf.addBeam(n4,n8,bSect,mat)
95
+ # restraints
96
+ nf.setBC(n1,True,True,True,True,True,True)
97
+ nf.setBC(n3,True,True,True,True,True,True)
98
+ nf.setBC(n5,True,True,True,True,True,True)
99
+ nf.setBC(n7,True,True,True,True,True,True)
100
+ # loading
101
+ nf.addLoadCase("sw"); nf.setSelfWeight("sw")
102
+ nf.addLoadCase("perm"); nf.addLoadCase("var")
103
+ # floorload type
104
+ print(nf.setFloorLoad("floor1","perm",-2.5,0,0,1)); print(nf.setFloorLoad("floor1","var",-3,0,0,1))
105
+ # floor plane on beams - nodes 2,4,8,6
106
+ print("Apply loading plane: " + str(nf.addFloorPlane("floor1",2,n2,n4,n8,n6)))
107
+
108
+ # analysis: run all loadcases and print outcome
109
+ print(nf.RunModel())
110
+ nf.refreshDesignerView(0,True)
111
+ ```
@@ -0,0 +1,87 @@
1
+ # NextFEMpy
2
+
3
+ NextFEM REST API wrapper in pure Python, to be used with NextFEM Designer or NextFEM Server.
4
+ It is a complete set of REST API call, wrapped in Python functions, distinguishing between mandatory and optional arguments.
5
+
6
+ If you're looking for NextFEMpy source, look into /nextfempy folder.
7
+ If you're looking for sample code using nextfempy, look into /samples folder.
8
+
9
+ ## Installation instructions
10
+ ```
11
+ pip install nextfempy
12
+ ```
13
+
14
+ ## Upgrading instructions
15
+ ```
16
+ pip install nextfempy --upgrade
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ Before using with your local installation of NextFEM Designer, start the plugin REST API Server.
22
+
23
+ ```
24
+ from nextfempy import NextFEMrest
25
+ # connect to local copy of NextFEM Designer
26
+ nf=NextFEMapiREST.NextFEMrest()
27
+ ```
28
+
29
+ To handle a property:
30
+ ```
31
+ nf.autoMassInX=False
32
+ print(str(nf.autoMassInX))
33
+ ```
34
+
35
+ To call a NextFEM API method:
36
+
37
+ ```
38
+ nf.addOrModifyCustomData("test","Test")
39
+ print(nf.getCustomData("test"))
40
+ ```
41
+
42
+ ## Sample code
43
+
44
+ A simple 3D frame using REST API. Remember to start the plugin REST API Server in NextFEM Designer.
45
+ ```
46
+ import os
47
+ from nextfempy import NextFEMrest
48
+
49
+ # current dir, to be used eventually to save model
50
+ dir = os.path.dirname(os.path.realpath(__file__))
51
+ # connects to the open instance of NextFEM Designer with REST API server plugin running on your machine
52
+ nf=NextFEMrest()
53
+
54
+ # clear model
55
+ nf.newModel()
56
+ # material and section
57
+ mat=nf.addMatFromLib("C25/30"); print("Mat="+str(mat))
58
+ cSect=nf.addCircSection(0.2)
59
+ bSect=nf.addRectSection(0.2,0.2)
60
+ # nodes
61
+ n1=nf.addNode(0,0,0); n2=nf.addNode(0,0,3)
62
+ n3=nf.addNode(3,0,0); n4=nf.addNode(3,0,3)
63
+ n5=nf.addNode(0,3,0); n6=nf.addNode(0,3,3)
64
+ n7=nf.addNode(3,3,0); n8=nf.addNode(3,3,3)
65
+ # beams
66
+ b1=nf.addBeam(n1,n2,cSect,mat); b2=nf.addBeam(n3,n4,cSect,mat)
67
+ b3=nf.addBeam(n2,n4,bSect,mat)
68
+ b4=nf.addBeam(n5,n6,cSect,mat); b5=nf.addBeam(n7,n8,cSect,mat)
69
+ b6=nf.addBeam(n6,n8,bSect,mat)
70
+ b7=nf.addBeam(n2,n6,bSect,mat); b8=nf.addBeam(n4,n8,bSect,mat)
71
+ # restraints
72
+ nf.setBC(n1,True,True,True,True,True,True)
73
+ nf.setBC(n3,True,True,True,True,True,True)
74
+ nf.setBC(n5,True,True,True,True,True,True)
75
+ nf.setBC(n7,True,True,True,True,True,True)
76
+ # loading
77
+ nf.addLoadCase("sw"); nf.setSelfWeight("sw")
78
+ nf.addLoadCase("perm"); nf.addLoadCase("var")
79
+ # floorload type
80
+ print(nf.setFloorLoad("floor1","perm",-2.5,0,0,1)); print(nf.setFloorLoad("floor1","var",-3,0,0,1))
81
+ # floor plane on beams - nodes 2,4,8,6
82
+ print("Apply loading plane: " + str(nf.addFloorPlane("floor1",2,n2,n4,n8,n6)))
83
+
84
+ # analysis: run all loadcases and print outcome
85
+ print(nf.RunModel())
86
+ nf.refreshDesignerView(0,True)
87
+ ```
@@ -0,0 +1 @@
1
+ from .nextfempy import *