Hide last authors
IwonaBudny 20.1 1 (% class="box floatinginfobox" %)
2 (((
Isak Björhag 50.1 3 [[FEM-Design API examples on GitHub>>https://github.com/strusoft/femdesign-api-example]]
4
Isak Björhag 76.1 5 [[API-wrapper as zip>>attach:fdAPI_wrapper_beta_v1.02.zip]]
Isak Björhag 43.1 6
IwonaBudny 18.1 7
Iwona Budny Bjergø 61.1 8 Contents
Isak Björhag 24.1 9
Isak Björhag 63.1 10 (% contenteditable="false" tabindex="-1" %)
Isak Björhag 40.1 11 (((
Isak Björhag 41.1 12 {{toc depth="4"/}}
IwonaBudny 21.1 13 )))
Isak Björhag 40.1 14 )))
IwonaBudny 18.1 15
Isak Björhag 49.1 16 An API wrapper is a file containing different call functions to make it easier to create the model and run the analysis. The wrapper below is created for python. Please see a detailed description in the documentation below.
Isak Björhag 7.2 17
Isak Björhag 48.1 18
Isak Björhag 63.1 19 (% class="box warningmessage" style="text-align: justify;" %)
Isak Björhag 47.1 20 (((
Iwona Budny Bjergø 60.1 21 Note: This is just an example of a wrapper. You are of course able to create a wrapper file yourself or make changes in the wrapper to fit your project or situation with regard to input values and different call functions. For further information about this, please visit the section [[__**Customize the wrapper.**__>>doc:||anchor="Customize_wrapper"]]
Isak Björhag 47.1 22 )))
Iwona Budny Bjergø 42.1 23
Isak Björhag 16.1 24 The following information is valid for python. However, it is possible to construct a similar wrapper for other programming languages.
25
Iwona Budny Bjergø 42.1 26
Isak Björhag 41.1 27 {{video ratio="16:9" url="https://youtu.be/tC5mxDIf7aE"/}}
28
Isak Björhag 63.1 29 (% contenteditable="false" tabindex="-1" %)
Isak Björhag 40.1 30 (((
Isak Björhag 41.1 31
Isak Björhag 40.1 32 )))
33
Isak Björhag 73.1 34 = Getting started =
Isak Björhag 12.1 35
36
Isak Björhag 59.1 37 First, download the wrapper and put the files into a folder. Please ensure that there are no special signs in the path to the folder. To get started, please check that the paths found inside the wrapper are correct for the (% class="mark" %)"Database dir"(%%) and (% class="mark" %)"Installation dir"(%%).
Iwona Budny Bjergø 42.1 38
39
Isak Björhag 76.1 40 |=(% style="background-color: rgb(29, 89, 152); width: 261px;" %)(% style="color:#ffffff" %)Download|=(% style="width: 1216px;" %)[[(% class="wikiattachmentlink wikiattachmentlink" %)**⭳ API-wrapper (zip)**>>attach:fdAPI_wrapper_beta_v1.02.zip]]
Iwona Budny Bjergø 42.1 41
Isak Björhag 63.1 42 (% contenteditable="false" tabindex="-1" %)[[image:1556029928168-186.png||data-widget="image" height="114" width="503"]]
Isak Björhag 12.1 43
Iwona Budny Bjergø 42.1 44
Isak Björhag 14.1 45 Now you are ready to open a new python file in the same folder as the wrapper. Import the wrapper with the import function:
46
Iwona Budny Bjergø 42.1 47
Isak Björhag 14.1 48 (% class="box infomessage" %)
49 (((
50 ##Import fdAPI_wrapper as fd##
51 )))
52
53 You can use a shortcut name to access the imported library of functions. In this example we use "fd". All functions and classes are now accessible by writing fd.<function>. For example fd.initiateModel('S').
54
Isak Björhag 74.1 55 = Documentation =
Isak Björhag 7.2 56
Isak Björhag 74.1 57 == Classes ==
58
Isak Björhag 59.1 59 === {{id name="coord"/}}coord ===
Isak Björhag 7.2 60
61 (% class="box infomessage" %)
62 (((
63 (% style="background-color:null" %)##class coord:##(%%)
Isak Björhag 7.3 64 (% style="background-color:null" %)## def ~_~__init~_~__(self, x=0, y=0, z=0):##(%%)
Isak Björhag 8.1 65 (% style="background-color:null" %)## self.x = x##(%%)
66 (% style="background-color:null" %)## self.y = y##(%%)
67 (% style="background-color:null" %)## self.z = z##
Isak Björhag 7.2 68 )))
69
70 This class is used to define coordinates.
Isak Björhag 59.1 71 ##coord.x - x
72 coord.y - y
73 coord.z - z##
Isak Björhag 7.2 74
Isak Björhag 8.1 75
IwonaBudny 18.1 76 === XML ===
Isak Björhag 7.2 77
Isak Björhag 8.1 78 (% class="box infomessage" %)
79 (((
80 ##class XML:
81 def ~_~__init~_~__(self, filename = '', batch = '', export = ''):
82 self.filename = filename
83 self.batch = batch
84 self.export = export##
85 )))
86
Isak Björhag 59.1 87 This class is used to define the different file paths and names for the model file, batch export and csv output. The base folder is the place of the wrapper.
Isak Björhag 8.1 88
Isak Björhag 59.1 89 ##XML.filename## - path and filename of model file
90 ##XML.batch ##- path and filename of the batch export file
91 ##XML.export## - path and filename of the csv output from batch file
Isak Björhag 8.1 92
93
Isak Björhag 59.1 94 === {{id name="material"/}}material ===
Isak Björhag 8.1 95
96 (% class="box infomessage" %)
97 (((
98 ##class material:
99 def ~_~__init~_~__(self, type = '', creep = '', shrinkage = ''):
100 self.type = type
101 self.creep = creep
102 self.shrinkage = shrinkage##
103 )))
104
105 This class is used to define material parameters. It is used as input parameter when creating a material in the XML model file.
106
Isak Björhag 59.1 107 ##material.type## - material name as string
Isak Björhag 8.1 108
109 |**Concrete**|(% style="font-size:10px" %)C12/15|(% style="font-size:10px" %)C16/20|(% style="font-size:10px" %)C20/25|(% style="font-size:10px" %)C25/30|(% style="font-size:10px" %)C28/35|(% style="font-size:10px" %)C30/37|(% style="font-size:10px" %)C32/40|(% style="font-size:10px" %)C35/45|(% style="font-size:10px" %)C40/50|(% style="font-size:10px" %)C45/55|(% style="font-size:10px" %)C50/60|(% style="font-size:10px" %)C54/65|(% style="font-size:10px" %)C55/67|(% style="font-size:10px" %)C58/70|(% style="font-size:10px" %)C60/75|(% style="font-size:10px" %)C70/85|(% style="font-size:10px" %)C80/95|(% style="font-size:10px" %)C90/105
Isak Björhag 29.1 110 |**Steel**|(% style="font-size:10px" %)S235|(% style="font-size:10px" %)S275|(% style="font-size:10px" %)S355|(% style="font-size:10px" %)S420|(% style="font-size:10px" %)S450|(% style="font-size:10px" %)S460
111 |**Timber**|(% style="font-size:10px" %)C14|(% style="font-size:10px" %)C16|(% style="font-size:10px" %)C18|(% style="font-size:10px" %)C20|(% style="font-size:10px" %)C22|(% style="font-size:10px" %)C24|(% style="font-size:10px" %)C27|(% style="font-size:10px" %)C30|(% style="font-size:10px" %)C35|(% style="font-size:10px" %)C40|(% style="font-size:10px" %)C45|(% style="font-size:10px" %)C50|(% style="font-size:10px" %)D18|(% style="font-size:10px" %)D24|(% style="font-size:10px" %)D30|(% style="font-size:10px" %)D35|(% style="font-size:10px" %)D40|(% style="font-size:10px" %)D50
112 | |(% style="font-size:10px" %)D60|(% style="font-size:10px" %)D70|(% style="font-size:10px" %)L40s|(% style="font-size:10px" %)L40c|(% style="font-size:10px" %)GL 20h|(% style="font-size:10px" %)GL 22h|(% style="font-size:10px" %)GL 24h|(% style="font-size:10px" %)GL 26h|(% style="font-size:10px" %)GL 28h|(% style="font-size:10px" %)GL 30h|(% style="font-size:10px" %)GL 32h|(% style="font-size:10px" %)GL 36h|(% style="font-size:10px" %)GL 20c|(% style="font-size:10px" %)GL 22c|(% style="font-size:10px" %)GL 24c|(% style="font-size:10px" %)GL 26c|(% style="font-size:10px" %)GL 28c|(% style="font-size:10px" %)GL 30c
113 | |(% style="font-size:10px" %)GL 32c|(% style="font-size:10px" %)GL 36c| | | | | | | | | | | | | | | |
Isak Björhag 8.1 114
Isak Björhag 29.1 115 Service class 1 is assumed for all timber materials.
116
Isak Björhag 59.1 117 ##material.creep## - creep for concrete
118 ##material. shrinkage## - shrinkage for concrete
Isak Björhag 8.1 119
120
121 == Functions ==
122
IwonaBudny 18.1 123 === initiateModel ===
Isak Björhag 8.1 124
125 (% class="box infomessage" %)
126 (((
127 ##initiateModel(annex)##
128 )))
129
130 Use this function to initiate the base template for the XML model file. This needs to be done first before adding elements to the XML file.
131
132 ##annex ##- The selected annex for the model as a string
133
Isak Björhag 9.1 134 (% style="width:390px" %)
135 |(% style="width:128px" %)'GB' - Brittish|(% style="width:134px" %)'DK' - Danish|(% style="width:125px" %)'FIN' - Finnish
136 |(% style="width:128px" %)'D' - German|(% style="width:134px" %)'H' - Hungarian|(% style="width:125px" %)(((
Isak Björhag 8.1 137 'N' - Norwegian
138 )))
Isak Björhag 9.1 139 |(% style="width:128px" %)'PL' - Polish|(% style="width:134px" %)'RO' - Romanian|(% style="width:125px" %)'S' - Swedish
Isak Björhag 8.1 140
IwonaBudny 18.1 141 === finish ===
Isak Björhag 8.1 142
Isak Björhag 9.1 143 (% class="box infomessage" %)
144 (((
145 ##finish(filename)##
146 )))
Isak Björhag 8.1 147
Isak Björhag 9.1 148 This function will save and write the XML model file to the disk. It will also sort and indent the XML-file so that FEM-Design can read it. This function has to be ran before the file can be opened in FEM-Design.
149
150 ##filename - ##The location and filename of the XML file as a string, for example: ##'C:~\~\temp~\~\example.struxml'##
151
152
IwonaBudny 18.1 153 === addMaterial ===
Isak Björhag 9.1 154
155 (% class="box infomessage" %)
156 (((
157 ##addMaterial(material)
158 return material_ID##
159 )))
160
161 This function will add a material to the XML model file. The return value is used to assign the material to different objects.
162
Isak Björhag 59.1 163 ##material ##- The material to be added as a material class object. Please see above: class: [[material>>doc:||anchor="material"]]
Isak Björhag 9.1 164
165
IwonaBudny 18.1 166 === addSection ===
Isak Björhag 9.1 167
168 (% class="box infomessage" %)
169 (((
170 ##addSection(section, eccentricity)
171 return section_INFO##
172 )))
173
Isak Björhag 45.1 174 This function will add a section to the XML model file. The return value is used to assign the specific section to different objects. The section names can be found in this list: [[Section names>>https://drive.google.com/a/strusoft.com/uc?authuser=0&id=1bHHA1yokq3eJzGIbHrhtAPD2XU5ewOOl&export=download]]
Isak Björhag 9.1 175
176 ##section ##- This is the section name as a string
Isak Björhag 59.1 177 ##eccentricity ##- The eccentricity of the section as a coord object, see class: [[coord>>doc:||anchor="coord"]].
Isak Björhag 9.1 178
179
IwonaBudny 18.1 180 === addBeam ===
Isak Björhag 9.1 181
182 (% class="box infomessage" %)
183 (((
Isak Björhag 17.1 184 ##addBeam(section_INFO, material_ID, point1, point2, rotation, release)##
Isak Björhag 9.1 185 )))
186
187 This function will add a beam object to the XML model file. The beam is added as a line between two points, point1 and point2.
188
189 ##section_INFO## - The section of the beam. Return value from the addSection function
190 ##material_ID## - Material for the beam. Return value from the addMaterial function
Isak Björhag 59.1 191 ##point1## - Coordinate for the first point as a coord object, see class: [[coord>>doc:||anchor="coord"]]
192 ##point2## - Coordinate for the second point as a coord object, see class: [[coord>>doc:||anchor="coord"]]
Isak Björhag 27.1 193 ##rotation## - Rotation of the beam in degrees
Isak Björhag 9.1 194 ##release## - The end releases of the beam as a string: 'hinged' or 'fixed'
195
196
IwonaBudny 18.1 197 === addColumn ===
Isak Björhag 9.1 198
Isak Björhag 11.1 199 (% class="box infomessage" %)
200 (((
201 ##addColumn(section_INFO, material_ID, point1, height, rotation, release)##
202 )))
Isak Björhag 9.1 203
Isak Björhag 11.1 204 This function will add a column object to the XML model file. The column is inserted in a point with a specified height.
Isak Björhag 9.1 205
Isak Björhag 11.1 206 ##section_INFO ##- The section of the column. Return value from the addSection function
207 ##material_ID ##- Material for the beam. Return value from the addMaterial function
Isak Björhag 59.1 208 ##point1 ##- Coordinate for the insertion point of the column as a coord object, see class: [[coord>>doc:||anchor="coord"]]
Isak Björhag 11.1 209 ##height ##- Height of the column in meters
Isak Björhag 27.1 210 ##rotation ##- Rotation of the column in degrees
Isak Björhag 11.1 211 ##release ##- The end releases of the column as a string: 'hinged' or 'fixed'
Isak Björhag 9.1 212
213
IwonaBudny 18.1 214 === addTruss ===
Isak Björhag 9.1 215
Isak Björhag 11.1 216 (% class="box infomessage" %)
217 (((
Isak Björhag 27.1 218 ##addTruss(section_INFO, material_ID, point1, point2)##
Isak Björhag 11.1 219 )))
Isak Björhag 9.1 220
Isak Björhag 11.1 221 This function will add a truss object to the XML model file. The truss is added as a line between two points.
222
223 ##section_INFO## - The section of the truss. Return value from the addSection function
224 ##material_ID## - Material for the truss. Return value from the addMaterial function
Isak Björhag 59.1 225 ##point1 ##- Coordinate for the first point as a coord object, see class: [[coord>>doc:||anchor="coord"]]
226 ##point2## - Coordinate for the second point as a coord object, see class: [[coord>>doc:||anchor="coord"]]
Isak Björhag 11.1 227
228
IwonaBudny 18.1 229 === addPlate ===
Isak Björhag 11.1 230
231 (% class="box infomessage" %)
232 (((
233 ##addPlate(material_ID, thickness, release, point1, point2)##
234 )))
235
236 This function will add a plate as a rectangle with constant thickness to the XML model file. The release setting is set for all the edges of the plate.
237
238 ##material_ID ##- Material for the plate. Return value from the addMaterial function
239 ##thickness ##- Thickness of the plate in meters
240 ##release ##- The edge releases of the plate as a string: 'hinged' or 'fixed'
Isak Björhag 59.1 241 ##point1 ##- Coordinate for the first point of the rectangle as a coord object, see class: [[coord>>doc:||anchor="coord"]]
242 ##point2 ##- Coordinate for the second point of the rectangle as a coord object, see class: [[coord>>doc:||anchor="coord"]]
Isak Björhag 11.1 243
244
IwonaBudny 18.1 245 === addPlateComplex ===
Isak Björhag 11.1 246
247 (% class="box infomessage" %)
248 (((
249 ##addPlateComplex(material_ID, thickness, release, *points)##
250 )))
251
252 This function will add a plate with arbitrary shape defined by a series of lines to the XML model file. The plate is defined with constant thickness. The release setting is set for all the edges of the plate.
253
254 ##material_ID ##- The material of the plate. Return value from the addMaterial function
255 ##thickness ##- Thickness of the plate in meters
Isak Björhag 59.1 256 ##release## - The edge releases of the plate as a string 'hinged' or 'fixed'
257 ##p1, p2, p3... pi## - As many point input parameters as needed. Straight lines will be defined between the different points and between the first and last point. The coordinates defined with coord object, see class [[coord>>doc:||anchor="coord"]]
Isak Björhag 11.1 258
Isak Björhag 63.1 259 (% contenteditable="false" tabindex="-1" %)[[image:1556012847391-857.png||data-widget="image" height="302" width="294"]]
Isak Björhag 11.1 260
261
IwonaBudny 18.1 262 === addWall ===
Isak Björhag 11.1 263
264 (% class="box infomessage" %)
265 (((
266 ##addWall(material_ID, thickness, release, point1, point2)##
267 )))
268
269 This function will add a wall object as a rectangle with constant thickness to the XML model file. The release setting is set for all the edges of the wall.
270
271 ##material_ID ##- Material for the wall. Return value from the addMaterial function
272 ##thickness ##- Thickness of the wall in meters
273 ##release ##- The edge releases of the wall as a string: 'hinged' or 'fixed'
Isak Björhag 59.1 274 ##point1 ##- Coordinate for the first point of the rectangle as a coord object, see class: [[coord>>doc:||anchor="coord"]]
275 ##point2 ##- Coordinate for the second point of the rectangle as a coord object, see class: [[coord>>doc:||anchor="coord"]]
Isak Björhag 11.1 276
277
IwonaBudny 18.1 278 === addPointSupport ===
Isak Björhag 11.1 279
280 (% class="box infomessage" %)
281 (((
282 ##addPointSupport(point, type)##
283 )))
284
285 This function will add a point support in the specified point to the XML model file.
286
Isak Björhag 59.1 287 ##point ##- Coordinate for the point support defined as a coord object, see class: [[coord>>doc:||anchor="coord"]]
Isak Björhag 11.1 288 ##type ##- The type of the support as a string: 'hinged' or 'fixed'
289
290
IwonaBudny 18.1 291 === addLineSupport ===
Isak Björhag 11.1 292
293 (% class="box infomessage" %)
294 (((
295 ##addLineSupport(point1, point2, type)##
296 )))
297
298 This function will add a line support as a line between the defined coordinates to the XML model file.
299
Isak Björhag 59.1 300 ##point1 ##- Coordinate for the first point as a coord object, see class: [[coord>>doc:||anchor="coord"]]
301 ##point2 ##- Coordinate for the second point as a coord object, see class: [[coord>>doc:||anchor="coord"]]
Isak Björhag 11.1 302 ##type ##- The type of the support as a string: 'hinged' or 'fixed'
303
304
IwonaBudny 18.1 305 === addSurfaceSupport ===
Isak Björhag 11.1 306
307 (% class="box infomessage" %)
308 (((
309 ##addSurfaceSupport(point1, point2)##
310 )))
311
312 This function will add a surface support as a rectangle to the XML model file. The support will be 'rigid' in x, y and z translation.
313
Isak Björhag 59.1 314 ##point1## - Coordinate for the first point of the rectangle as a coord object, see class: [[coord>>doc:||anchor="coord"]]
315 ##point2 ##- Coordinate for the second point of the rectangle as a coord object, see class: [[coord>>doc:||anchor="coord"]]
Isak Björhag 11.1 316
317
IwonaBudny 18.1 318 === addCover ===
Isak Björhag 11.1 319
320 (% class="box infomessage" %)
321 (((
322 ##addCover(point1, point2)##
323 )))
324
325 This function will add a cover object as a rectangle between two points.
326
Isak Björhag 59.1 327 ##point1 ##- Coordinate for the first point of the rectangle as a coord object, see class: [[coord>>doc:||anchor="coord"]]
328 ##point2 ##- Coordinate for the second point of the rectangle as a coord object, see class: [[coord>>doc:||anchor="coord"]]
Isak Björhag 11.1 329
330
IwonaBudny 18.1 331 === addLoadCase ===
Isak Björhag 11.1 332
333 (% class="box infomessage" %)
334 (((
335 ##addLoadCase(name, selfWeight)
336 return loadCaseID##
337 )))
338
339 This function will add a load case to the XML model file and return a load case ID which is used to assign different loads to a specific load case.
340
341 ##name ##- The name of the load case
342 ##selfWeight ##- If the program should generate self-weight of the modeled objects or not, input value: True or False
343
344
IwonaBudny 18.1 345 === addLoadComb ===
Isak Björhag 12.1 346
347 (% class="box infomessage" %)
348 (((
349 ##addLoadComb(nameLoadComb, type, loadCaseList, gammaLoadCases)##
350 )))
351
352 This function will add a load combination to the XML model file.
353
354 ##nameLoadComb ##- Name of the load combination
355 ##type ##- The type of the load combination as a string
356
357 (% style="width:210px" %)
358 |(% style="width:33px" %)**Type**
359 |(% style="width:33px" %) |(% style="width:40px" %)U|(% style="width:40px" %)Ua|(% style="width:35px" %)Us|(% style="width:36px" %)Sq|(% style="width:29px" %)Sf|(% style="width:33px" %)Sc
360
Isak Björhag 59.1 361 ##loadCaseList ##- List of load cases to be included in the load combination, return value of addLoadCase (##loadCaseID)##
362 ##gammaLoadCases ##- List of gamma values for the corresponding load cases
363
364
IwonaBudny 18.1 365 === addPointLoad ===
Isak Björhag 11.1 366
367 (% class="box infomessage" %)
368 (((
Isak Björhag 17.2 369 ##addPointLoad(force, direciton, loadCase, point)##
Isak Björhag 11.1 370 )))
371
372 This function will add a point load to the XML model file.
373
Isak Björhag 17.2 374 ##force ##- The magnitude of the point load in kilo newtons
Isak Björhag 59.1 375 ##direction ##- The direction of the point load as a coord object, see class: [[coord>>doc:||anchor="coord"]]
Isak Björhag 17.2 376 ##loadCase ##- The load case (##loadCaseID)## for the point load, return value from the addLoadCase function
Isak Björhag 59.1 377 ##point ##- Coordinate of the point load as a coord object, see class: [[coord>>doc:||anchor="coord"]]
Isak Björhag 11.1 378
379
IwonaBudny 18.1 380 === addLineLoad ===
Isak Björhag 11.1 381
382 (% class="box infomessage" %)
383 (((
Isak Björhag 17.2 384 ##addLineLoad(point1, point2, force, direction, loadCase, point1, point2)##
Isak Björhag 11.1 385 )))
386
387 This function will add a line load between two points to the XML model file.
388
Isak Björhag 12.1 389 ##force ##- The magnitude of the line load in kilo newtons per meter
Isak Björhag 59.1 390 ##direction ##- The direction of the line load as a coord object, see class: [[coord>>doc:||anchor="coord"]]
Isak Björhag 12.1 391 ##loadCase ##- The load case (##loadCaseID)## for the line load, return value from the addLoadCase function
Isak Björhag 59.1 392 ##point1 ##- Coordinate of the first point as a coord object, see class: [[coord>>doc:||anchor="coord"]]
393 ##point2 ##- Coordinate of the second point as a coord object, see class: [[coord>>doc:||anchor="coord"]]
Isak Björhag 11.1 394
395
IwonaBudny 18.1 396 === addSurfaceLoad ===
Isak Björhag 11.1 397
Isak Björhag 12.1 398 (% class="box infomessage" %)
399 (((
Isak Björhag 17.2 400 ##addSurfaceLoad(force, direction, loadCase, point1, point2)##
Isak Björhag 12.1 401 )))
Isak Björhag 11.1 402
Isak Björhag 12.1 403 This function will add a surface load as a rectangle between two points to the XML model file.
Isak Björhag 11.1 404
Isak Björhag 12.1 405 ##force ##- The magnitude of the surface load in kilo newtons per square meter
Isak Björhag 59.1 406 ##direction ##- The direction of the surface load as a coord object, see class: [[coord>>doc:||anchor="coord"]]
Isak Björhag 12.1 407 ##loadCase ##- The load case (##loadCaseID)## for the surface load, return value from the addLoadCase function
Isak Björhag 59.1 408 ##point1 ##- Coordinate of the first point as a coord object, see class: [[coord>>doc:||anchor="coord"]]
409 ##point2 ##- Coordinate of the second point as a coord object, see class: [[coord>>doc:||anchor="coord"]]
Isak Björhag 11.1 410
411
IwonaBudny 18.1 412 === openFD ===
Isak Björhag 11.1 413
Isak Björhag 12.1 414 (% class="box infomessage" %)
415 (((
416 ##openFD(filename)##
417 )))
Isak Björhag 11.1 418
Isak Björhag 12.1 419 This function will open FEM-Design and the selected file.
Isak Björhag 11.1 420
Isak Björhag 12.1 421 ##filename ##- The filename and path from the working folder to the XML model file.
Isak Björhag 11.1 422
423
IwonaBudny 18.1 424 === runFD ===
Isak Björhag 12.1 425
426 (% class="box infomessage" %)
427 (((
428 ##runFD(analysis, save, close, design, filename, batchfile = '', exportfile = '')##
429 )))
430
431 This function will open FEM-Design and execute a script file which is build depending on the input parameters of the function.
432
433 ##analysis ##- Analysis type as a string, choose from 'LIN', 'NLE', 'NLE+PL', 'CR', '2ND', 'STAB' and 'IMP'
434 ##save ##- Save the model and result file or not, input: True or False
435 ##close ##- Close FEM-Design after the analysis is finished, input: True or False
436 ##design ##- Perform design check for steel, timber or concrete as a string: 'steel', 'RC', 'timber, or 'no'
437 ##filename ##- Name and path of the model from the working folder
Isak Björhag 59.1 438 ##batchfile ##- Name and path of the batchfile from the working folder (optional)
439 ##exportfile ##- Name and path of the export file from the working folder (optional)
Isak Björhag 7.2 440
Isak Björhag 51.1 441
Isak Björhag 52.1 442 = {{id name="Customize_wrapper"/}}Customize the wrapper =
Isak Björhag 51.1 443
Isak Björhag 57.1 444 The provided wrapper file is an example of how a wrapper file can look. It is of course possible to customize the wrapper to fit the specific needs of the project or workflow. The example wrapper provided in this wiki is limited in many ways to make it easy and fast to access the settings of the different object. If the user can modify the wrapper to unlock more settings for the different objects or add objects that are missing in the current version of the wrapper.
Isak Björhag 51.1 445
Isak Björhag 57.1 446 The wrapper file is build by different functions, one for each object to be added. In addition to this, some useful help-functions are also included. It is important to understand the help functions and what they do before changing the wrapper.
Isak Björhag 55.1 447
Isak Björhag 56.1 448 == Help functions ==
449
450 These functions are used to generate information in an effective way in the wrapper file. When there is an operation performed multiple times, it is generally made as a help-function. Below the different help functions is described in more detail.
451
Isak Björhag 55.1 452 === ID ===
453
Isak Björhag 56.1 454 (% class="box infomessage" %)
455 (((
456 ##ID(type)
457 return "X.X"##
458 )))
Isak Björhag 55.1 459
Isak Björhag 56.1 460 This function will keep track of the different littera used for the different objects. For example, if a beam is to be added, the function will return "B.<X>" where "X" is the number of the beam starting from 1.
461
Isak Björhag 64.1 462 ##type -## The type of the object as a string
463
Isak Björhag 56.1 464 === genGUID ===
465
466 (% class="box infomessage" %)
467 (((
468 ##genGUID()
469 return GUID##
470 )))
471
472 This function will generate and return a GUID as a string.
473
474 === genUTC ===
475
476 (% class="box infomessage" %)
477 (((
478 ##genUTC()
479 return UTC##
480 )))
481
482 This function will generate the time and date in the correct format for the struXML file and return it as a string.
483
484 === nmz ===
485
486 (% class="box infomessage" %)
487 (((
488 ##nmz(v)
489 return normalized##
490 )))
491
492 This function will normalize a vector.
493
494 ##v ##- A vector in 3D
495
496 === normal ===
497
498 (% class="box infomessage" %)
499 (((
500 ##normal(point1, point2, rot)
501 return normal_vector##
502 )))
503
504 This function will calculate the normal vector to a plane defined by three points. Point 1, point 2 and point1.z + 1.
505
506 ##point1 ##- Point 1 as a coord-object
507 ##point2## - Point 2 as a coord-object
508 ##rot## - Rotation in degrees
509
510
Isak Björhag 51.1 511 == Change the input parameters of a function ==
512
Isak Björhag 56.1 513 Open the wrapper file and go to the specific function. Change the input values of the function and add the input that is needed and add it to the XML creation part of the function. In this example we will add the possibility to set different end releases to the two ends of the beam object.
Isak Björhag 51.1 514
Isak Björhag 57.1 515 ~1. First find the beam object and add the input of another release.
Isak Björhag 55.1 516
Isak Björhag 56.1 517 (% class="box infomessage" %)
518 (((
519 ##def addBeam(section_INFO, material_ID, point1, point2, rotation, (% style="background-color:#f1c40f" %)release_start, release_end(%%)):##
520 )))
521
522 2. Identify the part of the wrapper that sets the end conditions of the beam.
523
524 (% class="box infomessage" %)
525 (((
526 ##if release == 'hinged':
527 ET.SubElement(add_beam_child, 'connectivity', m_x='true', m_y='true', m_z='true', r_x='true', r_y='false', r_z='false')
528 ET.SubElement(add_beam_child, 'connectivity', m_x='true', m_y='true', m_z='true', r_x='true', r_y='false', r_z='false')
529 else:
530 ET.SubElement(add_beam_child, 'connectivity', m_x='true', m_y='true', m_z='true', r_x='true', r_y='true', r_z='true')
531 ET.SubElement(add_beam_child, 'connectivity', m_x='true', m_y='true', m_z='true', r_x='true', r_y='true', r_z='true')##
532 )))
533
Isak Björhag 57.1 534 3. Rewrite the if statement to take into consideration the new inputs (there are many ways of writing this with python, this is just a simple and easy way to understand).
Isak Björhag 56.1 535
536 (% class="box infomessage" %)
537 (((
538 ##if release_start == 'hinged':
539 ET.SubElement(add_beam_child, 'connectivity', m_x='true', m_y='true', m_z='true', r_x='true', r_y='false', r_z='false')
540 if release_end == 'hinged':
541 ET.SubElement(add_beam_child, 'connectivity', m_x='true', m_y='true', m_z='true', r_x='true', r_y='false', r_z='false')
542 else:
543 ET.SubElement(add_beam_child, 'connectivity', m_x='true', m_y='true', m_z='true', r_x='true', r_y='true', r_z='true')
544 else:
545 ET.SubElement(add_beam_child, 'connectivity', m_x='true', m_y='true', m_z='true', r_x='true', r_y='true', r_z='true')
546 if release_end == 'hinged':
547 ET.SubElement(add_beam_child, 'connectivity', m_x='true', m_y='true', m_z='true', r_x='true', r_y='false', r_z='false')
548 else:
549 ET.SubElement(add_beam_child, 'connectivity', m_x='true', m_y='true', m_z='true', r_x='true', r_y='true', r_z='true')##
550 )))
551
552 Now the function will take two end release settings and change the XML file accordingly.
553
Isak Björhag 51.1 554 == Add a new function to the wrapper ==
555
Isak Björhag 57.1 556 The easiest way of adding new objects to the wrapper is to create them in FEM-Design and save it as struXML. Now study the created XML text to be able to understand it and recreate it.
Isak Björhag 51.1 557
Isak Björhag 57.1 558 It is mainly the command ##SubElement ##from the library Element tree that is used to add lines in the XML file. Please visit [[https:~~/~~/docs.python.org/2/library/xml.etree.elementtree.html>>url:https://docs.python.org/2/library/xml.etree.elementtree.html]] for a complete documentation.
559
560 It is also important to sort the XML file. This is done in the function called ##finish. ##This will sort the XML file by simply removing and adding the different objects in the XML file in the correct order.
Iwona Budny Bjergø 62.1 561
562 ----
563
564 (% style="text-align: justify;" %)
565 (% class="small" %)Disclaimer: All example files, wrappers and documentation are for illustrative and educational purposes and may not interact with FEM-Design in a reliable way depending on your version, installation and content of the files. Furthermore, StruSoft won´t guarantee full support of the API functions since they are customizable by the customer.
Copyright 2020 StruSoft AB
FEM-Design Wiki