Print Organization¶
Fabrication parameter assignment and G-code generation.
print_organization
¶
Print organization for embedding fabrication parameters into toolpaths.
BasePrintOrganizer
¶
Base class for organizing the printing process.
This class is meant to be extended for implementing various print organizers. Do not use this class directly. Use PlanarPrintOrganizer or InterpolationPrintOrganizer.
Attributes:
| Name | Type | Description |
|---|---|---|
slicer |
BaseSlicer
|
An instance of a slicer class. |
printpoints |
PrintPointsCollection
|
Collection of printpoints organized by layer and path. |
Source code in src/compas_slicer/print_organization/base_print_organizer.py
total_length_of_paths
property
¶
Total length of all paths (ignores extruder toggle).
printpoints_dict
property
¶
Legacy accessor for the old dict format. Prefer using self.printpoints directly.
create_printpoints
abstractmethod
¶
printpoints_iterator
¶
Iterate over all printpoints.
Yields:
| Type | Description |
|---|---|
PrintPoint
|
Each printpoint in the organizer. |
Source code in src/compas_slicer/print_organization/base_print_organizer.py
printpoints_indices_iterator
¶
Iterate over printpoints with their indices.
Yields:
| Type | Description |
|---|---|
tuple[PrintPoint, int, int, int]
|
Printpoint, layer index, path index, printpoint index. |
Source code in src/compas_slicer/print_organization/base_print_organizer.py
number_of_paths_on_layer
¶
remove_duplicate_points_in_path
¶
Remove subsequent points within a threshold distance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
layer_idx
|
int
|
The layer index. |
required |
path_idx
|
int
|
The path index. |
required |
tolerance
|
float
|
Distance threshold for duplicate detection. |
0.0001
|
Source code in src/compas_slicer/print_organization/base_print_organizer.py
get_printpoint_neighboring_items
¶
Get neighboring printpoints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
layer_idx
|
int
|
The layer index. |
required |
path_idx
|
int
|
The path index. |
required |
i
|
int
|
Index of current printpoint. |
required |
Returns:
| Type | Description |
|---|---|
list[PrintPoint | None]
|
Previous and next printpoints (None if at boundary). |
Source code in src/compas_slicer/print_organization/base_print_organizer.py
printout_info
¶
Print information about the PrintOrganizer.
Source code in src/compas_slicer/print_organization/base_print_organizer.py
get_printpoint_up_vector
¶
Get printpoint up-vector orthogonal to path direction and normal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
The path containing the point. |
required |
k
|
int
|
Index of the point in path.points. |
required |
normal
|
Vector
|
The normal vector. |
required |
Returns:
| Type | Description |
|---|---|
Vector
|
The up vector. |
Source code in src/compas_slicer/print_organization/base_print_organizer.py
output_printpoints_dict
¶
Create a flattened printpoints dictionary.
Returns:
| Type | Description |
|---|---|
dict
|
Flattened printpoints data for JSON serialization. |
Source code in src/compas_slicer/print_organization/base_print_organizer.py
output_nested_printpoints_dict
¶
Create a nested printpoints dictionary.
Returns:
| Type | Description |
|---|---|
dict
|
Nested printpoints data for JSON serialization. |
Source code in src/compas_slicer/print_organization/base_print_organizer.py
output_gcode
¶
Generate G-code text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
GcodeConfig | None
|
G-code configuration. If None, uses defaults. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
G-code text. |
Source code in src/compas_slicer/print_organization/base_print_organizer.py
get_printpoints_attribute
¶
Get a list of attribute values from all printpoints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attr_name
|
str
|
Name of the attribute. |
required |
Returns:
| Type | Description |
|---|---|
list
|
Attribute values from all printpoints. |
Source code in src/compas_slicer/print_organization/base_print_organizer.py
InterpolationPrintOrganizer
¶
Bases: BasePrintOrganizer
Organize the printing process for non-planar contours.
Attributes:
| Name | Type | Description |
|---|---|---|
slicer |
InterpolationSlicer
|
An instance of InterpolationSlicer. |
config |
InterpolationConfig
|
Interpolation configuration. |
DATA_PATH |
str | Path
|
Data directory path. |
vertical_layers |
list[VerticalLayer]
|
Vertical layers from slicer. |
horizontal_layers |
list[Layer]
|
Horizontal layers from slicer. |
base_boundaries |
list[BaseBoundary]
|
Base boundaries for each vertical layer. |
Source code in src/compas_slicer/print_organization/interpolation_print_organizer.py
topological_sorting
¶
Create directed graph of parts with connectivity.
Creates a directed graph where each part's connectivity reflects which other parts it lies on and which other parts lie on it.
Source code in src/compas_slicer/print_organization/interpolation_print_organizer.py
create_base_boundaries
¶
Create one BaseBoundary per vertical_layer.
Source code in src/compas_slicer/print_organization/interpolation_print_organizer.py
create_printpoints
¶
Create the print points of the fabrication process.
Based on the directed graph, select one topological order. From each path collection in that order, copy PrintPoints in the correct order.
Source code in src/compas_slicer/print_organization/interpolation_print_organizer.py
get_layer_ppts
¶
Create the PrintPoints of a single layer.
Source code in src/compas_slicer/print_organization/interpolation_print_organizer.py
PlanarPrintOrganizer
¶
Bases: BasePrintOrganizer
Organize the printing process for planar contours.
Attributes:
| Name | Type | Description |
|---|---|---|
slicer |
PlanarSlicer
|
An instance of PlanarSlicer. |
Source code in src/compas_slicer/print_organization/planar_print_organizer.py
create_printpoints
¶
Create the print points of the fabrication process.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
generate_mesh_normals
|
bool
|
If True, compute mesh normals. If False, use Vector(0, 1, 0). |
True
|
Source code in src/compas_slicer/print_organization/planar_print_organizer.py
ScalarFieldPrintOrganizer
¶
Bases: BasePrintOrganizer
Organize the printing process for scalar field contours.
Attributes:
| Name | Type | Description |
|---|---|---|
slicer |
ScalarFieldSlicer
|
An instance of ScalarFieldSlicer. |
config |
InterpolationConfig
|
Configuration parameters. |
DATA_PATH |
str | Path
|
Data directory path. |
vertical_layers |
list[VerticalLayer]
|
Vertical layers from slicer. |
horizontal_layers |
list[Layer]
|
Horizontal layers from slicer. |
g_evaluation |
GradientEvaluation
|
Gradient evaluation object. |
Source code in src/compas_slicer/print_organization/scalar_field_print_organizer.py
create_printpoints
¶
Create the print points of the fabrication process.
Source code in src/compas_slicer/print_organization/scalar_field_print_organizer.py
base_print_organizer
¶
BasePrintOrganizer
¶
Base class for organizing the printing process.
This class is meant to be extended for implementing various print organizers. Do not use this class directly. Use PlanarPrintOrganizer or InterpolationPrintOrganizer.
Attributes:
| Name | Type | Description |
|---|---|---|
slicer |
BaseSlicer
|
An instance of a slicer class. |
printpoints |
PrintPointsCollection
|
Collection of printpoints organized by layer and path. |
Source code in src/compas_slicer/print_organization/base_print_organizer.py
total_length_of_paths
property
¶
Total length of all paths (ignores extruder toggle).
printpoints_dict
property
¶
Legacy accessor for the old dict format. Prefer using self.printpoints directly.
create_printpoints
abstractmethod
¶
printpoints_iterator
¶
Iterate over all printpoints.
Yields:
| Type | Description |
|---|---|
PrintPoint
|
Each printpoint in the organizer. |
Source code in src/compas_slicer/print_organization/base_print_organizer.py
printpoints_indices_iterator
¶
Iterate over printpoints with their indices.
Yields:
| Type | Description |
|---|---|
tuple[PrintPoint, int, int, int]
|
Printpoint, layer index, path index, printpoint index. |
Source code in src/compas_slicer/print_organization/base_print_organizer.py
number_of_paths_on_layer
¶
remove_duplicate_points_in_path
¶
Remove subsequent points within a threshold distance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
layer_idx
|
int
|
The layer index. |
required |
path_idx
|
int
|
The path index. |
required |
tolerance
|
float
|
Distance threshold for duplicate detection. |
0.0001
|
Source code in src/compas_slicer/print_organization/base_print_organizer.py
get_printpoint_neighboring_items
¶
Get neighboring printpoints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
layer_idx
|
int
|
The layer index. |
required |
path_idx
|
int
|
The path index. |
required |
i
|
int
|
Index of current printpoint. |
required |
Returns:
| Type | Description |
|---|---|
list[PrintPoint | None]
|
Previous and next printpoints (None if at boundary). |
Source code in src/compas_slicer/print_organization/base_print_organizer.py
printout_info
¶
Print information about the PrintOrganizer.
Source code in src/compas_slicer/print_organization/base_print_organizer.py
get_printpoint_up_vector
¶
Get printpoint up-vector orthogonal to path direction and normal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
The path containing the point. |
required |
k
|
int
|
Index of the point in path.points. |
required |
normal
|
Vector
|
The normal vector. |
required |
Returns:
| Type | Description |
|---|---|
Vector
|
The up vector. |
Source code in src/compas_slicer/print_organization/base_print_organizer.py
output_printpoints_dict
¶
Create a flattened printpoints dictionary.
Returns:
| Type | Description |
|---|---|
dict
|
Flattened printpoints data for JSON serialization. |
Source code in src/compas_slicer/print_organization/base_print_organizer.py
output_nested_printpoints_dict
¶
Create a nested printpoints dictionary.
Returns:
| Type | Description |
|---|---|
dict
|
Nested printpoints data for JSON serialization. |
Source code in src/compas_slicer/print_organization/base_print_organizer.py
output_gcode
¶
Generate G-code text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
GcodeConfig | None
|
G-code configuration. If None, uses defaults. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
G-code text. |
Source code in src/compas_slicer/print_organization/base_print_organizer.py
get_printpoints_attribute
¶
Get a list of attribute values from all printpoints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attr_name
|
str
|
Name of the attribute. |
required |
Returns:
| Type | Description |
|---|---|
list
|
Attribute values from all printpoints. |
Source code in src/compas_slicer/print_organization/base_print_organizer.py
curved_print_organization
¶
BaseBoundary
¶
The BaseBoundary is like a fake initial layer that supports the first path of the segment. This is useful, because for our computations we need to have a support layer for evey path. The first path has as support the Base Boundary, and every other path has its previous path.
Attributes:
| Name | Type | Description |
|---|---|---|
mesh |
|
|
points |
|
|
override_vector |
|
Source code in src/compas_slicer/print_organization/curved_print_organization/base_boundary.py
get_up_vectors
¶
Finds the up_vectors of each point of the boundary. A smoothing step is also included.
Source code in src/compas_slicer/print_organization/curved_print_organization/base_boundary.py
to_data
¶
Returns a dictionary with the data of the class.
Source code in src/compas_slicer/print_organization/curved_print_organization/base_boundary.py
base_boundary
¶
BaseBoundary
¶
The BaseBoundary is like a fake initial layer that supports the first path of the segment. This is useful, because for our computations we need to have a support layer for evey path. The first path has as support the Base Boundary, and every other path has its previous path.
Attributes:
| Name | Type | Description |
|---|---|---|
mesh |
|
|
points |
|
|
override_vector |
|
Source code in src/compas_slicer/print_organization/curved_print_organization/base_boundary.py
get_up_vectors
¶
Finds the up_vectors of each point of the boundary. A smoothing step is also included.
Source code in src/compas_slicer/print_organization/curved_print_organization/base_boundary.py
to_data
¶
Returns a dictionary with the data of the class.
Source code in src/compas_slicer/print_organization/curved_print_organization/base_boundary.py
interpolation_print_organizer
¶
InterpolationPrintOrganizer
¶
Bases: BasePrintOrganizer
Organize the printing process for non-planar contours.
Attributes:
| Name | Type | Description |
|---|---|---|
slicer |
InterpolationSlicer
|
An instance of InterpolationSlicer. |
config |
InterpolationConfig
|
Interpolation configuration. |
DATA_PATH |
str | Path
|
Data directory path. |
vertical_layers |
list[VerticalLayer]
|
Vertical layers from slicer. |
horizontal_layers |
list[Layer]
|
Horizontal layers from slicer. |
base_boundaries |
list[BaseBoundary]
|
Base boundaries for each vertical layer. |
Source code in src/compas_slicer/print_organization/interpolation_print_organizer.py
topological_sorting
¶
Create directed graph of parts with connectivity.
Creates a directed graph where each part's connectivity reflects which other parts it lies on and which other parts lie on it.
Source code in src/compas_slicer/print_organization/interpolation_print_organizer.py
create_base_boundaries
¶
Create one BaseBoundary per vertical_layer.
Source code in src/compas_slicer/print_organization/interpolation_print_organizer.py
create_printpoints
¶
Create the print points of the fabrication process.
Based on the directed graph, select one topological order. From each path collection in that order, copy PrintPoints in the correct order.
Source code in src/compas_slicer/print_organization/interpolation_print_organizer.py
get_layer_ppts
¶
Create the PrintPoints of a single layer.
Source code in src/compas_slicer/print_organization/interpolation_print_organizer.py
planar_print_organizer
¶
PlanarPrintOrganizer
¶
Bases: BasePrintOrganizer
Organize the printing process for planar contours.
Attributes:
| Name | Type | Description |
|---|---|---|
slicer |
PlanarSlicer
|
An instance of PlanarSlicer. |
Source code in src/compas_slicer/print_organization/planar_print_organizer.py
create_printpoints
¶
Create the print points of the fabrication process.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
generate_mesh_normals
|
bool
|
If True, compute mesh normals. If False, use Vector(0, 1, 0). |
True
|
Source code in src/compas_slicer/print_organization/planar_print_organizer.py
print_organization_utilities
¶
GcodeBuilder
¶
Builder for constructing G-code output efficiently.
Uses a list internally and joins at the end for better performance than repeated string concatenation.
Source code in src/compas_slicer/print_organization/print_organization_utilities/gcode.py
set_blend_radius
¶
Sets the blend radius (filleting) for the robotic motion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
print_organizer
|
BasePrintOrganizer
|
|
required |
d_fillet
|
float
|
Value to attempt to fillet with. Defaults to 10 mm. |
10.0
|
buffer
|
float
|
Buffer to make sure that the blend radius is never too big. Defaults to 0.3. |
0.3
|
Source code in src/compas_slicer/print_organization/print_organization_utilities/blend_radius.py
smooth_printpoint_attribute
¶
Iterative smoothing of the printpoints attribute. The attribute is accessed using the function 'get_attr_value(ppt)', and is set using the function 'set_attr_value(ppt, v)'. All attributes are smoothened continuously (i.e. as if their printpoints belong into one long uninterrupted path) For examples of how to use this function look at 'smooth_printpoints_layer_heights' and 'smooth_printpoints_up_vectors' below. The smoothing is happening by taking an average of the previous and next point attributes, and combining them with the current value of the print point; On every iteration: new_val = (0.5*(neighbor_left_val + neighbor_right_attr)) * strength - current_val * (1-strength)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
print_organizer
|
BasePrintOrganizer
|
|
required |
iterations
|
int
|
|
required |
strength
|
float
|
the current value with the average of the two neighbors on every interation stop. On each iteration: new_val = (0.5*(neighbor_left_val + neighbor_right_attr)) * strength - current_val * (1-strength) |
required |
get_attr_value
|
Callable[[PrintPoint], Any]
|
|
required |
set_attr_value
|
Callable[[PrintPoint, Any], None]
|
|
required |
Source code in src/compas_slicer/print_organization/print_organization_utilities/data_smoothing.py
smooth_printpoints_layer_heights
¶
This function is an example for how the 'smooth_printpoint_attribute' function can be used.
Source code in src/compas_slicer/print_organization/print_organization_utilities/data_smoothing.py
smooth_printpoints_up_vectors
¶
This function is an example for how the 'smooth_printpoint_attribute' function can be used.
Source code in src/compas_slicer/print_organization/print_organization_utilities/data_smoothing.py
set_extruder_toggle
¶
Sets the extruder_toggle value for the printpoints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
print_organizer
|
BasePrintOrganizer
|
|
required |
slicer
|
BaseSlicer
|
|
required |
Source code in src/compas_slicer/print_organization/print_organization_utilities/extruder_toggle.py
override_extruder_toggle
¶
Overrides the extruder_toggle value for the printpoints with a user-defined value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
print_organizer
|
BasePrintOrganizer
|
|
required |
override_value
|
bool
|
Value to override the extruder_toggle values with. |
required |
Source code in src/compas_slicer/print_organization/print_organization_utilities/extruder_toggle.py
check_assigned_extruder_toggle
¶
Checks that all the printpoints have an assigned extruder toggle.
Source code in src/compas_slicer/print_organization/print_organization_utilities/extruder_toggle.py
create_gcode_text
¶
Create G-code text from organized print points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
print_organizer
|
BasePrintOrganizer
|
The print organizer containing printpoints. |
required |
config
|
GcodeConfig | None
|
G-code configuration. If None, uses defaults. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Complete G-code file content. |
Source code in src/compas_slicer/print_organization/print_organization_utilities/gcode.py
set_linear_velocity_constant
¶
Sets the linear velocity parameter of the printpoints depending on the selected type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
print_organizer
|
BasePrintOrganizer
|
|
required |
v
|
float
|
|
25.0
|
Source code in src/compas_slicer/print_organization/print_organization_utilities/linear_velocity.py
set_linear_velocity_per_layer
¶
Sets the linear velocity parameter of the printpoints depending on the selected type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
print_organizer
|
BasePrintOrganizer
|
|
required |
per_layer_velocities
|
list[float]
|
A list of velocities (floats) with equal length to the number of layers. |
required |
Source code in src/compas_slicer/print_organization/print_organization_utilities/linear_velocity.py
set_linear_velocity_by_range
¶
set_linear_velocity_by_range(print_organizer, param_func, parameter_range, velocity_range, bound_remapping=True)
Sets the linear velocity parameter of the printpoints depending on the selected type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
print_organizer
|
BasePrintOrganizer
|
|
required |
param_func
|
Callable[[PrintPoint], float]
|
and returns the parameter value that will be used for the remapping |
required |
parameter_range
|
tuple[float, float]
|
An example of a parameter that can be used is the overhang angle, or the layer height. |
required |
velocity_range
|
tuple[float, float]
|
The range of velocities where the parameter will be remapped |
required |
bound_remapping
|
bool
|
If True, the remapping is bound in the domain velocity_range, else it is unbound. |
True
|
Source code in src/compas_slicer/print_organization/print_organization_utilities/linear_velocity.py
set_linear_velocity_by_overhang
¶
set_linear_velocity_by_overhang(print_organizer, overhang_range, velocity_range, bound_remapping=True)
Set velocity by overhang by using set_linear_velocity_by_range.
An example function for how to use the 'set_linear_velocity_by_range'. In this case the parameter that controls the velocity is the overhang, measured as a dot product with the horizontal direction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
print_organizer
|
BasePrintOrganizer
|
|
required |
overhang_range
|
tuple[float, float]
|
should be within [0.0, 1.0]. For example a reasonable value would be [0.0, 0.5], that would be remapping overhangs up to 45 degrees |
required |
velocity_range
|
tuple[float, float]
|
|
required |
bound_remapping
|
bool
|
|
True
|
Source code in src/compas_slicer/print_organization/print_organization_utilities/linear_velocity.py
add_safety_printpoints
¶
Generates a safety print point at the interruptions of the print paths.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
print_organizer
|
BasePrintOrganizer
|
An instance of the BasePrintOrganizer class. |
required |
z_hop
|
float
|
Vertical distance (in millimeters) of the safety point above the PrintPoint. |
10.0
|
Source code in src/compas_slicer/print_organization/print_organization_utilities/safety_printpoints.py
set_wait_time_on_sharp_corners
¶
Sets a wait time at the sharp corners of the path, based on the angle threshold.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
print_organizer
|
BasePrintOrganizer
|
|
required |
threshold
|
float
|
angle_threshold |
0.5 * pi
|
wait_time
|
float
|
Time in seconds to introduce to add as a wait time |
0.3
|
Source code in src/compas_slicer/print_organization/print_organization_utilities/wait_time.py
set_wait_time_based_on_extruder_toggle
¶
Sets a wait time for the printpoints, either before extrusion starts, after extrusion finishes, or in both cases.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
print_organizer
|
BasePrintOrganizer
|
|
required |
wait_type
|
WaitType
|
wait_before_extrusion: sets a wait time before extrusion (extruder_toggle False to True) wait_after_extrusion: sets a wait time after extrusion (extruder_toggle True to False) wait_before_and_after_extrusion: sets a wait time before, and after extrusion wait_at_sharp_corners: sets a wait time at the sharp corners of the path |
required |
wait_time
|
float
|
Time in seconds to introduce to add as a wait time |
0.3
|
Source code in src/compas_slicer/print_organization/print_organization_utilities/wait_time.py
override_wait_time
¶
Overrides the wait_time value for the printpoints with a user-defined value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
print_organizer
|
BasePrintOrganizer
|
|
required |
override_value
|
float
|
Value to override the wait_time values with. |
required |
Source code in src/compas_slicer/print_organization/print_organization_utilities/wait_time.py
blend_radius
¶
set_blend_radius
¶
Sets the blend radius (filleting) for the robotic motion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
print_organizer
|
BasePrintOrganizer
|
|
required |
d_fillet
|
float
|
Value to attempt to fillet with. Defaults to 10 mm. |
10.0
|
buffer
|
float
|
Buffer to make sure that the blend radius is never too big. Defaults to 0.3. |
0.3
|
Source code in src/compas_slicer/print_organization/print_organization_utilities/blend_radius.py
data_smoothing
¶
smooth_printpoint_attribute
¶
Iterative smoothing of the printpoints attribute. The attribute is accessed using the function 'get_attr_value(ppt)', and is set using the function 'set_attr_value(ppt, v)'. All attributes are smoothened continuously (i.e. as if their printpoints belong into one long uninterrupted path) For examples of how to use this function look at 'smooth_printpoints_layer_heights' and 'smooth_printpoints_up_vectors' below. The smoothing is happening by taking an average of the previous and next point attributes, and combining them with the current value of the print point; On every iteration: new_val = (0.5*(neighbor_left_val + neighbor_right_attr)) * strength - current_val * (1-strength)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
print_organizer
|
BasePrintOrganizer
|
|
required |
iterations
|
int
|
|
required |
strength
|
float
|
the current value with the average of the two neighbors on every interation stop. On each iteration: new_val = (0.5*(neighbor_left_val + neighbor_right_attr)) * strength - current_val * (1-strength) |
required |
get_attr_value
|
Callable[[PrintPoint], Any]
|
|
required |
set_attr_value
|
Callable[[PrintPoint, Any], None]
|
|
required |
Source code in src/compas_slicer/print_organization/print_organization_utilities/data_smoothing.py
smooth_printpoints_layer_heights
¶
This function is an example for how the 'smooth_printpoint_attribute' function can be used.
Source code in src/compas_slicer/print_organization/print_organization_utilities/data_smoothing.py
smooth_printpoints_up_vectors
¶
This function is an example for how the 'smooth_printpoint_attribute' function can be used.
Source code in src/compas_slicer/print_organization/print_organization_utilities/data_smoothing.py
extruder_toggle
¶
set_extruder_toggle
¶
Sets the extruder_toggle value for the printpoints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
print_organizer
|
BasePrintOrganizer
|
|
required |
slicer
|
BaseSlicer
|
|
required |
Source code in src/compas_slicer/print_organization/print_organization_utilities/extruder_toggle.py
override_extruder_toggle
¶
Overrides the extruder_toggle value for the printpoints with a user-defined value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
print_organizer
|
BasePrintOrganizer
|
|
required |
override_value
|
bool
|
Value to override the extruder_toggle values with. |
required |
Source code in src/compas_slicer/print_organization/print_organization_utilities/extruder_toggle.py
check_assigned_extruder_toggle
¶
Checks that all the printpoints have an assigned extruder toggle.
Source code in src/compas_slicer/print_organization/print_organization_utilities/extruder_toggle.py
gcode
¶
G-code generation for compas_slicer.
This module generates G-code for FDM 3D printing from organized print points.
GcodeBuilder
¶
Builder for constructing G-code output efficiently.
Uses a list internally and joins at the end for better performance than repeated string concatenation.
Source code in src/compas_slicer/print_organization/print_organization_utilities/gcode.py
create_gcode_text
¶
Create G-code text from organized print points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
print_organizer
|
BasePrintOrganizer
|
The print organizer containing printpoints. |
required |
config
|
GcodeConfig | None
|
G-code configuration. If None, uses defaults. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Complete G-code file content. |
Source code in src/compas_slicer/print_organization/print_organization_utilities/gcode.py
linear_velocity
¶
set_linear_velocity_constant
¶
Sets the linear velocity parameter of the printpoints depending on the selected type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
print_organizer
|
BasePrintOrganizer
|
|
required |
v
|
float
|
|
25.0
|
Source code in src/compas_slicer/print_organization/print_organization_utilities/linear_velocity.py
set_linear_velocity_per_layer
¶
Sets the linear velocity parameter of the printpoints depending on the selected type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
print_organizer
|
BasePrintOrganizer
|
|
required |
per_layer_velocities
|
list[float]
|
A list of velocities (floats) with equal length to the number of layers. |
required |
Source code in src/compas_slicer/print_organization/print_organization_utilities/linear_velocity.py
set_linear_velocity_by_range
¶
set_linear_velocity_by_range(print_organizer, param_func, parameter_range, velocity_range, bound_remapping=True)
Sets the linear velocity parameter of the printpoints depending on the selected type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
print_organizer
|
BasePrintOrganizer
|
|
required |
param_func
|
Callable[[PrintPoint], float]
|
and returns the parameter value that will be used for the remapping |
required |
parameter_range
|
tuple[float, float]
|
An example of a parameter that can be used is the overhang angle, or the layer height. |
required |
velocity_range
|
tuple[float, float]
|
The range of velocities where the parameter will be remapped |
required |
bound_remapping
|
bool
|
If True, the remapping is bound in the domain velocity_range, else it is unbound. |
True
|
Source code in src/compas_slicer/print_organization/print_organization_utilities/linear_velocity.py
set_linear_velocity_by_overhang
¶
set_linear_velocity_by_overhang(print_organizer, overhang_range, velocity_range, bound_remapping=True)
Set velocity by overhang by using set_linear_velocity_by_range.
An example function for how to use the 'set_linear_velocity_by_range'. In this case the parameter that controls the velocity is the overhang, measured as a dot product with the horizontal direction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
print_organizer
|
BasePrintOrganizer
|
|
required |
overhang_range
|
tuple[float, float]
|
should be within [0.0, 1.0]. For example a reasonable value would be [0.0, 0.5], that would be remapping overhangs up to 45 degrees |
required |
velocity_range
|
tuple[float, float]
|
|
required |
bound_remapping
|
bool
|
|
True
|
Source code in src/compas_slicer/print_organization/print_organization_utilities/linear_velocity.py
safety_printpoints
¶
add_safety_printpoints
¶
Generates a safety print point at the interruptions of the print paths.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
print_organizer
|
BasePrintOrganizer
|
An instance of the BasePrintOrganizer class. |
required |
z_hop
|
float
|
Vertical distance (in millimeters) of the safety point above the PrintPoint. |
10.0
|
Source code in src/compas_slicer/print_organization/print_organization_utilities/safety_printpoints.py
create_safety_printpoint
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
printpoint
|
PrintPoint
|
|
required |
z_hop
|
float
|
|
required |
extruder_toggle
|
bool
|
|
required |
Returns:
| Type | Description |
|---|---|
class: 'compas_slicer.geometry.PrintPoint'
|
|
Source code in src/compas_slicer/print_organization/print_organization_utilities/safety_printpoints.py
wait_time
¶
set_wait_time_on_sharp_corners
¶
Sets a wait time at the sharp corners of the path, based on the angle threshold.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
print_organizer
|
BasePrintOrganizer
|
|
required |
threshold
|
float
|
angle_threshold |
0.5 * pi
|
wait_time
|
float
|
Time in seconds to introduce to add as a wait time |
0.3
|
Source code in src/compas_slicer/print_organization/print_organization_utilities/wait_time.py
set_wait_time_based_on_extruder_toggle
¶
Sets a wait time for the printpoints, either before extrusion starts, after extrusion finishes, or in both cases.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
print_organizer
|
BasePrintOrganizer
|
|
required |
wait_type
|
WaitType
|
wait_before_extrusion: sets a wait time before extrusion (extruder_toggle False to True) wait_after_extrusion: sets a wait time after extrusion (extruder_toggle True to False) wait_before_and_after_extrusion: sets a wait time before, and after extrusion wait_at_sharp_corners: sets a wait time at the sharp corners of the path |
required |
wait_time
|
float
|
Time in seconds to introduce to add as a wait time |
0.3
|
Source code in src/compas_slicer/print_organization/print_organization_utilities/wait_time.py
override_wait_time
¶
Overrides the wait_time value for the printpoints with a user-defined value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
print_organizer
|
BasePrintOrganizer
|
|
required |
override_value
|
float
|
Value to override the wait_time values with. |
required |
Source code in src/compas_slicer/print_organization/print_organization_utilities/wait_time.py
scalar_field_print_organizer
¶
ScalarFieldPrintOrganizer
¶
Bases: BasePrintOrganizer
Organize the printing process for scalar field contours.
Attributes:
| Name | Type | Description |
|---|---|---|
slicer |
ScalarFieldSlicer
|
An instance of ScalarFieldSlicer. |
config |
InterpolationConfig
|
Configuration parameters. |
DATA_PATH |
str | Path
|
Data directory path. |
vertical_layers |
list[VerticalLayer]
|
Vertical layers from slicer. |
horizontal_layers |
list[Layer]
|
Horizontal layers from slicer. |
g_evaluation |
GradientEvaluation
|
Gradient evaluation object. |
Source code in src/compas_slicer/print_organization/scalar_field_print_organizer.py
create_printpoints
¶
Create the print points of the fabrication process.