pycalculix package

Submodules

pycalculix.base_classes module

This module stores base classes and functions.

pycalculix.base_classes.RESFILEDS

stores results fields under results type

key (str):
  • ‘displ’: displacement
  • ‘stress’: stress
  • ‘strain’: strain
  • ‘force’: force
value (list):
  • ‘displ’ = ‘ux’,’uy’,’uz’,’utot’
  • ‘stress’ = ‘Sx’,’Sy’,’Sz’,’Sxy’,’Syz’,’Szx’,’Seqv’,’S1’,’S2’,’S3’
  • ‘strain’ = ‘ex’,’ey’,’ez’,’exy’,’eyz’,’ezx’,’eeqv’,’e1’,’e2’,’e3’
  • ‘force’ = ‘fx’,’fy’,’fz’
Type:dict
pycalculix.base_classes.FIELDTYPE

the inverse dict of RESFIELDS

For example: key ‘ux’ –> value: ‘displ’

Type:dict
class pycalculix.base_classes.Idobj[source]

Bases: object

Makes an object that stores an id number.

This is a base class for nodes, lines, areas etc.

id

the unique id number for the item

Type:int
set_id(id)[source]

Sets the id number

class pycalculix.base_classes.Itemlist[source]

Bases: list

Makes a custom list used to store lists of non-mesh items.

non-mesh items = Point, Line, Arc, Area, Part, Components, Loads This class allows us to automatically assign id numbers to items in the list. Thes id numbers are needed when we send geometry out for meshing. All instances of this class start as empty lists.

append(item)[source]

Adds an item to the list and sets the item’s id.

Parameters:item (Point or Line or Arc or Area or Part) – item to add to the list
get_ids()[source]

Returns a list of ids. Loops through all items in self.

get_next_id()[source]

Returns the next unused id.

class pycalculix.base_classes.Meshlist[source]

Bases: list

Makes a custom list used to store lists of nodes and elements.

All instances of this class start as empty lists.

get_maxid()[source]

Returns the max id number in the list.

get_minid()[source]

Returns the min id number in the list.

idget(idnum)[source]

Returns an item with the passed id number.

Parameters:idnum (int) – passed id number, we want the item that has this
Returns:returns item if found, None if not found
Return type:item or None
set_minid(val)[source]

Sets the min id to the passed val.

Parameters:val (int) – New min id number in the list
pycalculix.base_classes.chunk_list(inlist, size)[source]

Returns a list of lists where each list <= size length.

Splits inlist into list of lists where each child list len <= size.

Parameters:
  • inlist (list) – list that we want cut into smaller lists
  • size (int) – max length of small lists returned
Returns:

list of list where each child list <= size length

Return type:

res (list of lists)

pycalculix.base_classes.listify(items)[source]

Returns a list of items. If items is an object it puts it in a list.

If a list is passed, it returns the list without changing it. If an object is passed, it returns a list with the object in it.

Parameters:items (object or list) – item or list to convert to a list
pycalculix.base_classes.plot_finish(plt, fname, display)[source]

Display and or save plot.

pycalculix.base_classes.plot_set_bounds(plt, axials, radials)[source]

Sets the axial and radial bounds of the shown plot.

pycalculix.cadimporter module

This module stores the CadImporter class, which is used to load CAD parts.

class pycalculix.cadimporter.CadImporter(feamodel, fname='', layer=-1, swapxy=False, scale='')[source]

Bases: object

Makes an object which can import cad parts.

Parameters:
  • feamodel (FeaModel) – model that we want to import parts into
  • layer (int) – layer to import, all entities will be flattened to one plane. -1 mean all layers, any other number is a specific layer
  • swapxy (bool) – True rotates the part from x axial to y axial
  • scale (str) –

    string telling the unit conversion scalar

    • Any option of ‘fromunit-tounit’ using the below units
    • mm, m, in, ft
    • Examples ‘mm-m’ ‘m-in’ ‘ft-mm’ ‘in-ft’
    • Default value is ‘’ and does not apply a scale factor
__fea

model

Type:FeaModel
__fname

file we want to import

Type:str
__layer

layer to import

Type:int
__swapxy

If true, swap part from xy to yx orientation

Type:bool
load()[source]

Loads the self.__fname cad file

Returns:list of Part
Return type:list

pycalculix.components module

This module defines the Component class, which is used to make components.

Components are collections that loads are applied to.

class pycalculix.components.Component(item_list, ctype, cname='')[source]

Bases: pycalculix.base_classes.Idobj

Makes a component to store loads, boundary conditions, matl, thickness.

A component must store a list of items where the type is identical for all items.

Parameters:
  • item_list (list) – list of items to store
  • ctype (str) –

    type of component. Options:

    • ’nodes’: all element nodes (corner and mid-side)
    • ’n1’: element corner nodes
    • ’faces’: faces
    • ’elements’: elements
  • cname (str) – component name
ccx()[source]

Writes a component for Calculix ccx solver.

Returns a list strings, where each item is a line to write to a Calculix .inp text file.

Note

Only node and element components should use this.

get_children()[source]

Returns a list the child ctype items of the current component.

get_name()[source]

Returns the component name created with its id number.

set_name(name)[source]

Set the component name to the passed name.

Parameters:name (str) – passed name, component name is changed to this
write_cgx()[source]

Writes a component for Calculix cgx prerocessor.

Returns a list strings, where each item is a line to write to a Calculix .fbd text file.

Note

Only line and point node components should use this.

write_gmsh()[source]

Writes a component for gmsh mesher.

Returns a list strings, where each item is a line to write to a Calculix .geo text file.

Note

Only line and point node components should use this.

pycalculix.connectors module

This module stores connector classes, like Contact.

class pycalculix.connectors.Contact(master_comp, slave_comp, surf_int, surf_to_surf=True)[source]

Bases: pycalculix.base_classes.Idobj

Makes a contact which will be between lines which have faces on them.

Parameters:
  • master_comp (Component) – component of master element faces
  • slave_comp (Component) – component of slave element faces
  • surf_int (SurfaceInteraction) – object which stores closure behavior
  • surf_to_surf (bool) – if True surface to surface is used, if False node to surface is used
ccx()[source]

Writes the contact pair for the ccx solver.

name

Contact name.

class pycalculix.connectors.SurfaceInteraction(int_type, *args)[source]

Bases: pycalculix.base_classes.Idobj

Makes a surface interaction object.

Parameters:
  • int_type (str) –

    interaction type

    • ’EXPONENTIAL’
    • ’LINEAR’
  • *args

    following arguments

    • int_type = ‘EXPONENTIAL’
      • c0, then p0 must be passed
    • int_type = ‘LINEAR’
      • k must be passed
ccx()[source]

Writes the surface interaction for the ccx solver.

name

SurfaceInteraction name.

pycalculix.environment module

This module sets the dpi and the paths to gmsh, ccx, and cgx.

pycalculix.environment.DPI

if high dpi windows 8 monitor value is set, otherwise value is None.

Type:None or float
pycalculix.environment.CCX

path to Calculix ccx, the sovler.

Type:str
pycalculix.environment.CGX

path to Calculix cgx, the preprocessor/postprocessor/mesher.

Type:str
pycalculix.environment.GMSH

path to the Gmsh mesher.

Type:str
class pycalculix.environment.OSVERSIONINFOEXW[source]

Bases: _ctypes.Structure

Returns object w/ attributes that will identify window os version

dwBuildNumber

Structure/Union member

dwMajorVersion

Structure/Union member

dwMinorVersion

Structure/Union member

dwOSVersionInfoSize

Structure/Union member

dwPlatformId

Structure/Union member

szCSDVersion

Structure/Union member

wProductType

Structure/Union member

wReserved

Structure/Union member

wServicePackMajor

Structure/Union member

wServicePackMinor

Structure/Union member

wSuiteMask

Structure/Union member

pycalculix.environment.get_dpi()[source]

Returns an int of current DPI for windows or None.

pycalculix.environment.get_paths()[source]

Returns a list of paths to: [ccx, cgx, gmsh].

pycalculix.environment.get_version()[source]

Get’s the OS version. Returns a float of OS_MAJOR.OS_MINOR

pycalculix.feamodel module

This module stores the FeaModel class.

This class is the highest level object in a pycalculix program. It stores all parts, loads, constraints, mesh, problem, and results_file objects.

class pycalculix.feamodel.FeaModel(model_name, ccx=None, cgx=None, gmsh=None)[source]

Bases: object

Makes a FeaModel instance.

Parts, area, lines, arcs, points, nodes, elements, faces, models, components, and loads are stored in this object.

Parameters:
  • model_name (str) – project name for this FeaModel, this is a file prefix
  • ccx (None or str) – path to Calculix ccx solver, pass this when you want to overwite the default program location. None means the default envionment.CCX is used.
  • cgx (None or str) – path to Calculix cgx mesher, pass this when you want to overwite the default program location. None means the default envionment.CGX is used.
  • gmsh (None or str) – path to gmsh mesher, pass this when you want to overwite the default program location. None means the default envionment.GMSH is used.
fname

FeaModel project file name prefix

Type:str
points

list of all Point

Type:Itemlist
lines

list of all Line and Arc

Type:Itemlist
signlines

list of all SignLine and SignArc

Type:Itemlist
lineloops

list of all LineLoop, each contains SignLine SignArc

Type:Itemlist
areas

list of all Area, each contains LineLoop(s)

Type:Itemlist
parts

list of all Part

Type:Itemlist
matls

list of all materials

Type:Itemlist
components

list of all components

Type:Itemlist
loads

a dictionary of loads

Key (float): the load time point
loads[time] = list of loads for that time step
See method set_time to change the current time.
Time = 0.0 stores constant loads, such as:
material, thickness
Type:dict
contacts

