Cad Base#

basd_cad_block contains base functionalities to build CAD object made out of other CAD objects. For example a battery module is made out of several cell blocks

classes:

ConfigError BlockBasdCAD

functions:

build_row combine create_case get_center get_dimensions

exception basd.cad.cad_base.ConfigError[source]#

ConfigError as self defined Exception used configuration errors

class basd.cad.cad_base.BaseCAD(x_pos: float, y_pos: float, z_pos: float)[source]#

BaseCAD class is the base class for all other classes in the CAD tool

Variables:
  • x_pos – position in x-direction

  • y_pos – position in y-direction

  • z_pos – position in z-direction

__init__(x_pos: float, y_pos: float, z_pos: float)[source]#
class basd.cad.cad_base.CADBlock(x_pos: float, y_pos: float, z_pos: float, x_dir: int, y_dir: int, z_dir: int, row_offset: RowOffset, inner_padding: InnerPadding, outer_padding: OuterPadding)[source]#

CADBlock is the base class for the block build (cell_block, module and string)

Variables:
  • x_pos – x position of the block

  • y_pos – y position of the block

  • z_pos – z position of the block

  • x_dir – number of elements in x direction

  • y_dir – number of elements in y direction

  • z_dir – number of elements in z direction

  • offset – row offset definition as lists in a list ,

  • padding – space to next objects in x,y,z direction

__init__(x_pos: float, y_pos: float, z_pos: float, x_dir: int, y_dir: int, z_dir: int, row_offset: RowOffset, inner_padding: InnerPadding, outer_padding: OuterPadding)[source]#
create_object(block_shapes: list[Workplane], alternate=False) Workplane[source]#

create_object adds a certain number of rows made out of block_shapes in x and z direction depending on the values in self.number_of_blocks_in_row to the handle

Parameters:
  • handle – the workplane at which the block_shapes should be added

  • block_shapes – list of cq.workplanes containing a shape object

  • alternate – is needed to realize a series connection with cell blocks, which need to be rotated alternately in a series connection

Returns:

passed handle with the new block_shapes added to the stack

static build_row(components: list[Workplane], direction: int, padding: float, offset: float, iterations: int | None = None, handle: Workplane | None = None) Workplane[source]#

build_row builds a row by arranging the passed components alternately in a certain direction

Variables:
  • components – list of cq.Workplane object with shapes in it, which should be used to build the row

  • direction – 1 as x direction, 2 as y direction and 3 as z direction

  • iterations – number of components placed in the row

  • padding – space between each component in mm

  • offset – offset at the beginning of the row

Returns:

new workplane with all components added to the stack

static get_dimensions(components: Workplane, center=False) tuple[source]#

Return the dimensions of the passed components or if needed the center of the components

Parameters:

components – workplane with a shape object on its stack

Returns:

width, length and height of the component

static add_box(handle: Workplane, padding: tuple | None = None, add: tuple | None = None, thickness: float = 0.001) Workplane[source]#

adds the “bounding” box surrounding the elements in the passed workplane

Parameters:
  • handle – the workplane at which the box should be added

  • padding – padding between box and underlying shapes

  • thickness – thickness of the box edges, defaults to 0.001

Returns:

workplanes with hollowed box around other shapes