Free Femap API Example Programs
This post provides a list of EnDuraSim API programs for Femap, many of which are free (if there is just a link, it’s free! Right click -> Save Link As to download). If you are accessing this post from our News & Tech Tips page, please click on the post heading to see the full post and API list rather than just the initial text. Other Femap API example programs will be added intermittently to this list over time.
These APIs provide productivity enhancements to standard Femap capability. Some replace multiple repetitive mouse clicks, while others provide advanced processing of results cases for fatigue processing of duty cycles stress ranges using welded structure SN curves. Femap macros and APIs provide the benefit of fast, repeatable treatment of complex or error-prone activities. They provide an excellent return-on-investment in either learning the API or by paying for pre-existing or custom-written APIs, which is one of EnDuraSim’s services. EnDuraSim also provides training for Femap users who would like to learn to use the API to extend Femap productivity.
EnDuraSim provides the free API programs as-is; some of which include comment lines to help explain the purpose of major sections / lines in the API. However, some of these APIs were early ones for EnDuraSim, so there’s some scope for QA / improvement. Regardless, existing APIs represent a great starting point for anyone who has the time / interest in learning to use the API to enhance productivity.
CRITICAL: The source code (text) API file extensions have been changed from .BAS to .TXT on our site. This is so you can successfully view/save the files – because API files are usually extreme security risks which your operating system will resist downloading. Right click on the link to save the file. To use an API with Femap, the file should be renamed with the .BAS file extension (OR from .exxe to .exe for non-source-code APIs). API files should be put into a directory (or directory tree) which is then selected via User Tools -> Tools Directory. OR, for API editing/testing/learning, the source API text can be opened or pasted into the API programming pane, which is activated in the Femap menu via Tools | Programming | API Programming. The API pane provides icons for opening/saving the API, as well as running (and diagnosing) the API. Commonly used APIs should be placed on a button in a user defined toolbar, via Tools | Toolbars | Customize.
Femap API Program List
Highlight_Connected Elements_Of_Same_Type This API asks you to select a single element. It then highlights all elements of the same type which are recursively connected to that. It can be useful to check contact models to ensure separate components do not accidentally have merged nodes, or to be sure that a single complex “part” has all its elements connected. Note that if the model is large, the recursive selection can take time. Note that at the end of this API, all the highlighted elements are also shown in the standard Femap Entity Selection dialog. By pressing OK, this ensures that you can use the “Previous” button on the same dialog to perform a subsequent command on the same elements, if needed.
EnDuraSim Critical Plane Stress Range Calculator Right Click and Save As Link to download – you will need to over-ride security warnings to do so. This essential precursor to fatigue assessment calculates the true critical plane stress range across numerous Output Sets. It operates on every plate element (Types 17 AND 18) in the model. Solid element stress range can easily be achieved by “coating” solid elements with very thin plate elements (~strain gauges) using Femap’s Mesh | Edge/Skin command, prior to analysis. The critical plane calculation is done in 18 x 10 degree increments, for both plate top and bottom results. A new Stress Range Output Set is created, which includes: Max Stress Range (from top/bottom stress range); max direct stress for Max Stress Range; min direct stress for Max Stress Range; Critical Angle (from element X direction) at which Max Stress Range occurs; Output Set IDs from which max stress and the min stress of Max Stress Range came; and Stress Range, Angle, Set IDs for Top/Bottom of each plate element.
NOTE: This FREE TRIAL executable is limited to 1000 nodes/elements. Change the file extension to .exe and save in your User Tools folder as for other APIs (see instructions above). Contact EnDuraSim (eg. info@endurasim.com.au) to buy the unlimited version, starting at AUD $220 (inc GST)/USD $150 for a single dongle licence, or for any further details.
Highlight_Short_Curves_On_Solid This API asks you to select one or more solids (which can include sheet / general solids). It then asks for threshold minimum and maximum lengths for the curves you wish to highlight. It can be used to find troublesome tiny curves which cause meshing problems, which can then be suppressed en-masse. Or, it can be used to find numerous curves on a solid within a range of sizes, to which you may then wish to apply a consistent mesh sizing. Note that at the end of this API, all the highlighted curves are also shown in the standard Femap Entity Selection dialog. By pressing OK, this ensures that you can use the “Previous” button on the same dialog to perform a subsequent command on the same curves.
Group_RBE_Elements_with_Floating_Nodes This API creates/replaces Group 41 and includes in that group any RBE elements (rigid, Femap element Type 29) which have floating nodes. These are dependent nodes of RBE2’s which are not connected to other elements, or independent nodes of RBE3’s which are not connected to other elements. It is poor practice to have such nodes in the model, and likely indicates that an unintended modelling error has occurred. Note that this is an early EnDuraSim API and could use some improvements as a learning exercise -eg. the created group could have a user-settable ID, or the next available unused ID.
Femap Model Version This is a very simple but useful API. It prompts you to select a Femap model file (.modfem) and shows (in the Message Window) which Femap version it is – without opening the model. This is very useful if needing to review old/large models and would prefer to open in the correct Femap version, rather than wait for Femap to convert the model into the current .modfem file format. The API can be run from any version of Femap to report the (selected, but unopen) model file version.
Highlight_Mesh_Points_on_Surfaces Select one or more surfaces and Femap will highlight all the Mesh Points on those surfaces. Mesh Points are used to create nodes in specific locations on surfaces (eg. to connect multiple simplified bolts or rivets between parts). This API is the fastest method of seeing which points have been set as the Mesh Points on one or more surfaces.
Group_Sheet_Solids_with_Poor_Elements This is currently hardwired to check plate elements – it asks for a threshold Jacobian, and groups the Sheet Solids with elements worse than the threshold Jacobian, and highlights the individual surfaces where the elements are worse than the Jacobian – noting that any Sheet Solid may have numerous surfaces but perhaps only a few surfaces with poor quality elements.
Group_Solids_By_Type The user enters a starting group ID, and the API creates three groups of entities by Femap’s three main geometry types: (1) Real Solids = typical solids containing a real volume bounded by multiple surfaces, possibly including interior voids; (2) Sheet Solids = typically single/multi-surface entities with a topological “top” and “bottom” – often used to represent a sheet metal part; and (3) General Solids = combined multi-surface entities commonly used to represent mid-surface geometry of welded plate structures OR specialist geometry such as solids with interior features that can be used to mesh internal reinforcing bars within solid concrete. In Femap, General Solids are typically created by Geometry | Surface | Non-Manifold Add – if the resulting geometry does not have a clear topological “inside/outside” or collective “top/bottom”. Some CAD systems cannot create or import General Solids, as these do not fit with usual CAD modelling philosophy. This API is useful for QA’ing imported geometry (eg. identify which “solids” did not correctly import as real solids), and for otherwise rapidly separating geometry entity types in complex FEA assemblies, for further processing.
Welded_Structure_Fatigue_Assessment This API provides a conservative fatigue assessment method for welded plate structures subject to a Duty Cycle of loads. The user supplies number of repeats for the loads in the Duty Cycle and the assessment provides: stress “range”; damage proportion; and Duty Cycles to failure – for a selection of common welded joint details such as BS7608, AS4100 Sec 11, Eurocode 3, DNV and TWI SN curves.
Find_Renegade_Mesh_Points. This API highlights/groups Mesh Points and Surfaces where the Mesh Point is not within a user-defined distance of its parent surface. In almost every practical case, Mesh Points should sit on the surface to which they belong. There are a collection of modelling errors/oversights which can be made such that Mesh Points no longer sit on their parent surface – creating a problem in any situation where the parent surface is re-meshed and the Mesh Point nodes are then not located where intended – for example to connect to elements representing rivets, bolts or links.
List Summed Nodal Results. This is for users of transient and non-linear analysis. The API accelerates the review of analysis results by providing summed and averaged results from multiple nodes across multiple time or load steps and sending the data to Excel. The API also lists summary information like integrals of totals and averages over time – eg. impulse for constraint force results, or delta velocity or delta displacement from acceleration or velocity results. AUD $100 for executable version. AUD $500 for detailed commented source version. Contact info@endurasim.com.au for more details. We also have a similar API for extracting reaction, initial energy and time data from the Advanced Non-linear SOL601 .f06 file – intended for review of analysis quality during the run.
Show_Unassociated_Solid_Elems. This API highlights solid (brick and tet) elements which are not associated with a solid. This is a simple API which replaces about 20 manual button presses to identify “orphan” solid elements for model QA. Orphan solid elements can occur if meshed solid geometry is edited (slice, break, project, copy, reflect fillet, suppress, etc. etc) outside the Meshing Toolbox. Orphan mesh is a common cause of analysis singularities because orphan mesh is often disconnected from the rest of the mesh. Orphan mesh can also cause Femap “red warnings” when starting analyses, because a solid surface may have associated loads, constraints or connection regions – but the mesh has lost association with the geometry, due to the editing mentioned above.
As with other Highlighting APIs here, the relevant elements are shown in the standard Entity Selection dialog. Press OK so that the same elements can be selected using “Previous” in subsequent commands (eg. Delete | Model | Mesh).
Show_Unassociated_Plate_Elems. This API highlights plate (actually, all surface type) elements which are not associated with a surface. This is a simple API which replaces many convoluted button presses to identify “orphan” plate elements, for model QA. Orphan plate elements can occur if meshed geometry is edited (slice, break, project, copy, reflect, suppress, etc. etc) outside the Meshing Toolbox. Orphan mesh is a common cause of analysis singularities because orphan mesh is often disconnected from the rest of the mesh. Orphan mesh can also cause Femap “red warnings” when starting analyses, because a surface may have associated loads, constraints or connection regions but the mesh has lost association with the geometry, due to the editing mentioned above.
As with other Highlighting APIs here, the relevant elements are shown in the standard Entity Selection dialog. Press OK so that the same elements can be selected using “Previous” in subsequent commands (eg. Delete | Model | Mesh).
EnDuraSim can be engaged to write custom Femap APIs – typically as a cost-effective fixed priced contract for a defined scope of work and/or as training / Analyst Mentoring.
The Siemens Femap forum ( currently at https://community.plm.automation.siemens.com/t5/3D-Simulation-Femap-Forum/bd-p/Simcenter_3DFemap_forum ) also provides some Femap APIs and occasionally some generous users who may write API requests and answer questions on writing APIs.