list of contacts

Type:Itemlist
surfints

list of surface interactions

Type:Itemlist
problems

list of problems

Type:Itemlist
nodes

list of all mesh nodes

Type:Meshlist
eshape

element shape

  • ‘quad’: quadrilateral elements (Default)
  • ‘tri’: triangle elements
Type:str
eorder

element order, 1 or 2

  • 1: elements meshed with corner nodes only
  • 2: (Default) elements meshed with corner and midside nodes
Type:int
elements

list of all mesh elements

Type:Meshlist
faces

list of all element faces, includes non-exterior ones

Type:list
view

currently selected items

parts

list of selected parts

areas

list of selected areas

lines

list of selected signed lines or arcs

points

list of selected points

elements

list of selected elements

faces

list of selected faces

nodes

list of selected nodes

Type:Selector
time

current model time value, defaults to 1.0

Type:float
units

a dict to store units for different fields

Keys:
  • ‘displ’: displacement or location
  • ‘force’: force
  • ‘stress’: stress
  • ‘temp’: temperature
  • ‘density’: density (mass/volume)
  • ‘time’: time
Returns:Text string describing the units for the given key field.

See the set_units method.

For example when units have been set to metric, the below values are returned.

  • ’dist’ –> ‘m’
  • ’density’ –> ‘kg/(m^3)’
  • ’time’ –> ‘s’
Type:dict
get_item(item)[source]

Returns an item given a string identifying the item.

Parameters:item (str) – ‘A0’ or ‘P0’ or ‘L0’ etc.
get_items(items)[source]

Returns a list of correctly typed items.

Input can be a single string or item, or a list of strings identifying items.

get_units(*args)[source]

Returns units for the passed arguments. Accepts and returns a list of strings.

Options for inputs:
  • ‘dist’
  • ‘displ’ (same units as ‘dist’)
  • ‘force’
  • ‘stress’
  • ‘temp’
  • ‘density’
  • ‘time’
make_matl(name)[source]

Makes and returns a new material.

Parameters:name (str) – the material’s name
make_part()[source]

Makes and returns a new part.

make_problem(problem_type='struct', parts='all')[source]

Makes and returns a new problem, which can be solved.

Parameters:
  • problem_type (str) – problem type, options: ‘struct’: structural
  • parts (str Part or list of Part) –

    Parts the model will analyze.

    Options:
    • ’all’: add all parts. This is the default.
    • Part: add the single part
    • list of Part: add these parts
mesh(size=1.0, meshmode='fineness', mesher='gmsh')[source]

Meshes all parts.

Parameters:
  • size (float) –
    • if meshmode == ‘fineness’ (default):
      • mesh size is adapted to geometry size
      • set size = 0.0001 - 1.0, to define how fine the mesh is.
      • Low numbers are very fine, higher numbers are coarser.
    • if meshmode == ‘esize’:
      • element size is kept constant
      • choose it depending on geometry size
      • it should be reduced e.g. at arcs with small radius, by calling line.esize function
  • meshmode (str) –
    • ‘fineness’: adapt mesh size to geometry
    • ’esize’: keep explicitly defined element size

    meshmode is changed to ‘esize’ is used if esize property is set to points or lines

  • mesher (str) –

    the mesher to use

    • ’gmsh’: mesh with Gmsh, this is reccomended, it allows holes
    • ’cgx’: mesh with Calculix cgx, it doesn’t allow holes
plot_areas(fname='', display=True, title='Areas', label=True)[source]

Plots selected areas

Defaults to displaying labels on: areas and filling all part areas.

Parameters:
  • fname (str) – png image file prefix, if given, image will be saved
  • display (bool) – if True, interactive plot will be shown, if False plot will not be shown. Default = True
  • title (str) – the plot’s title
  • label (bool) – if True all areas will be labeled
plot_constraints(fname='', display=True)[source]

Plots the constraints on the passed part(s) or selected items.

This is an element and node plot, with arrows showing displacement constraints.

Parameters:
  • fname (str) – png image file prefix, if given, image will be saved
  • display (bool) – if True, interactive plot will be shown, if False plot will not be shown. Default = True
plot_elements(fname='', display=True, title='Elements', enum=False, nshow=False, nnum=False)[source]

Plots the selected elements.

Parameters:
  • fname (str) – png image file prefix, if given, image will be saved
  • display (bool) – if True, interactive plot will be shown, if False plot will not be shown
  • title (str) – the plot’s title
  • enum (bool) – if True element numbers are plotted
  • nshow (bool) – True=plot nodes, False=don’t plot them
  • nnum (bool) – if True node numbers are plotted
plot_geometry(fname='', display=True, title='Geometry', pnum=True, lnum=True, anum=True, afill=True)[source]

Plots selected geometry items: areas, lines, points.

Defaults to displaying labels on: areas, lines, and points, and filling in the areas.

Parameters:
  • fname (str) – png image file prefix, if given, image will be saved
  • display (bool) – if True, interactive plot will be shown, if False plot will not be shown. Default = True
  • title (str) – the plot’s title
  • pnum (bool) – if True all Point objects will be labeled
  • lnum (bool) – if True all Line and Arc objects will be labeled
  • anum (bool) – if True all Area objects will be labeled
  • afill (bool) – if True all Area objects will be filled
plot_lines(fname='', display=True, title='Lines', label=True)[source]

Plots selected lines and arcs

Defaults to displaying labels on: lines and arcs

Parameters:
  • fname (str) – png image file prefix, if given, image will be saved
  • display (bool) – if True, interactive plot will be shown, if False plot will not be shown. Default = True
  • title (str) – the plot’s title
  • label (bool) – if True all lines and arcs will be labeled
plot_multiple(fname='', display=True, title='', styledict={'items': ['points, lines, areas'], 'labels': ['points', 'lines', 'areas', 'parts']})[source]

Plots items of type styledict[‘items’], labels styledict[‘labels’]

Only the items currently selected will be plotted.

plot_nodes(fname='', display=True, title='Nodes', nnum=False)[source]

Plots the selected nodes.

Parameters:
  • fname (str) – png image file prefix, if given, image will be saved
  • display (bool) – if True, interactive plot will be shown, if False plot will not be shown
  • title (str) – the plot’s title
  • nnum (bool) – if True node numbers are plotted
plot_parts(fname='', display=True, title='Parts', label=True)[source]

Plots selected parts

Defaults to displaying labels on: parts and filling all part areas.

Parameters:
  • fname (str) – png image file prefix, if given, image will be saved
  • display (bool) – if True, interactive plot will be shown, if False plot will not be shown. Default = True
  • title (str) – the plot’s title
  • label (bool) – if True all Part objects will be labeled
plot_points(fname='', display=True, title='Points', label=True)[source]

Plots selected points

Defaults to displaying labels on: points

Parameters:
  • fname (str) – png image file prefix, if given, image will be saved
  • display (bool) – if True, interactive plot will be shown, if False plot will not be shown. Default = True
  • title (str) – the plot’s title
  • label (bool) – if True all points will be labeled
plot_pressures(fname='', display=True)[source]

Plots the load step pressures on the passed part(s) or selected elements.

This is an element plot, with arrows showing pressure magnitude and directions.

Parameters:
  • fname (str) – png image file prefix, if given, image will be saved
  • display (bool) – if True, interactive plot will be shown, if False plot will not be shown. Default = True
print_summary()[source]

Prints a summary of the items in the database.

register(item)[source]

Adds an item to the feamodel.

Item is added to the correct list and its id is updated. Allowed Items:

  • Point
  • Line
  • Arc
  • SignLine
  • SignArc
  • LineLoop
  • Area
  • Part
scale(unitstr, point_first=None, point_last=None)[source]

Scales the points from [point_first, …, point_last] using unitstr

If point_first and point_last are both None, all points are scaled.

Parameters:
  • unitstr (str) –

    string scalar ‘fromunit-tounit’ using the below units:

    • mm, m, in, ft
    • Examples ‘mm-m’ ‘m-in’ ‘ft-mm’ ‘in-ft’
    • Default value is ‘’ and does not apply a scale factor
  • point_first (Point or None or str) – the first point to scale, string point names may be passed
  • point_last (Point or None or str) – the last point to scale, string point names may be passed
set_constr(ltype, items, axis, val=0.0)[source]

Sets a displacement constraint on the passed item(s).

Parameters:
  • ltype (str) –

    ‘fix’ or ‘displ’

    • ’fix’: val arg should not be passed
    • ’displ’: val arg must be passed
  • items (str, SignLine, SignArc, Point or list) –

    item(s) to apply the constraint on

    • str: this string must be a line or point name
    • SignLine or SignArc: the constraint will be applied
      to this item
    • Point: the constraint will be applied on this item
    • list of SignLine or SignArc: the constraint will be appplied
      on these
    • list of Point: the constraint will be appplied on these
    • list of str names: pass line or point names, constr
      applied on them
  • axis (str) – load axis, ‘x’ or ‘y’
  • val (float) – displacement value, defaults to 0.0, only needs to be set when ltype = ‘displ’
set_contact_linear(master_lines, slave_lines, kval, many_si=False)[source]

Sets contact between master and slave lines.

Slave lines are on the more compliant or more curved object.

Parameters:
  • master_lines (list) – list of SignLine or SignArc
  • slave_lines (list) – list of SignLine or SignArc
  • kval (float) – stiffness, 5 to 50 times the youngs modulus of the touching matl
  • many_si (bool) – True, make unique surface interaction for every contact False, use existing surface interaction if we can
set_ediv(items, ediv)[source]

Sets the number of elements on the passed line.

Parameters:
  • items (str or SignLine or SignArc or list) –

    lines to set ediv on

    • str: ‘L0’
    • list of str [‘L0’, ‘L1’]
    • list of SignLine or SignArc part.bottom or part.hole[-1]
  • ediv (int) – number of elements to mesh on the line
