Code Documentation¶
ADA¶
The main library.
- class ada.Assembly(name='Ada', project='AdaProject', user: User = User(user_id='AdaUser', given_name=None, family_name=None, middle_names=None, prefix_titles=None, suffix_titles=None, org_id='ADA', org_name='Assembly For Design and Analysis', org_description=None, role='Engineer'), schema='IFC4X3_add2', metadata=None, units: Units | str = Units.M, enable_cache: bool = False, clear_cache: bool = False, cache_dir: str | Path = None, ifc_class: SpatialTypes = SpatialTypes.IfcSite)¶
The Assembly object. A top level container of parts, beams, plates, shapes and FEM.
- push(comment, bimserver_url, username, password, project, merge=False, sync=False)¶
Push current assembly to BimServer with a comment tag that defines the revision name
- read_fem(fem_file: str | os.PathLike, fem_format: FEATypes | str = None, name: str = None, fem_converter: FemConverters | str = 'default', cache_model_now=False)¶
Import a Finite Element model. Currently supported FEM formats: Abaqus, Sesam and Calculix
- read_ifc(ifc_file: str | os.PathLike | ifcopenshell.file, data_only=False, elements2part=None, create_cache=False)¶
Import from IFC file.
- to_fem(name: str, fem_format: FEATypes | str, scratch_dir=None, metadata=None, execute=False, run_ext=False, mesh_only=False, cpus=1, gpus=None, overwrite=False, fem_converter='default', exit_on_complete=True, run_in_shell=False, make_zip_file=False, return_fea_results=True, model_data_only=False) FEAResult | None ¶
Create a FEM input file deck for executing fem analysis in a specified FEM format. Currently there is limited write support for the following FEM formats:
Open Source
Calculix
Code_Aster
not open source
Abaqus
Usfos
Sesam
Write support is added on a need-only-basis. Any contributions are welcomed!
- Parameters:
name – Name of FEM analysis input deck
fem_format – Desired fem format
scratch_dir – Output directory for analysis input deck
metadata – Parse additional commands to FEM solver not supported by the generalized classes
execute – Execute analysis on complete
run_ext – Run analysis externally or wait for complete
cpus – Number of cpus for running the analysis
gpus – Number of gpus for running the analysis (wherever relevant)
overwrite – Overwrite existing input file deck
fem_converter – Set desired fem converter. Use either ‘default’ or ‘meshio’.
exit_on_complete
run_in_shell
make_zip_file
return_fea_results –
Automatically import the result mesh into
Note! Meshio implementation currently only supports reading & writing elements and nodes.
Abaqus Metadata:
‘ecc_to_mpc’: Runs the method
convert_ecc_to_mpc()
. Default is True ‘hinges_to_coupling’: Runs the methodconvert_hinges_2_couplings()
. Default is TrueImportant Note! The ecc_to_mpc and hinges_to_coupling will make permanent modifications to the model. If this proves to create issues regarding performance this should be evaluated further.
- class ada.Beam(name, n1: Node | Iterable, n2: Node | Iterable, sec: str | Section, mat: str | Material = None, up=None, angle=0.0, e1=None, e2=None, units=Units.M, **kwargs)¶
The base Beam object
- Parameters:
n1 – Start position of beam. List or Node object
n2 – End position of beam. List or Node object
sec – Section definition. Str or Section Object
mat – Material. Str or Material object. String: [‘S355’ & ‘S420’] (default is ‘S355’ if None is parsed)
name – Name of beam
- add_beam_to_node_refs() None ¶
Add beam to refs on nodes
- static array_from_list_of_coords(list_of_coords: list[tuple], sec: Section | str, mat: Material | str = None, name_gen: Iterable = None, make_closed=False) list[Beam] ¶
Create an array of beams from a list of coordinates
- bbox() BoundingBox ¶
Bounding Box of beam
- get_node_on_beam_by_fraction(fraction: float) Node ¶
Returns node as a fraction of the beam length from n1-node.
- property length: float¶
Returns the length of the beam
- property ori¶
Get the x-vector, y-vector and z-vector of a given beam
- remove_beam_from_node_refs() None ¶
Remove beam from refs on nodes
- class ada.BeamRevolve(name: str, curve: CurveRevolve, sec: str | Section, **kwargs)¶
- class ada.BeamSweep(name: str, curve: CurveOpen2d, sec: str | Section, **kwargs)¶
- class ada.BeamTapered(name, n1: Iterable, n2: Iterable, sec: str | Section, tap: str | Section = None, taper_type: TaperTypes | str = TaperTypes.CENTERED, **kwargs)¶
- class ada.Bolts(name, p1, p2, normal, members, parent=None)¶
TODO: Create a bolt class based on the IfcMechanicalFastener concept.
Which in turn should likely be inside another element components class
- class ada.Boolean(primitive, bool_op: BoolOpEnum = BoolOpEnum.DIFFERENCE, metadata=None, parent=None, units=Units.M, guid=None)¶
- class ada.CurvePoly2d(points2d, origin: Iterable | Point = None, normal: Iterable | Direction = None, xdir: Iterable | Direction = None, tol=0.001, parent=None, orientation: Placement = None)¶
A closed curve defined by a list of 2d points represented by line and arc segments.
- class ada.Direction(*iterable)¶
- class ada.FEM(name: 'str', metadata: 'Dict' = <factory>, parent: 'Part' = None, nodes: 'Nodes' = <factory>, ref_points: 'Nodes' = <factory>, ref_sets: 'FemSets' = <factory>, elements: 'FemElements' = <factory>, sets: 'FemSets' = <factory>, sections: 'FemSections' = <factory>, initial_state: 'PredefinedField' = None, subroutine: 'str' = None)¶
- add_interface_nodes(interface_nodes: List[Node | InterfaceNode])¶
Nodes used for interfacing between other parts. Pass a custom Constraint if specific coupling is needed
- add_set(fem_set: FemSet, p=None, vol_box=None, vol_cyl=None, single_member=False, tol=0.0001) FemSet ¶
- Parameters:
fem_set – A fem set object
p – Single point (x,y,z)
vol_box – Search by a box volume. Where p is (xmin, ymin, zmin) and vol_box is (xmax, ymax, zmax)
vol_cyl – Search by cylindrical volume. Used together with p to find nodes within cylinder inputted by [radius, height, thickness]
single_member – Set True if you wish to keep only a single member
tol – Point Tolerances. Default is 1e-4
- add_step(step: _step_types) _step_types ¶
Add an analysis step to the assembly
- create_fem_elem_from_obj(obj, el_type=None) Elem ¶
Converts structural object to FEM elements. Currently only BEAM is supported
- get_all_bcs() Iterable[Bc] ¶
Get all the boundary conditions in the entire assembly
- get_all_masses() Iterable[Mass] ¶
Get all the Masses in the entire assembly
- class ada.Group(name: 'str', members: 'list[Part | Beam | Plate | Wall | Pipe | Shape]', parent: 'Part | Assembly', description: 'str' = '', guid: 'str' = <factory>, change_type: 'ChangeAction' = <ChangeAction.NOTDEFINED: 'NOTDEFINED'>)¶
- class ada.Instance(instance_ref: "Union['Part', 'BackendGeom']", placements: 'List[Placement]' = <factory>)¶
- class ada.Material(name, mat_model=CarbonSteel(E:2.100E+11, sig_y:3.550E+08, rho:7.850E+03, plasticity_model:None), mat_id=None, parent=None, metadata=None, units=Units.M, guid=None, ifc_store: IfcStore = None)¶
The base material class. Currently only supports Metals
- class ada.Node(p: Iterable[numeric, numeric, numeric], nid=None, bc=None, r=None, parent=None, units=Units.M, refs=None)¶
Base node object
- property has_refs: bool¶
Returns if node is valid, i.e. has objects in refs
- class ada.Part(name, color=None, placement=None, fem: FEM = None, metadata=None, parent=None, units: Units = Units.M, guid=None, ifc_store: IfcStore = None, ifc_class: SpatialTypes = SpatialTypes.IfcBuildingStorey)¶
A Part superclass design to host all relevant information for cad and FEM modelling.
- IFC_CLASSES¶
alias of
SpatialTypes
- add_joint(joint: JointBase) JointBase ¶
This method takes a Joint element containing two intersecting beams. It will check with the existing list of joints to see whether or not it is part of a larger more complex joint. It usese primarily two criteria.
Criteria 1: If both elements are in an existing joint already, it will u
Criteria 2: If the intersecting point coincides within a specified tolerance (currently 10mm) with an exisiting joint intersecting point. If so it will add the elements to this joint. If not it will create a new joint based on these two members.
- beam_clash_check(margins=5e-05)¶
For all beams in a Assembly get all beams touching or within the beam. Essentially a clash check is performed and it returns a dictionary of all beam ids and the touching beams. A margin to the beam volume can be included.
- Parameters:
margins – Add margins to the volume box (equal in all directions). Input is in meters. Can be negative.
- Returns:
A map generator for the list of beams and resulting intersecting beams
- consolidate_sections(include_self=True)¶
Moves all sections from all sub-parts to this part
- create_objects_from_fem(skip_plates=False, skip_beams=False) None ¶
Build Beams and Plates from the contents of the local FEM object
- get_by_name(name) Part | Plate | Beam | Shape | Material | Pipe | None ¶
Get element of any type by its name.
- read_step_file(step_path, name=None, scale=None, transform=None, rotate=None, colour=None, opacity=1.0, source_units=Units.M, include_shells=False)¶
- Parameters:
step_path – Can be path to stp file or path to directory of step files.
name – Desired name of destination Shape object
scale – Scale the step content upon import
transform – Transform the step content upon import
rotate – Rotate step content upon import
colour – Assign a specific colour upon import
opacity – Assign Opacity upon import
source_units – Unit of the imported STEP file. Default is ‘m’
- class ada.Pipe(name, points, sec, mat='S355', content=None, metadata=None, color=None, units: Units = Units.M, guid=None)¶
- class ada.PipeSegElbow(name, start, midpoint, end, bend_radius, section, material, parent=None, guid=None, metadata=None, units=Units.M, color=None, arc_seg=None)¶
- class ada.PipeSegStraight(name, p1, p2, section, material, parent=None, guid=None, metadata=None, units=Units.M, color=None)¶
- class ada.Placement(origin: 'Iterable | Point' = <factory>, xdir: 'Iterable | Direction' = None, ydir: 'Iterable | Direction' = None, zdir: 'Iterable | Direction' = None, scale: 'float' = 1.0)¶
- static from_axis_angle(axis: list[float], angle: float, origin: Iterable[float | int] = None) Placement ¶
Axis is a list of 3 floats, angle is in degrees.
- static from_co_linear_points(points: list[Point] | ndarray, xdir=None, flip_n=False) Placement ¶
Create a placement from a list of points that are co-linear.
- rotate(axis: list[float], angle: float) Placement ¶
Rotate the placement around an axis. Returns a new placement.
- transform_global_points_back_to_local(points3d)¶
Transform points from the global coordinate system to the coordinate system of this placement.
- transform_global_points_to_local(points3d)¶
Transform points from the global coordinate system to the coordinate system of this placement.
- transform_local_points_to_global(points2d: Iterable[Iterable[float | int, float | int]], inverse=False) np.ndarray ¶
Transform points from the coordinate system of this placement to the global coordinate system.
- transform_vector(vec: Iterable[float | int], inverse=False) ndarray ¶
Transform a vector from the coordinate system of this placement to the global coordinate system.
- class ada.Plate(name: str, points: CurvePoly2d | list[tuple[_NTYPE, _NTYPE]], t: float, mat: str | Material = 'S420', origin: Iterable | Point = None, xdir: Iterable | Direction = None, n: Iterable | Direction = None, orientation: Placement = None, pl_id=None, tol=None, **kwargs)¶
A plate object. The plate element covers all plate elements.
Contains a dictionary with each point of the plate described by an id (index) and a Node object.
- Parameters:
name – Name of plate
points – List of 2D point coordinates (or a PolyCurve) that make up the plate. Each point is (x, y, optional [radius])
t – Thickness of plate
mat – Material. Can be either Material object or built-in materials (‘S420’ or ‘S355’)
origin – Explicitly define origin of plate. If not set
xdir – Explicitly define x direction of plate. If not set
n – Explicitly define normal direction of plate. If not set
- bbox() BoundingBox ¶
Bounding Box of plate
- property t: float¶
Plate thickness
- class ada.Point(*iterable)¶
- class ada.PrimBox(name, p1, p2, **kwargs)¶
Primitive Box. Length, width & height are local x, y and z respectively
- class ada.PrimCone(name, p1, p2, r, **kwargs)¶
- class ada.PrimCyl(name, p1, p2, r, **kwargs)¶
- class ada.PrimExtrude(name, curve: list[tuple], h, normal=None, origin=None, xdir=None, tol=0.001, **kwargs)¶
- class ada.PrimRevolve(name, points, rev_angle, origin=None, xdir=None, normal=None, tol=0.001, **kwargs)¶
Revolved Primitive
- class ada.PrimSphere(name, cog, radius, **kwargs)¶
- class ada.PrimSweep(name, sweep_curve, profile_curve_outer, profile_zdir=None, profile_xdir=None, origin=None, tol=0.001, **kwargs)¶
- class ada.Shape(name, geom: Geometry | list[Geometry] | None = None, color=None, opacity=1.0, mass: float = None, cog: Iterable = None, material: Material | str = None, units=Units.M, metadata=None, guid=None, placement=Placement(origin=Point([0., 0., 0.]), xdir=Direction([1., 0., 0.]), ydir=Direction([0., 1., 0.]), zdir=Direction([0., 0., 1.]), scale=1.0), ifc_store: IfcStore = None, ifc_class: ShapeTypes = ShapeTypes.IfcBuildingElementProxy, parent=None)¶
- IFC_CLASSES¶
alias of
ShapeTypes
- class ada.Transform(translation: 'np.ndarray' = None, rotation: 'Rotation' = None)¶
- class ada.Units(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
- class ada.User(user_id: str = 'AdaUser', given_name: str = None, family_name: str = None, middle_names: str = None, prefix_titles: str = None, suffix_titles: str = None, org_id: str = 'ADA', org_name: str = 'Assembly For Design and Analysis', org_description: str = None, role: str = 'Engineer')¶
- class ada.Wall(name, points, height, thickness, placement=Placement(origin=Point([0., 0., 0.]), xdir=Direction([1., 0., 0.]), ydir=Direction([0., 1., 0.]), zdir=Direction([0., 0., 1.]), scale=1.0), offset='CENTER', metadata=None, color=None, units=Units.M, guid=None, opacity=1.0)¶
- TYPES_JUSL¶
alias of
WallJustification
- class ada.Weld(name, p1, p2, weld_type: WeldProfileEnum | str, members, profile: list[tuple], xdir: tuple, groove: list[tuple] = None, parent=None)¶
- ada.deprecated(reason: str)¶
A decorator to mark functions or classes as deprecated. Emits a warning when the function or class is used, including the module path.
- Parameters:
reason – Explanation of why the function/class is deprecated.
- ada.from_fem(fem_file: str | list | Path, fem_format: str | list = None, name: str | list = None, enable_cache=False, source_units=Units.M, fem_converter='default') Assembly ¶
Create an Assembly object from a FEM file.