Added ASCII export functionality for STL and PLY. #3

Closed
Gilu wants to merge 1 commits from (deleted):main into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
4 changed files with 14 additions and 2 deletions

4
.gitignore vendored
View File

@ -1,6 +1,9 @@
# Generic files to ignore. # Generic files to ignore.
.* .*
print3d.rsa
print3d.rsa.pub
# Python temp paths. # Python temp paths.
__pycache__/ __pycache__/
*.py[cod] *.py[cod]
@ -17,3 +20,4 @@ __pycache__/
# Locally built extensions. # Locally built extensions.
/*.zip /*.zip

View File

@ -47,6 +47,11 @@ class SceneProperties(PropertyGroup):
description="Apply scene scale setting on export", description="Apply scene scale setting on export",
default=False, default=False,
) )
use_ascii_export: BoolProperty(
name="ASCII",
description="Exporting file in ASCII format, export binary as binary otherwise.",
default=False,
)
use_data_layers: BoolProperty( use_data_layers: BoolProperty(
name="Data Layers", name="Data Layers",
description=( description=(

View File

@ -100,7 +100,7 @@ def write_mesh(context, report_cb):
filepath = bpy.path.ensure_ext(filepath, ".stl") filepath = bpy.path.ensure_ext(filepath, ".stl")
ret = bpy.ops.wm.stl_export( ret = bpy.ops.wm.stl_export(
filepath=filepath, filepath=filepath,
ascii_format=False, ascii_format=print_3d.use_ascii_export,
apply_modifiers=True, apply_modifiers=True,
export_selected_objects=True, export_selected_objects=True,
global_scale=global_scale, global_scale=global_scale,
@ -109,7 +109,7 @@ def write_mesh(context, report_cb):
filepath = bpy.path.ensure_ext(filepath, ".ply") filepath = bpy.path.ensure_ext(filepath, ".ply")
ret = bpy.ops.wm.ply_export( ret = bpy.ops.wm.ply_export(
filepath=filepath, filepath=filepath,
ascii_format=False, ascii_format=print_3d.use_ascii_export,
apply_modifiers=True, apply_modifiers=True,
export_selected_objects=True, export_selected_objects=True,
global_scale=global_scale, global_scale=global_scale,

View File

@ -135,6 +135,9 @@ class VIEW3D_PT_print3d_export(View3DPrintPanel, Panel):
col.prop(print_3d, "use_apply_scale") col.prop(print_3d, "use_apply_scale")
col.prop(print_3d, "use_export_texture") col.prop(print_3d, "use_export_texture")
sub = col.column() sub = col.column()
sub.active = print_3d.export_format in ("STL", "PLY")
sub.prop(print_3d, "use_ascii_export")
sub = col.column()
sub.active = print_3d.export_format != "STL" sub.active = print_3d.export_format != "STL"
sub.prop(print_3d, "use_data_layers") sub.prop(print_3d, "use_data_layers")