set_eshape(eshape='quad', eorder=2)[source]

Sets the element shape and order to use when meshing the model.

Parameters:
  • eshape (str) –

    element shape

    • ’quad’: quadrilaterials
    • ’tri’: triangles
  • eorder (int) –

    element order, default=2

    • 1: corner nodes only (3 and 4 noded elements)
    • 2: corder nodes and midside nodes (6 and 8 noded elements)
set_esize(items, esize)[source]

Sets the element size on the passed line.

Parameters:
  • items (str or SignLine or SignArc or list) –

    lines or points to set esize on

    • str: ‘L0’
    • list of str [‘L0’, ‘L1’, ‘P3’]
    • list of SignLine or SignArc part.bottom or part.hole[-1]
  • esize (float) – size of the mesh elements on the line
set_etype(etype, items, thick=None)[source]

Sets the element type, and thickness on areas or parts.

Parameters:
  • etype (str) –

    element type

    • ’plstress’: plane stress
    • ’plstrain’: plane strain
    • ’axisym’: axisymmetric
  • items (str or Area or Part or list) –

    set element type on these

    • str: string name of Area or Part item. Example: ‘A0’, ‘PART0’
    • Area: set element type on the elements in this area
    • Part: set element type on the elements in this part
    • list of Area or Part: set element type on their elements
  • thick (float or None) –

    element thickness

    • None: default, used for axisymmetric element type
    • float: thickness value to use for plane stress or plane
      strain elements
set_fluid_press(items, rho, g, xo, po)[source]

This sets a fluid presure load on items.

This fluid pressure is dependednt on the x axis. g must be positive.

  • P = f(x)
  • P(xo) = po
  • P(x) = po + rho*g*(xo - x)
Parameters:
  • items (str or Line or Arc or list) –

    items to set pressure on

    • str: string name of Line or Arc item, for example ‘L0’
    • Line or Arc: set presssure on this
    • list or Line or Arc: set pressure on these
  • rho (float) – fluid density in mass/volume
  • g (+float) – gravity in dist/(t^2), MUST BE POSITIVE
  • xo (float) – sea level height, MUST BE POSITIVE
  • po (float) – sea level pressure, MUST BE POSITIVE
set_gravity(grav, items)[source]

Sets gravity on the elements in items.

Assumes gravity acts in the -x direction with magnitude grav.

Parameters:
  • grav (float) – gravity acceleration, MUST BE POSTIVE
  • items (Area or Part or list) –

    items gravity acts on

    • Area: gravity acts on elements in this area
    • Part: gravity acts on elements in this part
    • list of Part or Area: gravity acts on their elements
set_load(ltype, items, lval, ldir=None)[source]

Sets a pressure or force load on line(s).

The force load is divided by the number of nodes and applied on each node.

The pressure load is applied to the child faces under the line. Positive is compression, negative is tension.

Parameters:
  • ltype (str) – ‘press’ or ‘force’
  • items (str or Line or Arc or list) –

    items to set load on

    • str: string name of Line or Arc item, for example ‘L0’
    • Line or Arc: set load on this
    • list or Line or Arc: set load on these
  • lval (float) –

    load value.

    • For ltype = ‘press’ this is in force/area units
    • For ltype = ‘force’ this is in force units
  • ldir (None or str) –

    load direction. Defaults to None

    • str: when ltype=’load’, we need to set ldir to ‘x’ or ‘y’
    • None: when ltype=’press’
set_matl(matl, items)[source]

Sets the material on Part or Area items.

Parameters:
  • matl (Material) – material to assign to items
  • items (Part or Area or list) –

    items that will have matl assigned

    • Part: assign matl to this
    • Area: assign matl to this
    • list of Area or Part: assign matl to these
set_radps(radps, items)[source]

Sets radians per second rotation load on the items.

Parameters:
  • radps (float) – radians per second
  • items (Area or Part or list) –

    items rotation acts on

    • Area: rotation acts on elements in this area
    • Part: rotation acts on elements in this part
    • list of Part or Area: rotation acts on their elements
set_rpm(rpm, items)[source]

Sets rpm rotation load on the items.

Parameters:
  • rpm (float) – rotation per minute
  • items (Area or Part or list) –

    items rotation acts on

    • Area: rotation acts on elements in this area
    • Part: rotation acts on elements in this part
    • list of Part or Area: rotation acts on their elements
set_time(time)[source]

Sets the time in the FeaModel (preprocessor).

This time is used when setting loads.

Parameters:time (float) – the time to set
set_units(dist_unit='m', cfswitch=False)[source]

Sets the units that will be displayed when plotting.

Picks a unit set based on the passed distance unit. That unit set is printed to the console when set. Defaults to MKS units (meter-kilogram-second)

Distance Force Stress Temperature Density Time
‘m’ ‘N’ ‘Pa’ ‘K’ ‘kg/(m^3)’ ‘s’
‘mm’ ‘N’ ‘MPa’ ‘K’ ‘tonne/(mm^3)’ ‘s’
‘in’ ‘lbf’ ‘psi’ ‘R’ ‘slinch/(in^3)’ ‘s’
‘ft’ ‘lbf’ ‘psf’ ‘R’ ‘slug/(ft^3)’ ‘s’

See get_units method or returning text strings based on unit types.

Parameters:
  • dist_unit (str) –

    string of distance unit. Options:

    • ’m’: meter
    • ’mm’: milimeter
    • ’in’: inch
    • ’ft’: foot
  • cfswitch (bool) –

    Celsius/Fahrenheit temperature switch. Default is False.

    If True, this switches temperature from K–>C or from R–>F Default keeps units as shown in above table.

pycalculix.geometry module

This module stores geometry classes, which are used to make parts.

class pycalculix.geometry.Arc(start_pt, end_pt, actr)[source]

Bases: pycalculix.base_classes.Idobj

Makes an arc from points start_pt to end_pt about center actr.

Arcs should be 90 degrees maximum.

Parameters:
  • start_pt (Point) – first point
  • end_pt (Point) – second point
  • actr (Point) – arc center
points

list of the line’s points [start_pt, end_pt]

Type:list of Point
allpoints

[start_pt, end_pt, actr]

Type:list of Point
actr

arc center

Type:Point
radius

radius of the arc

Type:float
concavity
  • ‘concave’: concave arc
  • ‘convex’: convex arc
Type:str
midpt

a mid-point between p1 and p2

Type:Point
ediv

number of elements on arc

Type:None or int
nodes

a list of meshed nodes on the line

Type:list of Node
edge

True if arc is a non-shared edge in an area

Type:bool
signlines

list of SignArc that use this Arc

Type:list
add_signline(signline)[source]

Adds a signline to self.signlines.

allpoints

Returns all points including arc center

areas

Returns all areas that signlines use.

coincident(pt)[source]

Checks to see if pt is on the arc.

Parameters:pt (Point) – input point to check
Returns:True if pt on arc or False if not
Return type:bool
get_ang()[source]

Returns angle from beginning to end of arc from arc ctr in degrees

Notes

Answer is between 180 and -180 Positive is concave Negative is convex

get_ang_rad()[source]

Returns angle from beginning to end of arc from arc ctr in rad

Notes

Answer is between pi and -pi Positive is concave Negative is convex

get_concavity(clockwise=True)[source]

Returns concavity of this arc, ‘concave’ or ‘convex’.

get_name()[source]

Returns the arc name.

get_perp_vec(pt)[source]

Returns vector perpendicular to current arc.

Right hand rule is used:
X+ is the direction of the arc from start to end. Z+ is out of the page Y+ is the direction of the perpendicular vector
Parameters:pt (Point) – point on arc where we want the perpendicular vector
Returns:perpendicular vector
Return type:resv (Point)
get_pt_at(nondim)[source]

Returns point on arc between start and end point at nondim dist.

Parameters:nondim (float) – distance between start and end point, 0=start, 1=end
Returns:requested point on arc
Return type:res (Point)
get_tan_vec(point)[source]

Returns vector tangent to the current arc.

Vector points from the passed point to a unit location further away.

Parameters:point (Point) – start point
Returns:vector that is tangent to the current line
Return type:resv (Point)
get_verts_codes(plot=True)[source]

Returns a list of [verts, codes] vertices for plotting.

intersects(other)[source]

Checks if other line intersects this arc.

Parameters:other (Line or Arc) – other line to check
Returns:Point: intersection point None: None if lines don’t intersect
Return type:Point or None
length()[source]

Returns the length of the arc.

mid()[source]

Caclulates and returns the midpoint of the arc.

pt(ind)[source]

Returns the start or end point of the arc.

Parameters:ind (int) – index of the point we want, 0=start, 1=end
Returns:requested Point
Return type:Point
reverse()[source]

Reverses self.

save_to_points()[source]

This stores this line in the line’s child points.

set_ediv(ediv)[source]

Sets the number of element divisions on the arc when meshing.

Parameters:ediv (int) – number of required elements on this arc
set_esize(esize)[source]

Sets the size of mesh elements on the arc when meshing.

Parameters:esize (float) – size of mesh elements on this arc
set_pt(ind, point)[source]

Update the arc’s point at ind to the new point.

Parameters:
  • ind (int) – index of the point we’re updating, 0=start, 1=end
  • point (Point) – new point we are assigning to Line
static sgn(val)[source]

Returns sign of the passed value.

Helper function for self.interects code.

Parameters:val (float) – passed value
Returns:sign of the passed value, assumes sign of zero = 1
Return type:1 or -1
signed_copy(sign)[source]

Returns a SignArc instance of this Arc with the passed sign.

touches(other)[source]

Checks if this arc is connected to a passed line.

