Modelling with adapy

[15]:
import ada

Basic Primitives

First lets look at the various primitives that adapy can model

[16]:
bm = ada.Beam('bm1', (0,0,0), (1,0,0), 'IPE300')
bm.show(embed_glb=True)
[16]:
[17]:
pl = ada.Plate('pl1', [(0,0), (1,0), (1,1), (0,1)], 0.01)
pl.show(embed_glb=True)
[17]:
[18]:
box = ada.PrimBox("box1", (0,0,0), (1,1,1))
box.show(embed_glb=True)
[18]:
[19]:
cyl = ada.PrimCyl("cyl1", (0,0,0), (0,0,1), 0.1)
cyl.show(embed_glb=True)
[19]:

There are more primitives, but it’s easier to access those by simply printing the classes accessible from ada. starting with Prim in addition to the typical structural items Beam, Plate, Pipe etc…

[27]:
[x for x in dir(ada) if not x.startswith("__")]
[27]:
['ArcSegment',
 'Assembly',
 'BM_N',
 'Beam',
 'BeamRevolve',
 'BeamSweep',
 'BeamTapered',
 'Bolts',
 'Boolean',
 'Counter',
 'CurvePoly2d',
 'CurveRevolve',
 'Direction',
 'FEM',
 'Group',
 'Instance',
 'LineSegment',
 'Material',
 'Node',
 'PL_N',
 'Part',
 'Pipe',
 'PipeSegElbow',
 'PipeSegStraight',
 'Placement',
 'Plate',
 'PlateCurved',
 'Point',
 'PrimBox',
 'PrimCone',
 'PrimCyl',
 'PrimExtrude',
 'PrimRevolve',
 'PrimSphere',
 'PrimSweep',
 'Section',
 'Shape',
 'TYPE_CHECKING',
 'Transform',
 'Units',
 'User',
 'Wall',
 'Weld',
 'annotations',
 'api',
 'base',
 'cache',
 'comms',
 'config',
 'configure_logger',
 'core',
 'deprecated',
 'fem',
 'from_fem',
 'from_fem_res',
 'from_genie_xml',
 'from_ifc',
 'from_sesam_cc',
 'from_step',
 'geom',
 'materials',
 'occ',
 'os',
 'pathlib',
 'sections',
 'set_jupyter_part_renderer',
 'visit',
 'warnings']

Combining objects into parts and assemblies

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 representany hierarchical level underneath the Assembly.

The way Ada-py defines hierarchies can be used either by

bm = ada.Beam("bm1", (0,0,0), (1,0,0), 'IPE300')
p = ada.Part('myPart')
p.add_object(bm)
[30]:
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(embed_glb=True)
[30]:

Or you can use “/” (inspired by how pathlib concatenates paths).

[31]:
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(embed_glb=True)
[31]: