cam.utilities.chunk_utils#

Fabex ‘chunk_utils.py’ © 2012 Vilem Novak

Functions#

chunks_refine(chunks, o)

Add Extra Points in Between for Chunks

chunks_refine_threshold(chunks, distance, limitdistance)

Add Extra Points in Between for Chunks. for Medial Axis Strategy only!

chunk_to_shapely(chunk)

mesh_from_curve(o[, use_modifiers])

make_visible(o)

restore_visibility(o, storage)

chunks_to_shapely(chunks)

set_chunks_z(chunks, z)

rotate_point_by_point(originp, p, ang)

_internal_x_y_distance_to(ourpoints, theirpoints, cutoff)

_optimize_internal(points, keep_points, e, ...)

optimize_chunk(chunk, operation)

parent_child_distance(parents, children, o[, distance])

parent_child(parents, children, o)

parent_child_poly(parents, children, o)

extend_chunks_5_axis(chunks, o)

Extend chunks with 5-axis cutter start and end points.

get_closest_chunk(o, pos, chunks)

Find the closest chunk to a given position.

Module Contents#

chunks_refine(chunks, o)[source]#

Add Extra Points in Between for Chunks

chunks_refine_threshold(chunks, distance, limitdistance)[source]#

Add Extra Points in Between for Chunks. for Medial Axis Strategy only!

chunk_to_shapely(chunk)[source]#
mesh_from_curve(o, use_modifiers=False)[source]#
make_visible(o)[source]#
restore_visibility(o, storage)[source]#
chunks_to_shapely(chunks)[source]#
set_chunks_z(chunks, z)[source]#
rotate_point_by_point(originp, p, ang)[source]#
_internal_x_y_distance_to(ourpoints, theirpoints, cutoff)[source]#
_optimize_internal(points, keep_points, e, protect_vertical, protect_vertical_limit)[source]#
optimize_chunk(chunk, operation)[source]#
parent_child_distance(parents, children, o, distance=None)[source]#
parent_child(parents, children, o)[source]#
parent_child_poly(parents, children, o)[source]#
extend_chunks_5_axis(chunks, o)[source]#

Extend chunks with 5-axis cutter start and end points.

This function modifies the provided chunks by appending calculated start and end points for a cutter based on the specified orientation and movement parameters. It determines the starting position of the cutter based on the machine’s settings and the object’s movement constraints. The function iterates through each point in the chunks and updates their start and end points accordingly.

Parameters:
  • chunks (list) – A list of chunk objects that will be modified.

  • o (object) – An object containing movement and orientation data.

get_closest_chunk(o, pos, chunks)[source]#

Find the closest chunk to a given position.

This function iterates through a list of chunks and determines which chunk is closest to the specified position. It checks if each chunk’s children are sorted before calculating the distance. The chunk with the minimum distance to the given position is returned.

Parameters:
  • o – An object representing the origin point.

  • pos – A position to which the closest chunk is calculated.

  • chunks (list) – A list of chunk objects to evaluate.

Returns:

The closest chunk object to the specified position, or None if no valid

chunk is found.

Return type:

Chunk