Show last authors
1 (% class="box floatinginfobox" %)
2 (((
3 [[FEM-Design API examples on GitHub>>https://github.com/strusoft/femdesign-api-example]]
4
5 [[API-wrapper as zip>>attach:fdAPI_wrapper_beta_v1.02.zip]]
6
7
8 Contents
9
10 (% contenteditable="false" tabindex="-1" %)
11 (((
12 {{toc depth="4"/}}
13 )))
14 )))
15
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.
17
18
19 (% class="box warningmessage" style="text-align: justify;" %)
20 (((
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"]]
22 )))
23
24 The following information is valid for python. However, it is possible to construct a similar wrapper for other programming languages.
25
26
27 {{video ratio="16:9" url="https://youtu.be/tC5mxDIf7aE"/}}
28
29 (% contenteditable="false" tabindex="-1" %)
30 (((
31
32 )))
33
34 = Getting started =
35
36
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"(%%).
38
39
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]]
41
42 (% contenteditable="false" tabindex="-1" %)[[image:1556029928168-186.png||data-widget="image" height="114" width="503"]]
43
44
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
47
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
55 = Documentation =
56
57 == Classes ==
58
59 === {{id name="coord"/}}coord ===
60
61 (% class="box infomessage" %)
62 (((
63 (% style="background-color:null" %)##class coord:##(%%)
64 (% style="background-color:null" %)## def ~_~__init~_~__(self, x=0, y=0, z=0):##(%%)
65 (% style="background-color:null" %)## self.x = x##(%%)
66 (% style="background-color:null" %)## self.y = y##(%%)
67 (% style="background-color:null" %)## self.z = z##
68 )))
69
70 This class is used to define coordinates.
71 ##coord.x - x
72 coord.y - y
73 coord.z - z##
74
75
76 === XML ===
77
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
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.
88
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
92
93
94 === {{id name="material"/}}material ===
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
107 ##material.type## - material name as string
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
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| | | | | | | | | | | | | | | |
114
115 Service class 1 is assumed for all timber materials.
116
117 ##material.creep## - creep for concrete
118 ##material. shrinkage## - shrinkage for concrete
119
120
121 == Functions ==
122
123 === initiateModel ===
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
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" %)(((
137 'N' - Norwegian
138 )))
139 |(% style="width:128px" %)'PL' - Polish|(% style="width:134px" %)'RO' - Romanian|(% style="width:125px" %)'S' - Swedish
140
141 === finish ===
142
143 (% class="box infomessage" %)
144 (((
145 ##finish(filename)##
146 )))
147
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
153 === addMaterial ===
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
163 ##material ##- The material to be added as a material class object. Please see above: class: [[material>>doc:||anchor="material"]]
164
165
166 === addSection ===
167
168 (% class="box infomessage" %)
169 (((
170 ##addSection(section, eccentricity)
171 return section_INFO##
172 )))
173
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]]
175
176 ##section ##- This is the section name as a string
177 ##eccentricity ##- The eccentricity of the section as a coord object, see class: [[coord>>doc:||anchor="coord"]].
178
179
180 === addBeam ===
181
182 (% class="box infomessage" %)
183 (((
184 ##addBeam(section_INFO, material_ID, point1, point2, rotation, release)##
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
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"]]
193 ##rotation## - Rotation of the beam in degrees
194 ##release## - The end releases of the beam as a string: 'hinged' or 'fixed'
195
196
197 === addColumn ===
198
199 (% class="box infomessage" %)
200 (((
201 ##addColumn(section_INFO, material_ID, point1, height, rotation, release)##
202 )))
203
204 This function will add a column object to the XML model file. The column is inserted in a point with a specified height.
205
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
208 ##point1 ##- Coordinate for the insertion point of the column as a coord object, see class: [[coord>>doc:||anchor="coord"]]
209 ##height ##- Height of the column in meters
210 ##rotation ##- Rotation of the column in degrees
211 ##release ##- The end releases of the column as a string: 'hinged' or 'fixed'
212
213
214 === addTruss ===
215
216 (% class="box infomessage" %)
217 (((
218 ##addTruss(section_INFO, material_ID, point1, point2)##
219 )))
220
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
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"]]
227
228
229 === addPlate ===
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'
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"]]
243
244
245 === addPlateComplex ===
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
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"]]
258
259 (% contenteditable="false" tabindex="-1" %)[[image:1556012847391-857.png||data-widget="image" height="302" width="294"]]
260
261
262 === addWall ===
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'
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"]]
276
277
278 === addPointSupport ===
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
287 ##point ##- Coordinate for the point support defined as a coord object, see class: [[coord>>doc:||anchor="coord"]]
288 ##type ##- The type of the support as a string: 'hinged' or 'fixed'
289
290
291 === addLineSupport ===
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
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"]]
302 ##type ##- The type of the support as a string: 'hinged' or 'fixed'
303
304
305 === addSurfaceSupport ===
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
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"]]
316
317
318 === addCover ===
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
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"]]
329
330
331 === addLoadCase ===
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
345 === addLoadComb ===
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
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
365 === addPointLoad ===
366
367 (% class="box infomessage" %)
368 (((
369 ##addPointLoad(force, direciton, loadCase, point)##
370 )))
371
372 This function will add a point load to the XML model file.
373
374 ##force ##- The magnitude of the point load in kilo newtons
375 ##direction ##- The direction of the point load as a coord object, see class: [[coord>>doc:||anchor="coord"]]
376 ##loadCase ##- The load case (##loadCaseID)## for the point load, return value from the addLoadCase function
377 ##point ##- Coordinate of the point load as a coord object, see class: [[coord>>doc:||anchor="coord"]]
378
379
380 === addLineLoad ===
381
382 (% class="box infomessage" %)
383 (((
384 ##addLineLoad(point1, point2, force, direction, loadCase, point1, point2)##
385 )))
386
387 This function will add a line load between two points to the XML model file.
388
389 ##force ##- The magnitude of the line load in kilo newtons per meter
390 ##direction ##- The direction of the line load as a coord object, see class: [[coord>>doc:||anchor="coord"]]
391 ##loadCase ##- The load case (##loadCaseID)## for the line load, return value from the addLoadCase function
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"]]
394
395
396 === addSurfaceLoad ===
397
398 (% class="box infomessage" %)
399 (((
400 ##addSurfaceLoad(force, direction, loadCase, point1, point2)##
401 )))
402
403 This function will add a surface load as a rectangle between two points to the XML model file.
404
405 ##force ##- The magnitude of the surface load in kilo newtons per square meter
406 ##direction ##- The direction of the surface load as a coord object, see class: [[coord>>doc:||anchor="coord"]]
407 ##loadCase ##- The load case (##loadCaseID)## for the surface load, return value from the addLoadCase function
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"]]
410
411
412 === openFD ===
413
414 (% class="box infomessage" %)
415 (((
416 ##openFD(filename)##
417 )))
418
419 This function will open FEM-Design and the selected file.
420
421 ##filename ##- The filename and path from the working folder to the XML model file.
422
423
424 === runFD ===
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
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)
440
441
442 = {{id name="Customize_wrapper"/}}Customize the wrapper =
443
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.
445
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.
447
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
452 === ID ===
453
454 (% class="box infomessage" %)
455 (((
456 ##ID(type)
457 return "X.X"##
458 )))
459
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
462 ##type -## The type of the object as a string
463
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
511 == Change the input parameters of a function ==
512
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.
514
515 ~1. First find the beam object and add the input of another release.
516
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
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).
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
554 == Add a new function to the wrapper ==
555
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.
557
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.
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