Skip to main content

NextFEM REST API wrapper in pure Python

Project description

NextFEMpy

NextFEM REST API wrapper in pure Python, to be used with NextFEM Designer or NextFEM Server. It is a complete set of REST API call, wrapped in Python functions, distinguishing between mandatory and optional arguments.

If you're looking for NextFEMpy source, look into /nextfempy folder. If you're looking for sample code using nextfempy, look into /samples folder.

Installation instructions

pip install nextfempy

Upgrading instructions

pip install nextfempy --upgrade

Usage

Before using with your local installation of NextFEM Designer, start the plugin REST API Server.

from nextfempy import NextFEMrest
# connect to local copy of NextFEM Designer
nf=NextFEMapiREST.NextFEMrest()

To handle a property:

nf.autoMassInX=False
print(str(nf.autoMassInX))

To call a NextFEM API method:

nf.addOrModifyCustomData("test","Test")
print(nf.getCustomData("test"))

Sample code

A simple 3D frame using REST API. Remember to start the plugin REST API Server in NextFEM Designer.

import os
from nextfempy import NextFEMrest

# current dir, to be used eventually to save model
dir = os.path.dirname(os.path.realpath(__file__))
# connects to the open instance of NextFEM Designer with REST API server plugin running on your machine
nf=NextFEMrest()

# clear model
nf.newModel()
# material and section
mat=nf.addMatFromLib("C25/30"); print("Mat="+str(mat))
cSect=nf.addCircSection(0.2)
bSect=nf.addRectSection(0.2,0.2)
# nodes
n1=nf.addNode(0,0,0); n2=nf.addNode(0,0,3)
n3=nf.addNode(3,0,0); n4=nf.addNode(3,0,3)
n5=nf.addNode(0,3,0); n6=nf.addNode(0,3,3)
n7=nf.addNode(3,3,0); n8=nf.addNode(3,3,3)
# beams
b1=nf.addBeam(n1,n2,cSect,mat); b2=nf.addBeam(n3,n4,cSect,mat)
b3=nf.addBeam(n2,n4,bSect,mat)
b4=nf.addBeam(n5,n6,cSect,mat); b5=nf.addBeam(n7,n8,cSect,mat)
b6=nf.addBeam(n6,n8,bSect,mat)
b7=nf.addBeam(n2,n6,bSect,mat); b8=nf.addBeam(n4,n8,bSect,mat)
# restraints
nf.setBC(n1,True,True,True,True,True,True)
nf.setBC(n3,True,True,True,True,True,True)
nf.setBC(n5,True,True,True,True,True,True)
nf.setBC(n7,True,True,True,True,True,True)
# loading
nf.addLoadCase("sw"); nf.setSelfWeight("sw")
nf.addLoadCase("perm"); nf.addLoadCase("var")
# floorload type
print(nf.setFloorLoad("floor1","perm",-2.5,0,0,1)); print(nf.setFloorLoad("floor1","var",-3,0,0,1))
# floor plane on beams - nodes 2,4,8,6
print("Apply loading plane: " + str(nf.addFloorPlane("floor1",2,n2,n4,n8,n6)))

# analysis: run all loadcases and print outcome
print(nf.RunModel())
nf.refreshDesignerView(0,True)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nextfempy-0.4.2.tar.gz (52.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nextfempy-0.4.2-py3-none-any.whl (51.7 kB view details)

Uploaded Python 3

File details

Details for the file nextfempy-0.4.2.tar.gz.

File metadata

  • Download URL: nextfempy-0.4.2.tar.gz
  • Upload date:
  • Size: 52.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for nextfempy-0.4.2.tar.gz
Algorithm Hash digest
SHA256 ff4d2881944880bddbfc0479b26d9ce20e215d70e6d676358a168e6e24cd9032
MD5 9a1ebb36dcbef756e5e8fac58cecb77d
BLAKE2b-256 55bed605b6ebaa360cf9110d5928684e29f8fb8703158096915df2f9b5145856

See more details on using hashes here.

File details

Details for the file nextfempy-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: nextfempy-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 51.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for nextfempy-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a35bf91bc1e42b5ca5186221fd2de19a7c5c53bac8f190af6f2907a0acc29e7d
MD5 c5da8a6ad2894468039d8f332e12f4dc
BLAKE2b-256 1168cc87b99f4bcb13a6571a1cda30333bd51de67b147c9252c045a01866f8d4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page