Skip to content

Use scene scale in gcode output #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions scripts/addons/cam/gcode_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,11 @@ def export_gcode_path(filename, vertslist, operations):
extension = ".nc"
from .post_processors import lynx_otter_o as postprocessor

scale = bpy.context.scene.unit_settings.scale_length
if s.unit_settings.system == "METRIC":
unitcorr = 1000.0
unitcorr = 1000.0 * scale
elif s.unit_settings.system == "IMPERIAL":
unitcorr = 1 / 0.0254
unitcorr = 1 / 0.0254 * scale
else:
unitcorr = 1
rotcorr = 180.0 / pi
Expand Down
5 changes: 3 additions & 2 deletions scripts/addons/cam/utilities/simple_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,11 @@ def unit_value_to_string(x, precision=5):
Returns:
str: The string representation of the value in the appropriate units.
"""
scale = bpy.context.scene.unit_settings.scale_length
if bpy.context.scene.unit_settings.system == "METRIC":
return str(round(x * 1000, precision)) + " mm "
return str(round(x * 1000 * scale, precision)) + " mm "
elif bpy.context.scene.unit_settings.system == "IMPERIAL":
return str(round(x * 1000 / 25.4, precision)) + "'' "
return str(round(x * 1000 / 25.4 * scale, precision)) + "'' "
else:
return str(x)

Expand Down
Loading