Print3D: use annotations

This commit is contained in:
Campbell Barton 2018-10-02 10:18:55 +10:00
parent 15cf78e2a5
commit 01370f8794
2 changed files with 96 additions and 94 deletions

View File

@ -59,64 +59,66 @@ else:
class Print3D_Scene_Props(PropertyGroup):
export_format = EnumProperty(
name="Format",
description="Format type to export to",
items=(('STL', "STL", ""),
('PLY', "PLY", ""),
('WRL', "VRML2", ""),
('X3D', "X3D", ""),
('OBJ', "OBJ", "")),
default='STL',
)
use_export_texture = BoolProperty(
name="Copy Textures",
description="Copy textures on export to the output path",
default=False,
)
use_apply_scale = BoolProperty(
name="Apply Scale",
description="Apply scene scale setting on export",
default=False,
)
export_path = StringProperty(
name="Export Directory",
description="Path to directory where the files are created",
default="//", maxlen=1024, subtype="DIR_PATH",
)
thickness_min = FloatProperty(
name="Thickness",
description="Minimum thickness",
subtype='DISTANCE',
default=0.001, # 1mm
min=0.0, max=10.0,
)
threshold_zero = FloatProperty(
name="Threshold",
description="Limit for checking zero area/length",
default=0.0001,
precision=5,
min=0.0, max=0.2,
)
angle_distort = FloatProperty(
name="Angle",
description="Limit for checking distorted faces",
subtype='ANGLE',
default=math.radians(45.0),
min=0.0, max=math.radians(180.0),
)
angle_sharp = FloatProperty(
name="Angle",
subtype='ANGLE',
default=math.radians(160.0),
min=0.0, max=math.radians(180.0),
)
angle_overhang = FloatProperty(
name="Angle",
subtype='ANGLE',
default=math.radians(45.0),
min=0.0, max=math.radians(90.0),
)
export_format: EnumProperty(
name="Format",
description="Format type to export to",
items=(
('STL', "STL", ""),
('PLY', "PLY", ""),
('WRL', "VRML2", ""),
('X3D', "X3D", ""),
('OBJ', "OBJ", ""),
),
default='STL',
)
use_export_texture: BoolProperty(
name="Copy Textures",
description="Copy textures on export to the output path",
default=False,
)
use_apply_scale: BoolProperty(
name="Apply Scale",
description="Apply scene scale setting on export",
default=False,
)
export_path: StringProperty(
name="Export Directory",
description="Path to directory where the files are created",
default="//", maxlen=1024, subtype="DIR_PATH",
)
thickness_min: FloatProperty(
name="Thickness",
description="Minimum thickness",
subtype='DISTANCE',
default=0.001, # 1mm
min=0.0, max=10.0,
)
threshold_zero: FloatProperty(
name="Threshold",
description="Limit for checking zero area/length",
default=0.0001,
precision=5,
min=0.0, max=0.2,
)
angle_distort: FloatProperty(
name="Angle",
description="Limit for checking distorted faces",
subtype='ANGLE',
default=math.radians(45.0),
min=0.0, max=math.radians(180.0),
)
angle_sharp: FloatProperty(
name="Angle",
subtype='ANGLE',
default=math.radians(160.0),
min=0.0, max=math.radians(180.0),
)
angle_overhang: FloatProperty(
name="Angle",
subtype='ANGLE',
default=math.radians(45.0),
min=0.0, max=math.radians(90.0),
)
# Update panel category name

View File

@ -23,15 +23,15 @@
import bpy
from bpy.types import Operator
from bpy.props import (
IntProperty,
FloatProperty,
)
IntProperty,
FloatProperty,
)
import bmesh
from . import (
mesh_helpers,
report,
)
mesh_helpers,
report,
)
def clean_float(text):
@ -430,16 +430,16 @@ class MESH_OT_Print3D_Clean_Non_Manifold(Operator):
bl_label = "Print3D Clean Non-Manifold and Inverted"
bl_options = {'REGISTER', 'UNDO'}
threshold = bpy.props.FloatProperty(
name="threshold",
description="Minimum distance between elements to merge",
default=0.0001,
)
sides = bpy.props.IntProperty(
name="sides",
description="Number of sides in hole required to fill",
default=4,
)
threshold: bpy.props.FloatProperty(
name="threshold",
description="Minimum distance between elements to merge",
default=0.0001,
)
sides: bpy.props.IntProperty(
name="sides",
description="Number of sides in hole required to fill",
default=4,
)
def execute(self, context):
self.context = context
@ -600,7 +600,7 @@ class MESH_OT_Print3D_Select_Report(Operator):
bl_label = "Print3D Select Report"
bl_options = {'INTERNAL'}
index = IntProperty()
index: IntProperty()
_type_to_mode = {
bmesh.types.BMVert: 'VERT',
@ -659,14 +659,14 @@ class MESH_OT_Print3D_Scale_To_Volume(Operator):
bl_label = "Scale to Volume"
bl_options = {'REGISTER', 'UNDO'}
volume_init = FloatProperty(
options={'HIDDEN'},
)
volume = FloatProperty(
name="Volume",
unit='VOLUME',
min=0.0, max=100000.0,
)
volume_init: FloatProperty(
options={'HIDDEN'},
)
volume: FloatProperty(
name="Volume",
unit='VOLUME',
min=0.0, max=100000.0,
)
def execute(self, context):
import math
@ -705,17 +705,17 @@ class MESH_OT_Print3D_Scale_To_Bounds(Operator):
bl_label = "Scale to Bounds"
bl_options = {'REGISTER', 'UNDO'}
length_init = FloatProperty(
options={'HIDDEN'},
)
axis_init = IntProperty(
options={'HIDDEN'},
)
length = FloatProperty(
name="Length Limit",
unit='LENGTH',
min=0.0, max=100000.0,
)
length_init: FloatProperty(
options={'HIDDEN'},
)
axis_init: IntProperty(
options={'HIDDEN'},
)
length: FloatProperty(
name="Length Limit",
unit='LENGTH',
min=0.0, max=100000.0,
)
def execute(self, context):
scale = self.length / self.length_init