Parameters:other (Line or Arc) – passed other line
Returns:beginning or end point connect to other line False: lines are not connected
Return type:True
class pycalculix.geometry.Area(part, line_list=[])[source]

Bases: pycalculix.base_classes.Idobj

Makes an area.

Area is closed in a clockwise direction.

Parameters:
  • part (Part) – parent Part
  • line_list (list) – list of Lines and Arcs that close the area
part

parent part

Type:Part
closed

True if closed, False if not

Type:boolean
exlines

LineLoop of signlines that define the area exterior

Type:LineLoop
signlines

list of signed lines or arcs that define the area

Type:list
lines

a list of all the lines that make the area, includes hole lines

Type:list
points

a list of all points making the area, excludes arc centers

Type:list
allpoints

a list of all points, includes arc centers

Type:list
holepoints

a list of hole points, excludes arc centers

Type:list
matl

the material fo the area

Type:Matl
etype

element type of area. Options are: ‘plstress’: plane stress ‘plstrain’: plane strain ‘axisym’: axisymmetric

Type:str
area

in-plane part area (ballpark number, arcs not calc right)

Type:double
holes

list of LineLoop of signlines

Type:list
center

the area centroid point. None before closed.

Type:Point or None
nodes

child mesh nodes that are in the area

Type:list
elements

child elements that are in the area

Type:list
add_hole_sline(signline)[source]

Adds signline to the area hole definition.

Line is added to the end of the lines list. Area is closed if needed.

Returns:boolean telling if the hole was closed
Return type:closed (bool)
add_sline(signline)[source]

Adds signline to the area definition.

SignLine is added to the end of the lines list. Area is closed if needed.

allpoints

Returns a list of all points under this area; includes arc centers.

calc_area_center()[source]

Calculates and returns the area and centroid Point.

Returns:[area, Point]
Return type:list
close()[source]

Closes the area.

contains_point(point)[source]

Returns bool telling if pt is inside the area.

Parameters:pt (Point) – point we are checking
Returns:True if in this area False if not
Return type:contains (bool)
get_maxlength()[source]

Returns max distance between points in an area.

get_name()[source]

Returns the area name.

get_patch()[source]

Returns a patch of the area.

holepoints

Returns a list of all points in this area’s holes.

label(axis)[source]

Labels the area on a Matplotlib axis

Parameters:axis (Matplotlib Axis) – Matplotlib Axis
line_from_startpt(pt)[source]

Returns the signline in the area that start at the passed pt.

Parameters:pt (Point) – the start point of the line one wants
Returns:
Returns None if no line is found, otherwise the correct line or
arc which starts with pt will be
returned.
Return type:match (None or SignLine or SignArc)
line_insert(lgiven, lnew, after=True)[source]

Inserts line lnew before or after the given line.

Parameters:
  • lgiven (SignLine or SignArc) – the line we are inserting relative to
  • lnew (SignLine or SignArc) – the new line we will insert
  • after (bool) – if True insert lnew after lgiven, false insert before
Returns:

True if succeeded, False if failed

Return type:

bool

lines

Returns a list of all Line and Arc under this area.

plot(axis, label=True, color='yellow')[source]

Plots the area on a Matplotlib axis.

Parameters:
  • axis (Matplotlib axis) – Matplotlib axis
  • label (bool) – if True, label area
points

Returns a list of all points under this area; excludes arc centers.

rem_sline(sline)[source]

Removes a sline from this area.

set_child_ccxtypes()[source]

Assigns the child element ccx types.

set_esize(esize)[source]

Sets the size of mesh elements on the area when meshing.

Parameters:esize (float) – size of mesh elements on this area
set_etype(etype)[source]

Sets the area etype.

Sets the ccxtype on elements if they have been assigned to this area.

Parameters:etype (str) – element type ‘plstress’ plane stress ‘plstrain’: plane strain ‘axisym’: axisymmetric
signlines

Returns a list of all SignLine and SignArc under this area.

update(line_list)[source]

Updates the area’s external lines to the passed list.

If the area is cosed, self.close() will be called.

Parameters:line_list (list) – list of SignLine and SignArc items
class pycalculix.geometry.Line(start_pt, end_pt)[source]

Bases: pycalculix.base_classes.Idobj

Stores a line from points start_pt to end_pt.

Parameters:
  • start_pt (Point) – first point
  • end_pt (Point) – second point
points

list of the line’s points [start_pt, end_pt]

Type:list of Point
ediv

number of elements on the line

Type:None or float
midpt

a mid-point between start_pt and end_pt

Type:Point
nodes

a list of meshed nodes on the line

Type:list of Node
edge

True if line is a non-shared edge in an area

Type:bool
signlines

list of SignLine that use this Line

Type:list
add_signline(signline)[source]

Adds a signline to self.signlines.

allpoints

Returns all line defining points.

arc_tang_intersection(point, mag)[source]

Returns an intersection point on this line of an arc at center point

Parameters:
  • point (Point) – arc center point
  • mag (float) – passed radius distance from the arc center to the line
Returns:

Point: the intersection point None: returns None if no intersection point exists

Return type:

newpt (Point or None)

areas

Returns all areas that signlines use.

coincident(point)[source]

Checks to see if point is on the line.

Parameters:point (Point) – input point to check
Returns:True if point on line or False if not
Return type:bool
get_abc()[source]

Returns a list of abc terms for a line definition.

ax + by + c = 0

Returns:list of the above line terms
Return type:[a, b, c]
get_name()[source]

Returns the line name.

get_perp_vec(point=None)[source]

Returns vector perpendicular to current line.

Vector is created by rotating the current line ccw 90 degrees around the start point.

Parameters:point (Point) – defaults to None, unused for Line, used for Arc
Returns:vector that is perpendiculat to the current line
Return type:lvect (Point)
get_tan_vec(point)[source]

Returns vector tangent to the current line.

Vector points from the passed point to a unit location further away.

Parameters:point (Point) – start point
Returns:vector that is tangent to the current line
Return type:lvect (Point)
intersects(other)[source]

Checks if other line intersects this line.

Parameters:other (Line, Arc, Signline, SignArc) – other line to check
Returns:Point: intersection point None: None if lines don’t intersect
Return type:Point or None
length()[source]

Returns the length of the line.

mid()[source]

Calculates and returns a midpoint between start and end points.

offset(dist)[source]

Returns a new line offset from the dirrent line by value dist.

Right hand rule is followed assuming x is the origina line. Z points out of page. Y is the direction of line offset.

Parameters:dist (float) – distance to offset the new line by
Returns:new Line which is offset from self by dist
Return type:tmpline (Line)
pt(ind)[source]

Returns the start or end point of the line.

Parameters:ind (int) – index of the point we want, 0=start, 1=end
Returns:requested Point
Return type:Point
reverse()[source]

Reverses self.

save_to_points()[source]

This stores this line in the line’s child points.

set_ediv(ediv)[source]

Sets the number of element divisions on the line when meshing.

Parameters:ediv (int) – number of required elements on this line
set_esize(esize)[source]

Sets the size of mesh elements on the line when meshing.

Parameters:esize (float) – size of mesh elements on this line
set_pt(ind, point)[source]

Update the line’s point at ind to the new point.

Parameters:
  • ind (int) – index of the point we’re updating, 0=start, 1=end
  • point (Point) – new point we are assigning to Line
signed_copy(sign)[source]

Returns a SignLine copy of this Line with the passed sign.

touches(other)[source]

Checks if a line is connected to a passed line.

Parameters:other (Line or Arc) – passed other line
Returns:beginning or end point connect to other line False: lines are not connected
Return type:True
class pycalculix.geometry.LineLoop(items=[], hole_bool=False, parent=None)[source]

Bases: list

Makes a LineLoop, which stores multiple Line/Arc or SignLine/SignArc.

Parameters:
  • items (list) – Line or Arc or SignLine or SignArc
  • hole_bool (bool) – True if hole, False otherwise
  • parent (Area or None) – parent Area, defaults to None
closed

True if closed

Type:bool
area

the loop’s area, can be pos or neg. Pos = cw, neg = ccw

Type:float
hole

True if loop is a hole

Type:bool
ccw

True if loop is counter-clockwise

Type:bool
center

a point at the loop centroid

Type:Point
parent

the loop’s parent Area

Type:Area or None
append(item)[source]

Adds an item to this LineLoop

Parameters:item (SingArc or SignLine) – item to add to the list
area

Returns the loop’s signed area.

Returns 0 if not closed. Pos = cw, neg = ccw

Formula from: http://mathworld.wolfram.com/PolygonArea.html

ccw

Returns bool telling if the area is closed and clockwise.

center

Returns None or a Point at the line loop’s center.

closed

Returns True if Closed, False if not.

contains_point(point)[source]

Returns bool telling if pt is inside the LineLoop.

Parameters:pt (Point) – point we are checking
Returns:True if in this area False if not
Return type:contains (bool)
get_patch()[source]

Returns a patch of the LineLoop, or None of not closed.

insert(index, item)[source]

Inserts a SignLine or SignArc item into this LineLoop

Parameters:item (SingArc or SignLine) – item to insert
inside(other)[source]

Checks to see if self is inside other.

Only checks self’s points.

remove(item)[source]

Removes an SignLine or SignArc item from this LineLoop

Parameters:item (SignArc or SignLine) – item to remove
reverse()[source]

Reverse the loop direction cw<–>ccw

This modifies the order of lines, and flips each line.

set_id(id)[source]

Sets the id number

set_parent(parent)[source]

Sets the line loop’s parent part.

class pycalculix.geometry.Point(x, y, z=0)[source]

Bases: pycalculix.base_classes.Idobj

Makes a point or vector.

Parameters:
  • x (float) – vertical coordinate of point
  • y (float) – horizontal coordinate of point
  • z (float) – in-page coordinate of point, defaults to zero
