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!). 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 API’s provide productivity enhancements to standard Femap capability. Some are as simple as replacing several 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 API’s 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 even 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. Note that many of the API’s include copy/pasted text from earlier API’s – which may mean the comments or prompts have not been fully/perfectly QA’d. Also, some of these API’s were early ones for EnDuraSim, so there’s scope for improvement. Either way, existing API’s represent a good starting point for anyone who has the time / interest in learning to use the API to enhance productivity.
Finally, the API file extensions have been changed from .BAS to .BBAS. This is so you can successfully download the text files without security warnings. To use an API, the file should be renamed with the .BAS file extension. 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 API file can be opened from the API programming pane, which is activated in the Femap menu via Tools | Programming | API Programming. The API pane provides icons for opening and saving the API, as well as running (and diagnosing) the API. Commonly used API’s 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.
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 maximum and minimum 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. The created group could have a user-selectable ID. Also, the API reliably identifies RBE’s with floating nodes, but the reporting of the qty of floating nodes is imperfect.
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 API’s – 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 API’s and occasionally some generous users who may write API requests and answer questions on writing APIs.