I/O

ImageJ Reader

class vSCAD.io.imagej_reader.ImageJReader[source]

Bases: object

get_diam()[source]

Returns the diameters of the vessel as a list of diameters

Parameters:

csv_path (str) – The path to the CSV file containing the vessel data.

Returns:

A 1D numpy array containing the diameters of the vessel.

Return type:

np.ndarray

get_path()[source]

Returns the path of the vessel as a list of points

Parameters:

csv_path (str) – The path to the CSV file containing the vessel data.

Returns:

A 2D numpy array where each row represents a point in the vessel path. The first two columns are the X and Y coordinates, and the third column is filled with zeros.

Return type:

np.ndarray

New vSCAD Project

class vSCAD.io.new_project.vSCADProject(project_name)[source]

Bases: object

create_directories()[source]

Create directories for a new vSCAD project.

create_project()[source]

Create a new vSCAD project in the current working directory.

create_vSCAD_python_file()[source]

Create a vSCAD python file in the project root directory.

SCAD Writer

class vSCAD.io.write_scad.OpenSCADFunctions(path)[source]

Bases: object

end_union()[source]

End a union block in the SCAD file.

function_loft_path(vessel)[source]

Create a loft path function in OpenSCAD for a given vessel.

Parameters:

vessel (Vessel) – Vessel object containing name, path, diameters, and euler_angles.

import_circle_at()[source]

Import the circle_at module into the SCAD file.

The circle_at function creates a cylinder with a given diameter and angle. OpenSCAD cannot loft (hold()) circles (or other 2D objects), so we create a cylinder with a small height (0.01) to represent the lofted circle.

import_loft_path()[source]

Import the loft_path module into the SCAD file.

set_fragments(fragments)[source]

Set the number of fragments for OpenSCAD to draw circles.

Parameters:

fragments (int) – Number of fragments for circle rendering.

set_thickness(thickness)[source]

Set the thickness of the lofted circle.

Parameters:

thickness (float) – Thickness of the lofted circle.

start_union()[source]

Start a union block in the SCAD file.

class vSCAD.io.write_scad.SCADFile(file_name)[source]

Bases: object

create_file()[source]

Create a new SCAD file.

import_vessel(vessel)[source]

Import a vessel data into the SCAD file.

Parameters:

vessel (Vessel) – Vessel object containing path, diameters, and euler_angles.

write_stl(custom_name=None)[source]

Write the SCAD file to an STL file.

Parameters:

custom_name (str, optional) – Custom name for the STL file. If not provided, the STL file will be named after the SCAD file.