x

vertical coordinate of point

Type:float
y

horizontal coordinate of point

Type:float
z

in-page coordinate of point, defaults to zero nodes (Node): a list of nodes in a mesh at this point. List length is 1.

Type:float
nodes

list of nodes under point

Type:list
lines

set of lines which use this point

Type:set
arc_center

True if this point is an arc center

Type:bool
ang_bet_deg(other)[source]

Returns angle between self and other vector in degrees.

Assumes vectors start at 0,0

Parameters:other (Point) – passed vector
Returns:degrees between self vector and other vector
Return type:angle (float)
ang_bet_rad(other)[source]

Returns angle between self and other vector in radians.

Assumes vectors start at 0,0

Parameters:other (Point) – passed vector
Returns:radians between self vector and other vector
Return type:angle (float)
ang_deg()[source]

Returns angle in degrees, assume point is vector from 0,0.

ang_rad()[source]

Returns angle in radians, assume point is vector from 0,0.

axrad()[source]

Returns a tuple of (ax, rad) for plotting.

get_name()[source]

Returns item name.

label(axis)[source]

Labels the point on a Matplotlib axis.

Parameters:axis (Matplotlib Axis) – Matplotlib Axis
length()[source]

Returns the length of this point or vector.

make_unit()[source]

Modifies self vector to make it a unit vector.

plot(axis, label=True)[source]

Plots the point on the passed matplotlib axis.

Parameters:
  • axis (Matplotlib axis) – plate to plot the point
  • pnum (bool) – True turns on point labeling
radax()[source]

Returns a tuple of (rad, ax) for checking if inside.

rot_ccw_deg(ang)[source]

Rotates the current vector by ccw degrees about 0,0. Returns self.

Parameters:ang (float) – angle or rotation in degrees, counter-clockwise (ccw)
set_esize(size)[source]
set_line(line)[source]

Saves the line or arc in the point.

unset_line(line)[source]

Removes the line or arc in the point.

class pycalculix.geometry.SignArc(parent_line, sign)[source]

Bases: pycalculix.geometry.Arc, pycalculix.base_classes.Idobj

Makes a signed arc.

line

parent arc

Type:Arc
sign

1 = positive, or -1 = negative

Type:int
lineloop

parent LineLoop, default is None

Type:None or LineLoop
nodes

nodes on the arc

Type:list
faces

list of element faces

Type:list
n1

list of first order nodes on line

Type:list
actr

Return the arc center.

concavity

Return the arc’s concavity ‘concave’ or ‘convex’

edge

Returns a bool saying if this is an edge line.

get_name()[source]

Returns the line name.

label(ax)[source]

Labels the arc on the matplotlib ax axis.

Parameters:ax (Matplotlib axis) – Matplotlib axis
midpt

Return the mid point.

nodes

Gets the line nodes.

plot(ax, label=True)[source]

Draws and labels the arc onto the passed Matplotlib axis.

Parameters:
  • ax – Matplotlib axis
  • label (bool) – if True, label the arc
points

Return a list of the arc’s points [pstart, pend]

pt(ind)[source]

Returns the point at the start or end of the line.

radius

Return the arc radius.

reverse()[source]

Reverses self.line

set_ediv(ediv)[source]

Apply the element divisions onto the parent line.

set_esize(esize)[source]

Applies the element size onto the parent line.

set_lineloop(lineloop)[source]

Sets the parent LineLoop

set_pt(ind, point)[source]

Sets the passed point to at the index location.

signed_copy(sign)[source]

Returns a SignArc copy of this arc.

class pycalculix.geometry.SignLine(parent_line, sign)[source]

Bases: pycalculix.geometry.Line, pycalculix.base_classes.Idobj

Makes a signed line.

line

parent line

Type:Line
sign

1 = positive, or -1 = negative

Type:int
lineloop

parent LineLoop, default is None

Type:None or LineLoop
faces

list of element faces

Type:list
n1

list of first order nodes on line

Type:list
nodes

nodes on the line

Type:list
edge

Returns a bool saying if this is an edge line.

get_name()[source]

Returns the SignLine name.

label(ax)[source]

Labels the line on the matplotlib ax axis.

Parameters:ax (Matplotlib axis) – Matplotlib axis
midpt

Returns the mid point.

nodes

Gets the line nodes.

plot(ax, label=True)[source]

Draws and labels the line onto the passed Matplotlib axis.

Parameters:
  • ax (Matlotlib axis) – Matplotlib axis
  • label (bool) – if True label the line
points

Returns a list of the line’s points [pstart, pend]

pt(index)[source]

Returns the point at the start or end of the line.

Parameters:index (int) – 0 = start point, 1 = end point
reverse()[source]

Reverses self.line

set_ediv(ediv)[source]

Applies the element divisions onto the parent line.

set_esize(esize)[source]

Applies the element size onto the parent line.

set_lineloop(lineloop)[source]

Sets the parent LineLoop

set_pt(index, point)[source]

Sets the start or end point of the line to a new point.

Parameters:
  • index (int) – 0 for start point, 1 for end point
  • point (Point) – the new point we are updating to
signed_copy(sign)[source]

Returns a SignLine copy of this line.

pycalculix.geometry.get_text_hv(angle)[source]

Returns (ha, va) text horizontal and vertical alignment for line label.

This makes the line label text inside its area, assuming areas closed CW.

Parameters:angle (float) – line normal vector in degrees, between 180 and -180

pycalculix.installer module

pycalculix.installer.add()[source]

Installs the fea tools on windows/mac/linux

Finds all dlls in folder_from and adds hard links to them in folder_to Or removes the hard links if add=False

pycalculix.installer.find_brew_binary_location(package_folder, search_string)[source]

Finds the location of a binary installed by homebrew

pycalculix.installer.get_direct_url(url, headers)[source]

Gets the zip direct download link from the project download page

Returns the url for a link with link_text description, if this function fails, it raises an error with tells the users a link which creates an issue on the pycalculix repo

pycalculix.installer.mac_add()[source]

Adds ccx and gmsh programs on mac, uses brew

pycalculix.installer.mac_add_ccx()[source]
pycalculix.installer.mac_remove()[source]

Removes ccx and gmsh programs on mac, uses brew

pycalculix.installer.printos(os, bits)[source]

Prints the operating system and bit size

pycalculix.installer.remove()[source]

Removes the fea tools on windows/mac/linux

pycalculix.installer.remove_like(search_path, name)[source]

Searches for files or folders matching name in search_path and deletes them

pycalculix.installer.ubuntu_add()[source]

Adds ccx and gmsh programs on ubuntu, uses apt

pycalculix.installer.ubuntu_remove()[source]

Removes ccx and gmsh programs on ubuntu, uses apt

pycalculix.installer.win_add_ccx(bitsize, binaries_url, program_name)[source]

Installs ccx on a windows computer

pycalculix.installer.win_add_gmsh(bitsize, binaries_url, program_name, version_str)[source]

Installs a program from an apache server file listing page

pycalculix.installer.windows_add(bitsize)[source]

Adds ccx and gmsh programs on windows

pycalculix.installer.windows_remove(bitsize)[source]

Removes ccx and gmh programs on windows

pycalculix.installer.zipfile_by_bitsize(binaries_url, headers, zipfile_regex, bitsize)[source]

Returns the url linking to the correct zipfile

pycalculix.loads module

This module stores load classes.

class pycalculix.loads.ConstLoad(ltype, comp, val)[source]

Bases: object

Makes a load. Many types are supported.

Possible load types:
  • forces
  • displacements
  • thickness (on nodes)
  • matl (on elements)
  • pressure (or stress on faces)
  • gravity (on elements)
  • rotation about an axis (on elements)
Parameters:
  • ltype (string) –

    load type:

    • ’fx’,’fy’,’fz’: force on each axis
    • ’ux’,’uy’,’uz’: displacement on each axis
    • ’nodal_thickness’: thickness on element nodes
    • ’matl’: matl on elements
    • ’press’: pressure, + is tension, - is compresion
    • ’gravity’: gravity in x axis direction, - goes towards y axis
    • ’radps’: radians per second rotation
    • ’rpm’: rotations per minute rotation
  • comp (Component) – component that the load is applied to
  • val (double or Matl) – value of the load Matl is needed when setting material loads otherwise a double value is used to describe the load
ccx()[source]

Writes a load for Calculix ccx solver.

Returns a list strings, where each item is a line to write to a Calculix .inp text file.

get_list()[source]

Returns a list of [item, val] for plotting.

class pycalculix.loads.LinearLoad(ltype, comp, const, mult, xo, axis='x')[source]

Bases: object

Makes a load which varies depending on x, y, or z location.

Load Equation:
Load(x) = const + mult*(xo - x)

This load is used to set water pressure, where p = po + rho*g*(xo - x) For water pressure this becomes:

  • P(x) = po + (rho*g)*(xo-x)
  • P(x) = po + mult*(xo-x)
  • g is positive, xo > x
Parameters:
  • ltype (str) – load type ‘press_fluid’ is the only valid option
  • comp (Component) – component that the load acts on
  • const (float) – constant term in load equation
  • mult (float) – mult term in the load equation
  • xo (float) – xo term in the load equation
  • axis (str) – axis that the load depends on ‘x’ or ‘y’ are valid options
ccx()[source]

Writes a load for Calculix ccx solver.

Returns a list strings, where each item is a line to write to a Calculix .inp text file.

get_list()[source]

Returns a list of [item, val] for plotting.

get_val(xval)[source]

Returns the load function value at the given location.

Parameters:xval (float) – the location where we want to find the load

pycalculix.material module

This module stores material classes.

class pycalculix.material.Material(name)[source]

Bases: pycalculix.base_classes.Idobj

Makes a linear elastic meterial.

