Helper Functions
Helper functions used in the PyAuxetic library for various operations.
- pyauxetic.helper.create_ribbon_part(model, length_x, length_y, is3d, extrusion_depth)
Create a rectangular ribbon part.
- Parameters:
model (Model) – Model object in which the part will be created.
length_x (float) – Length of the part in the x (1st) direction
length_y (float) – Length of the part in the y (2nd) direction
is3d (bool) – If
True
, the part is extruded.extrusion_depth (float) – Extrusion depth used if is3d is
True
.
- Returns:
The created part object.
- pyauxetic.helper.draw_line(sketch, point1, point2)
Draw a line using two points and return the second point.
Output of this function is intended to be used as point1 for future uses.
- Parameters:
sketch (ConstrainedSketch) – The sketch in which the line is drawn.
point1 (tuple) – 2D Cartesian coordinates of the first point.
point2 (tuple) – 2D Cartesian coordinates of the second point.
- Returns:
A tuple in the form of ( (x,y), lineObj ) containing 2D Cartesian coordinates of the second point and the created line object.
- pyauxetic.helper.find_edges_from_coords(part, coord, value)
Find edges of a part that exist on a certain value along a given coordinate axis.
- Parameters:
part (Part) – The part in question.
coord (int) – The coordinate axis used for the operation. Valid values are 1, 2, or 3.
value (float) – Value of the coordinate specified in coord.
- Returns:
An EdgeArray object containing one or more edges which have a point on the given coordinates.
- Raises:
RuntimeError – If no edges are found.
- pyauxetic.helper.find_vertices_from_coords(part, coord, value)
Find vertices of a part that exist on a certain value along a given coordinate axis.
- Parameters:
part (Part) – The part in question.
coord (int) – The coordinate axis used for the operation. Valid values are 1, 2, or 3.
value (float) – Value of the coordinate specified in coord.
- Returns:
A VertexArray object containing one or more vertices which have a point on the given coordinates.
- Raises:
RuntimeError – If no vertices are found.
- pyauxetic.helper.find_vertices_from_coords_minmax(part, coord, value)
Find the first and last vertices of a part that exist on a certain value along a given coordinate axis.
- Parameters:
part (Part) – The part in question.
coord (int) – The coordinate axis used for the operation. Valid values are 1, 2, or 3.
value (float) – Value of the coordinate specified in coord.
- Returns:
A Tuple of two VertexArray objects for the first and last vertices.
- Raises:
RuntimeError – If no vertices are found.
- pyauxetic.helper.find_regular_geometries(sketch)
Searches the sketch and returns a list of REGULAR geometries.
Geometries in an Abaqus sketch are either REGULAR or CONSTRUCTION, the latter of which is used for defining relationships. This function is intended to filter out construction lines defined for mirroring parts.
- Parameters:
sketch (ConstrainedSketch) – The sketch in which the line is drawn.
- Returns:
A list of ConstrainedSketchGeometry objects which are REGULAR.
- pyauxetic.helper.get_part_box_size(part)
Calculates size of a part’s rectangular boundary.
- Parameters:
part (Part) – The part which is queried.
- Returns:
A tuple in the form of (x,y,z) containing size of the part’s rectangular boundary in the Cartesian coordinate system.
- pyauxetic.helper.get_box_coords(object_list)
Find the minimum and maximum Cartesian coordinates for a Part or PartInstance.
- Parameters:
object_list (Part/PartInstance/Repository/tuple) – The part(s) or instance(s) which are queried.
- Returns:
A tuple of tuples in the form of ( (min_x, min_y, min_z), (max_x, max_y, max_z) ) the minimum and maximum Cartesian coordinates of the parts.
- pyauxetic.helper.return_results_folder_path(structure_name, root_folder_name=None)
Return a unified path for storing results of analysis of a structure.
- Parameters:
structure_name (str) – Name of the structure for which the folder is created.
root_folder_name (str) – Name for the root folder. Defaults to None.
- Returns:
Absolute path for the results folder.
- pyauxetic.helper.return_sketch_name(base_name)
Return a unified name for a sketch based on a base name.
- Parameters:
base_name (str) – Base name to which a suffix is added.
- Returns:
A suitable name for an Abaqus sketch.
- pyauxetic.helper.return_unit_cell_name_main(base_name)
Return the name of a main part based on a unit cell.
- Parameters:
base_name (str) – Base name to which a suffix is added.
- Returns:
A suitable name for an Abaqus part.
- pyauxetic.helper.return_unit_cell_name_3dprint(base_name)
Return the name of a 3D printing part based on a unit cell. Use this function only for naming parts that are used for 3D printing.
- Parameters:
base_name (str) – Base name to which a suffix is added.
- Returns:
A suitable name for an Abaqus part.
- pyauxetic.helper.return_instance_name(base_name, suffix='')
Return the name of an instance based on a unit cell.
- Parameters:
base_name (str) – Base name to which a suffix is added. Defaults to an empty string.
- Returns:
A suitable name for an Abaqus instance.
- pyauxetic.helper.transfer_instance_to_zero(model, instance)
Transfer a PartInstance so it’s vertex with minimum coordinates is at global (0,0,0).
- Parameters:
model (Model) – Model object in which the instance is defined.
instance (PartInstance) – The instance to be moved.