Parts and Assemblies¶
Notebook
This page was generated from parts_and_assemblies.ipynb. Download it to run the examples yourself.
In ada-py the Part and Assembly objects are used to define the hierarchy of elements. Assembly is the top-level object referenced only once per project, while the Part object is used to represent all hierarchical levels underneath the Assembly.
In ada-py there are two ways to add objects to a Part. You can use the add_object method or you can use the / operator.
bm = ada.Beam("bm1", (0,0,0), (1,0,0), 'IPE300')
pl = ada.Plate('pl1', [(0,0), (1,0), (1,1), (0,1)], 0.01)
p = ada.Part('myPart')
p.add_object(bm)
p.add_object(pl)
p.show()
Or you can use "/" (inspired by how pathlib concatenates paths).
bm = ada.Beam("bm1", (0,0,0), (1,0,0), 'IPE300')
pl = ada.Plate('pl1', [(0,0), (1,0), (1,1), (0,1)], 0.01)
p = ada.Part('MyPart') / (bm, pl)
p.show()
You are free to nest parts to you like to create a hierarchy of elements.
You'll notice that there are several methods available on the Part object to export it to different formats
['to_aveva_mac',
'to_fem',
'to_fem_obj',
'to_gltf',
'to_obj_mesh',
'to_stp',
'to_trimesh',
'to_trimesh_scene']
However, if you want to export to formats such as IFC, you'll have to add a top-level Assembly object to your project.
The Assembly object is the top-level object in the hierarchy and is used to define the project. It is as subclass of Part, but it is referenced only once per project.
You'll see that the Assembly object has 2 additional methods to export to IFC and genie_xml formats (Genie XML is the format used by a Finite element pre/post-processor Genie which is part of the Sesam suite by DNV.
['to_aveva_mac',
'to_fem',
'to_fem_obj',
'to_genie_xml',
'to_gltf',
'to_gnx',
'to_ifc',
'to_obj_mesh',
'to_pickle',
'to_stp',
'to_trimesh',
'to_trimesh_scene']