Parameters:name (str) – a unique matl name
- id

material id number

Type:int
- mechtype

defines mechanical material type: linear or non-linear material

Type:str
- density

density in mass/volume units

Type:float
- pratio

poisson’s ratio (unitless)

Type:float
- youngs

young’s modulus in Force/area = stress units

Type:float
- mechtpye

mechanical material type options: ‘linear’ or ‘nonlinear’

Type:str
- exponent

exponent of Ramberg-Osgood stress-strain equation

Type:float
- yield_stress

yield stress of material

Type:float
- yield_offset

yield offset of Ramberg-Osgood stress-strain equation

Type:float
- conductivity

thermal conductivity, Power / (distance-temp)

Type:float
- spec_heat

specific heat (energy/(mass-temp)

Type:float
- thermal_exp

a dict storing temperature dependent thermal – expansion properties

– Thermal expansion is in strain per temperature

  • dict[‘data’] = zip of (temp, thermal_expansion)
  • dict[‘tzero’] = the temperature zero point
Type:dict
ccx()[source]

Returns a list of text strings for ccx defining the material.

set_mech_props(density, youngs, pratio, mechtype='linear', exponent=0.0, yield_stress=0.0, yield_offset=0.0)[source]

Sets the mechanical properties: density, youngs, poisson_ratio.

Parameters:
  • density (-) – density in mass/volume units
  • pratio (-) – poisson’s ratio (unitless)
  • youngs (-) – young’s modulus in Force/area = stress units
Kargs:
  • mechtpye (str): mechanical material type options: ‘linear’ or ‘nonlinear’
  • exponent (float): exponent of Ramberg-Osgood stress-strain equation
  • yield_stress (float): yield stress of material
  • yield_offset (float): yield offset of Ramberg-Osgood stress-strain equation
set_therm_expan(alphas, temps=None, tzero=None)[source]

Sets the thermal expansion of the material.

Parameters:
  • alphas (-) – list of thermal expansion alphas length must be the same as the passed temps
  • temps (-) – list of temperatures
  • tzero (-) – temperature zero point
set_therm_props(conductivity, spec_heat)[source]

Sets the thermal properties: conductivity, specifc_heat.

Parameters:
  • conductivity (-) – Power / (distance-temp)
  • spec_heat (-) – specific heat (energy/(mass-temp)

pycalculix.mesh module

This module stores classes that make a finite element analysis mesh.

class pycalculix.mesh.Element(enum, ccxtype, nlist)[source]

Bases: object

Makes a mesh element.

Supports 4 noded quads, 8 noded quads, 3 noded tris, 6 noded tris.

Parameters:
  • enum (int) – element id number
  • ccxtype (str) –

    ccx element type string, 4 characters long

    Description: element_shape + element_order + element_type

    • element_shape = ‘quad’ or ‘tri’
      • ’quad’ = quadrangle
      • ’tri’ = triangle
    • element_order = ‘1’ or ‘2’
      • ‘1’ = corner nodes only (3 or 4 noded element)
      • ‘2’ = corner nodes and midside nodes (6 or 8 noded element)
    • element_type = ‘plstress’ or ‘plstrain’ or ‘axisym’
      • ’plstress’ = plane stress
      • ’plstrain’ = plane strain
      • ’axisym’ = axisymmetric
    axisymmetric
    • ’CAX6’ : ‘tri2axisym’
    • ’CAX3’ : ‘tri1axisym’
    • ’CAX8’ : ‘quad2axisym’
    • ’CAX4’ : ‘quad1axisym’
    plane stress
    • ’CPS6’ : ‘tri2plstress’
    • ’CPS3’ : ‘tri1plstress’
    • ’CPS8’ : ‘quad2plstress’
    • ’CPS4’ : ‘quad1plstress’
    plane strain
    • ’CPE6’ : ‘tri2plstrain’
    • ’CPE3’ : ‘tri1plstrain’
    • ’CPE8’ : ‘quad2plstrain’
    • ’CPE4’ : ‘quad1plstrain’
  • nlist (list) – list of Node, the nodes that define the element
id

element id number

Type:int
ccxtype

ccx element type string, 4 characters long

Description: element_shape + element_order + element_type

  • element_shape = ‘quad’ or ‘tri’
    • ‘quad’ = quadrangle
    • ‘tri’ = triangle
  • element_order = ‘1’ or ‘2’
    • ‘1’ = corner nodes only (3 or 4 noded element)
    • ‘2’ = corner nodes and midside nodes (6 or 8 noded element)
  • element_type = ‘plstress’ or ‘plstrain’ or ‘axisym’
    • ‘plstress’ = plane stress
    • ‘plstrain’ = plane strain
    • ‘axisym’ = axisymmetric
axisym
  • ‘CAX6’ : ‘tri2axisym’
  • ‘CAX3’ : ‘tri1axisym’
  • ‘CAX8’ : ‘quad2axisym’
  • ‘CAX4’ : ‘quad1axisym’
plane stress
  • ‘CPS6’ : ‘tri2plstress’
  • ‘CPS3’ : ‘tri1plstress’
  • ‘CPS8’ : ‘quad2plstress’
  • ‘CPS4’ : ‘quad1plstress’
plane strain
  • ‘CPE6’ : ‘tri2plstrain’
  • ‘CPE3’ : ‘tri1plstrain’
  • ‘CPE8’ : ‘quad2plstrain’
  • ‘CPE4’ : ‘quad1plstrain’
Type:str
node

dictionary of nodes, keys are int >= 1

Type:dict
face

dictionary of faces, keys are int >= 1

Type:dict
nodes

list of element nodes

Type:list
faces

list of element faces

Type:list
center

the center point of the element

Type:Point
calc_center()[source]

Returns the element center as a Point.

ccx()[source]

Returns text string defining the element for a ccx input file.

faces

Returns list of element faces.

get_area()[source]

Returns the element area.

get_name()[source]

Returns the element name based on id number.

get_poly()[source]

Returns a polygon of the element.

get_tris()[source]

Returns a list of triangles for plotting. Triangles are node ids.

CCX elements are closed in a CCW direction relative to xy normal CCX elements are closed in a CW direction relative to yx mine —> I have to draw in a clockwise direction, otherwise get error Triangles are closed in a counter clockwise (CCW) direction to yx mine http://matplotlib.org/api/tri_api.html#matplotlib.tri.Triangulation

label(ax)[source]

Labels the element on the passed matplotlib axis.

nodes

Returns list of element nodes.

set_ccxtype(etype)[source]

Sets the ccx element type given an etype string.

Parameters:etype (string) –

element type string

  • ’plstress’ = plane stress
  • ’plstrain’ = plane strain
  • ’axisym’ = axisymmetric
class pycalculix.mesh.Face(fnum, node1, node2, element)[source]

Bases: object

Makes an element face.

Parameters:
  • fnum (int) – element face number
  • node1 (Node) – first node
  • node2 (Node) – second node
  • element (Element) – parent element
id

element face number

Type:int
nodes

list of nodes [node1, node2]

Type:list
nmid

midside node, defaults to None

Type:Node or None
element

parent element

Type:Element
ext

stores if face is external

Type:bool
get_mnorm()[source]

Returns a list: [midpoint, normal_vector]

Returns:face midpoint norm_vect (Point): face normal vector, it is a unit vector
Return type:midpoint (Point)
length()[source]

Return the length of the face.

set_ext()[source]

Sets the ext boolean flag to True. Face is external.

set_nmid(nmid)[source]

Sets the face midside node, nmid.

Parameters:nmid (Point) – passed node to set as the face midside node
class pycalculix.mesh.Node(node_num, x, y, z)[source]

Bases: object

Makes a mesh node.

Parameters:
  • node_num (int) – node number
  • x (float) – x-coordinate
  • y (float) – y-coordinate
  • z (float) – z-coordinate
id

node number

Type:int
x

x-coordinate

Type:float
y

y-coordinate

Type:float
z

z-coordinate

Type:float
order

1 or 2, 1 if it is a corner node, 2 if it is a midside node

Type:int
elements

a set of elements that contain this node

Type:set
faces

a set of faces that contain this node

Type:set
add_element(element)[source]

Adds an element to this node’s set of elements.

Parameters:element (Element) – element to add to set self.elements
add_face(face)[source]

Adds a face to this node’s set of faces.

Parameters:face (Face) – face to add to set self.faces
ccx()[source]

Returns a string defining the node for a ccx inp file.

get_name()[source]

Returns the string node name.

label(ax)[source]

Labels the node on the passed Matplotlib axis.

set_order(order)[source]

Sets the node order, must be 1 or 2.

Parameters:order (int) – node order, 1 is corner node, 2 is midside node

pycalculix.partmodule module

This module stores the Part class. It is used to make 2D parts.

class pycalculix.partmodule.Part(feamodel)[source]

Bases: pycalculix.base_classes.Idobj

This makes a part.

Parameters:parent – parent FeaModel
__fea

parent FeaModel

Type:FeaModel
points

list or part points, excludes arc centers

Type:list
allpoints

list or part points, includes arc centers

Type:list
lines

list of all Line and Arc that make the part

Type:list
signlines

list of all SignLine and SignArc that make the part

Type:list
__cursor

location of a cursor drawing the part

Type:Point
__holemode

if True, lines will be added to holes, otherwise, they’ll be added to areas

Type:bool
areas

list of Area that make up the part

Type:list
left

list the parts leftmost lines, they must be vertical

Type:list
right

list the parts rightmost lines, they must be vertical

Type:list
top

list the parts top lines, they must be horizontal

Type:list
bottom

list the parts bottom lines, they must be horizontal

Type:list
center

the area centroid of the part

Type:Point
nodes

list of part’s nodes

Type:list
elements

list of part’s elements

Type:list
allpoints

Returns list of part points, includes arc centers.

chunk(mode='both', exclude_convex=True, debug=[0, 0])[source]

Chunks all areas in the part.

Parameters:
  • mode (str) –

    area chunking mode

    • ’both’: cuts areas using holes and exterior points
    • ’holes’: cut areas using holes points only
    • ’ext’: cut areas using exterior points only
  • exclude_convex (bool) – If true exclude cutting convex tangent points
draw_arc(end_x, end_y, center_x, center_y)[source]

Makes an arc and adds it to the part.

Current point is the first arc point.
(end_x, end_y) is the end point
(center_x, center_y) is the arc center
Degrees: Traversed angle of arc must be < 180 degrees
Radians: Traversed angle of arc must be < Pi
Parameters:
  • end_x (float) – arc end point x-coordinate
  • end_y (float) – arc end point y-coordinate
  • center_x (float) – arc center point x-coordinate
  • center_y (float) – arc center point y-coordinate
Returns:

[arc, arc_start_point, arc_end_point]

Return type:

list

draw_arc_angle(degrees_ccw, center_x, center_y)[source]

Makes an arc and adds it to the part.

Current point is the first arc point.
degrees_ccw is the swept angle in degrees, counterclockwise
(center_x, center_y) is the arc center
Degrees: Traversed angle of arc must be < 180 degrees
Parameters:
  • degrees_ccw (float) – arc swept angle in degrees, counterclockwise
  • center_x (float) – arc center point x-coordinate
  • center_y (float) – arc center point y-coordinate
Returns:

[arc, arc_start_point, arc_end_point]

Return type:

list

draw_circle(center_x, center_y, radius, num_arcs=4)[source]

Draws a circle area and adds it to the part.

Parameters:
  • center_x (float) – x-axis hole center
  • center_y (float) – y-axis hole center
  • radius (float) – hole radius
  • num_arcs (int) – number of arcs to use, must be >= 3
Returns:

a LineLoop list of SignArc

Return type:

loop (geometry.LineLoop)

draw_hole(center_x, center_y, radius, num_arcs=4, filled=False)[source]

Makes a hole in the part.

Parameters:
  • center_x (float) – x-axis hole center
  • center_y (float) – y-axis hole center
  • radius (float) – hole radius
  • num_arcs (int) – number of arcs to use, must be >= 3
  • filled (bool) –

    whether to fill the hole

    • True: makes a new area in the part
Returns:

list of hole SignLine or SignArc

  • Returns None if hole was not made.

Return type:

hole_lines (list or None)

draw_line_ax(dy_ax)[source]

Draws a line a relative axial distance, and adds it to the part.

Parameters:dy_ax (float) – y-axis delta distance to draw the line
Returns:[line, point_start, point_end]
Return type:list
draw_line_delta(delta_x, delta_y)[source]

Draws a line a relative distance, and adds it to the part.

Parameters:
  • delta_x (float) – x-axis delta distance to draw the line
  • delta_y (float) – y-axis delta distance to draw the line
Returns:

[line, point_start, point_end]

Return type:

list

draw_line_rad(dx_rad)[source]

Draws a line a relative radial distance, and adds it to the part.

Parameters:dx_rad (float) – x-axis delta distance to draw the line
Returns:[line, point_start, point_end]
Return type:list
draw_line_to(x, y)[source]

Draws a line to the given location, and adds it to the part.

Parameters:
  • x (float) – x-axis coordinate of the end point
  • y (float) – y-axis coordinate of the end point
Returns:

[SignLine, point_start, point_end]

Return type:

list

fillet_all(radius)[source]

Fillets all external lines not within 10 degrees of tangency

Parameters:radius (float) – the fillet radius to use
Returns:list of SignArc
Return type:arcs (list)
fillet_lines(line1, line2, radius)[source]

Fillets the given lines in the part.

This inserts an arc in the part tangent to the two given lines.

Parameters:
  • line1 (SignLine) – line that the arc starts on, arc is tangent
  • line2 (SignLine) – line that the arc ends on, arc is tangent
  • radius (float) – arc radius size
Returns:

[arc, start_point, end_point]

Return type:

list

get_item(item)[source]

“Returns the part’s item(s) requested by the passed string.

Parameters:item (str) –

string requesting item(s)

  • Valid examples: ‘P0’, ‘L0’, ‘left’, ‘A0’
Returns:If items are found they are returned
  • If there is only one item it is returned
  • If there are multiple items, they are returned as a list
  • If no items are found None is returned
Return type:item(s) or None
get_name()[source]

Returns the part name based on id number.

goto(x, y, holemode=False)[source]

Moves the part cursor to a location.

If that location has a point at it, use it. If not, make a new point at that location.

Parameters:
  • x (float) – x-coordinate of the point to go to
  • y (float) – y-coordinate of the point to go to
  • holemode (bool) – if True, we start drawing a hole here, otherwise we start drawing an area
Returns:

returns the updated cursor point

Return type:

self.__cursor (Point)

label(axis)[source]

Labels the part on a Matplotlib axis

Parameters:axis (Matplotlib Axis) – Matplotlib Axis
lines

Returns list of part lines.

plot(axis, label=True, color='yellow')[source]

Plots the part on the passed Matplotlib axis.

Parameters:
  • axis (Matplotlib axis) – the axis we will plot on
  • label (bool) – True displays the part label
  • color (tuple) – r,g,b,a matplotlib color tuple
points

Returns list of part points, excludes arc centers.

signlines

Returns list of part signline and signarc.

pycalculix.problem module

This module stores the Problem class which is used to solve different types of analysis.

class pycalculix.problem.Problem(feamodel, problem_type, fname='')[source]

Bases: pycalculix.base_classes.Idobj

Makes a problem which can be analyzed with Calculix ccx.

Parameters:
  • feamodel (-) – the parent FeaModel
  • problem_type (-) – model type, options: – ‘struct’: structural
  • fname (-) – file prefix for the problem .inp and results files If value is ‘’ it will default to the project name of the FeaModel
fea

parent FeaModel

Type:FeaModel
__ptype

problem type, options:

  • ‘struct’: structural
Type:str
solved

boolean storing whether or not the analysis was solved

Type:bool
fname

the problem database and results file prefix

Type:str
rfile

Results_File is loaded in after the model has been solved

Type:Results_File
solve()[source]

Solves the model in Calculix ccx.

pycalculix.results_file module

This module stores the Results_File class.

class pycalculix.results_file.ResultsFile(problem)[source]

Bases: object

Makes a results file.

Parameters:problem (Problem) – problem that was solved
__problem

parent problem

Type:Problem
__steps

a list of float time steps

Type:list
__results

a dict storing the results data results[step][‘node’][nnum][field] –> value results[step][‘element’][enum][‘avg’][field] –> value results[step][‘element’][enum][‘max’][field] –> value results[step][‘element’][enum][‘min’][field] –> value results[step][‘element’][enum][‘ipoints’][ipnum][field] –> value field = ‘ux’ or ‘Seqv’ or ‘ey’ etc.

Type:dict
__time

current time we are looking at, defaults to -1 When a file is loaded in, the first time step is loaded.

Type:float
check_ccx_version(timeout=1)[source]

Raises an exception of the calculix ccx version is too old

eplot(field, fname='', display=True, levels=21, gmult=1.0, mode='avg', max_val=None, min_val=None, title='')[source]

Plots element results.

Parameters:
  • field (str) – results item to plot. Only stresses supported. Examples: ‘Sx’, ‘Sxy’, ‘S1’, ‘Seqv’ etc.
  • fname (str) – prefix of png file name, if writing an image
  • display (bool) – True = interactively show the plot
  • levels (int) – number of levels to use in the colorbar
  • gmult (int) – geometric multiplier on displacement of nodes displayed_node_loc = model_node_loc + gmult*node_displacement
  • mode (str) –

    the type of element result to plot

    • ’avg’: integration points averaged to avg element result
    • ’max’: max value of field in the integration points plotted
    • ’min’: min value of field in the integration points plotted
  • max_val (float or None) –

    max value in the colorbar

    • None: max from selected data used
    • float: use the passed float
  • min_val (float) –

    min value in the colorbar

    • None: min from selected data used
    • float: use the passed float
  • title (str) – third line in the plot title
get_emax(field, time=None, mode='avg')[source]

Returns the max results field value of selected elements at curent time.

Parameters:
  • field (str) – results field, stresses supported ‘S1’, ‘Sx’, etc.
  • time (None or float) –

    the time to query

    • None: uses the current time
    • float: uses the passed float time
  • mode (str) –

    type of element result to give back

    • ’max’: for each element only use the max value of field over
      all of its integration points
    • ’min’: for each element only use the min value of field over
      all of its integration points
    • ’avg’: for each element only use an average of all integration
      points in the eleemnt. Principal streses and Seqv are calculated after averaging 6 stress components.
Returns:

max value

Return type:

res (float)

get_emin(field, time=None, mode='avg')[source]

Returns the min results field value of selected elements at curent time.

Parameters:
  • field (str) – results field, stresses supported ‘S1’, ‘Sx’, etc.
  • time (None or float) –

    the time to query

    • None: uses the current time
    • float: uses the passed float time
  • mode (str) –

    type of element result to give back

    • ’max’: for each element only use the max value of field over
      all of its integration points
    • ’min’: for each element only use the min value of field over
      all of its integration points
    • ’avg’: for each element only use an average of all integration
      points in the eleemnt. Principal streses and Seqv are calculated after averaging 6 stress components.
Returns:

min value

Return type:

res (float)

get_eval(element, field, time=None, mode='avg')[source]

Returns the field result value under element.

Result will be returned whether or not passed element is selected.

Parameters:
  • element (str or Element) – element we are asking about
  • field (str) – the results item we want: ‘Sy’, ‘Seqv’
  • mode (str) –

    the type of element result to get

    • ’avg’: integration points averaged to avg element result
    • ’max’: max value of field in the integration points plotted
    • ’min’: min value of field in the integration points plotted
Returns:

float value if field exists, None otherwise

Return type:

res (float or None)

get_fsum(item)[source]

Returns the force sum on nodes under a given point or line.

Reports results for the current time.

Parameters:item (Point or SignLine) – item that has reaction forces on its nodes
Returns:[fx, fy, fz] reaction forces in each axis, force units
Return type:list
get_nmax(field, time=None)[source]

Returns the max value of node results field in selected nodes.

Reports results for the current time.

Parameters:
  • field (str) – results field, for example ‘ux’, ‘ey’, ‘S1’, ‘Seqv’
  • time (None or float) –

    the time to query

    • None: uses the current time
    • float: uses the passed float time
Returns:

max value

Return type:

res (float)

get_nmin(field, time=None)[source]

Returns the min value of node results field in selected nodes.

Reports results for the current time.

Parameters:
  • field (str) – results field, for example ‘ux’, ‘ey’, ‘S1’, ‘Seqv’
  • time (None or float) –

    the time to query

    • None: uses the current time
    • float: uses the passed float time
Returns:

min value

Return type:

res (float)

get_nval(node, field, time=None)[source]

Returns the field result value under node.

Result will be returned whether or not passed node is selected.

Parameters:
  • node (str or Node) – node we are asking about
  • field (str) – the results item we want: ‘ux’, ‘Sy’, ‘Seqv’, ‘fx’
  • time (None or float) –

    the time to query

    • None: uses the current time
    • float: uses the passed float time
Returns:

float value if field exists, None otherwise

Return type:

res (float or None)

get_relative_gradient(start_point, end_point, field, n_poly=3, n_subpoints=500)[source]

Calculte relative stress gradient (gradient/start_value)

Parameters:
  • [ (end_point) – starting point of line. [x, y]
  • [ – end point of line. Example: [x, y]
  • field (str) – results item to plot, examples: ‘ux’, ‘ey’, ‘Seqv’
Kargs:
n_poly (int): numbers of polygons for fitting, min=2 n_subpoints (int): numbers of points the line is subdivided into
load()[source]

Loads the results file with problem.fname prefix.

nplot(field, fname='', display=True, levels=21, gradient=False, gmult=1.0, max_val=None, min_val=None, title='')[source]

Plots nodal results.

Parameters:
  • field (str) – results item to plot, examples: ‘ux’, ‘ey’, ‘Seqv’
  • fname (str) – prefix of png file name, if writing an image
  • display (bool) – True = interactively show the plot
  • levels (int) – number of levels to use in the colorbar
  • gradient (bool) – True = results plotted with gradient False = results plotted with filled areas
  • gmult (int) – geometric multiplier on displacement of nodes displayed_node_loc = model_node_loc + gmult*node_displacement
  • max_val (float or None) –

    max value in the colorbar

    • None: max from selected data used
    • float: use the passed float
  • min_val (float) –

    min value in the colorbar

    • None: min from selected data used
    • float: use the passed float
  • title (str) – third line in the plot title
plot_gradient(start_point, end_point, field, fname='', display=True, title='', max_val=None, min_val=None, curve_fitting=True, n_poly=3, n_subpoints=500, legend=True)[source]

Create diagram with data projected onto line on the undeformed geometry.

Parameters:
  • [float, float] (end_point) – starting point of line. [x, y]
  • [float, float] – end point of line. Example: [x, y]
  • field (str) – results item to plot, examples: ‘ux’, ‘ey’, ‘Seqv’
  • fname (str) – prefix of png file name, if writing an image
  • display (bool) – True = interactively show the plot
  • title (str) – third line in the plot title
  • max_val (float or None) – max value in the y-axis - None: max from selected data used - float: use the passed float
  • min_val (float or None) – min value in the y-axis - None: min from selected data used - float: use the passed float
  • curve_fitting (bool) – True = a curve is fitted to the gradient
  • n_poly (int) – numbers of polygons for fitting
  • n_subpoints (int) – numbers of points the line is subdivided into
  • legend (bool) – True = legend with fitted equation is shown
set_time(time)[source]

Sets the time point we’re looking at in the results file.

Parameters:time (float) – time we are setting
steps

Returns a list of loaded time steps.

Note: this is read only, you can not assign a value to it.

time

Returns the current time (float) in the results file.

Note: this is read only, you can not assign a value to it.

pycalculix.selector module

This module stores the Selector object

Selector is used in FeaModel to store the model’s selected set.

class pycalculix.selector.Selector(feamodel)[source]

Bases: object

Makes a selector which stores the selected items in the FeaModel.

Parameters:feamodel (FeaModel) – the parent FeaModel object
__fea

the parent FeaModel

Type:FeaModel
__all

If everything is selected all=True

Type:bool
parts

currently selected parts

Type:set
areas

currently selected areas

Type:set
lines

currently selected signed lines or arcs

Type:set
points

currently selected points

Type:set
elements

currently selected elements

Type:set
faces

currently selected faces

Type:set
nodes

currently selected nodes

Type:set
__parts

internal storage set of parts

Type:set
__areas

internal storage set of areas

Type:set
__slines

internal storage set of signed lines and arcs

Type:set
__points

internal storage set of points

Type:set
__elements

internal storage set of elements

Type:set
__faces

internal storage set of faces

Type:set
__nodes

internal storage set of nodes

Type:set
allsel_under(sel_type, full=True, byfaces=False)[source]

Selects all progeny under current sel_type items.

Parameters:
  • sel_type (str) –

    the item type to select under

    • ’parts’
    • ’areas’
    • ’lines’
    • ’points’ (needs full=True)
    • ’elements’
    • ’faces’
  • full (bool) –

    if False selects under one branch

    • solid modeling branch: area->line->keypoints->points
    • mesh branch: elements->faces->nodes

    Cross branch connections: - faces are under lines - elements are under areas - nodes are under lines and points

    If True, selects all items connected to sub items: - Parts:

    • Areas
    • Elements, element faces + element nodes
    • Lines, line points
    • Areas:
      • Elements, element faces + element nodes
      • Lines, line points

    -Lines:

    • Faces, nodes
    • byfaces=True: elements above faces
    • byfaces=False: elements above line nodes selected

    -Points:

    • Nodes
    • byfaces=True: no elements selected
    • byfaces=False: elements above point nodes selected
  • byfaces (bool) –

    If true, the child elements will only be selected if a parent face was selected. If false just an element node needs to be selected to select the element.

    -This is only applicable when sel_type == ‘lines’

allselect()[source]

Selects all items.

areas

Returns selected areas.

deselect(items)[source]

Removes the passed item or items from the selection set.

deselect_all(sel_type)[source]

Deselects all items of sel_type.

All items currently selected items are removed from the selection set before the all set is selected.

Parameters:sel_type (str) –

the items to select

  • ’all’
  • ’parts’
  • ’areas’
  • ’lines’
  • ’points’
  • ’elements’
  • ’faces’
  • ’nodes’
elements

Returns selected elements.

faces

Returns selected faces.

lines

Returns selected signed lines or arcs.

nodes

Returns selected nodes.

parts

Returns selected parts.

points

Returns selected points.

print_summary()[source]

Prints a summary of the number so items selected in each sel_type.

select(items='', also=False)[source]

Selects an item or a list of items.

Agrs:

items (str or item or list): item(s) to select also (bool): whether to add the items to the current selection set

  • True: add the items to the current selection set
  • False: only select the passed items
select_above(inclusive=False)[source]

Selects parents above currently selected items.

Only one set must be selected.

select_above_all(sel_type, inclusive=False)[source]

Selects parents above all currently selected items of sel_type.

Parameters:
  • sel_type (str) –

    type to select items above

    • ’areas’: selects parts
    • ’lines’: selects areas
    • ’points’: selects signlines or signarcs
    • ’faces’: selects elements
    • ’nodes’: selects faces
  • inclusive (bool) –

    if True, all child entities must be selected for the parent to be selected. If false all parents connected to the child are selected. Exampes:

    • ’areas’ + True: all part areas must be selected to select part
    • ’areas’ + False: parts with selected areas in them are selected
    • ’lines’ + True: all lines must be selected to select area
    • ’lines’ + False: areas with selected lines in them are selected
select_all(sel_type='all', also=False)[source]

Selects all items of sel_type from the full feamodel.

All items currently selected items are removed from the selection set before the all set is selected.

Parameters:
  • sel_type (str) –

    the items to select

    • ’all’
    • ’parts’
    • ’areas’
    • ’lines’
    • ’points’
    • ’elements’
    • ’faces’
    • ’nodes’
  • also (bool) – if False, empties the selection set before selecting all items, if True adds new items to the current set
select_below()[source]

Selects children below currently selected items.

Only one set must be selected.

select_below_all(sel_type)[source]

Selects children below all currently selected items of sel_type.

Parameters:sel_type (str) –

type to select items below

  • ’parts’: selects areas
  • ’areas’: selects lines (type SignLine and SignArc)
  • ’lines’: selects points
  • ’elements’: selects faces
  • ’faces’: selects nodes
select_none()[source]

Empties out the selection object.

pycalculix.version module

Module contents

pycalculix Description: This module provides a python interface to the Calculix FEA preprocessor and solver. Simplicity is emphasized.

2D models are supported including: plane stress, plane strain, and axisymmetric problems

Library Capabilities: Build Geometry Mesh Geometry Apply Loads Solve Model View Results Query Results Select Sub-Portion of Model and view those results

See documentation and examples at: http://justinablack.com/pycalculix/ https://github.com/spacether/pycalculix