1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
21 # Interface for this addon.
24 from bpy
.types
import Panel
30 class View3DPrintPanel
:
31 bl_category
= "3D-Print"
32 bl_space_type
= 'VIEW_3D'
36 def poll(cls
, context
):
37 obj
= context
.active_object
38 return obj
is not None and obj
.type == 'MESH' and obj
.mode
in {'OBJECT', 'EDIT'}
41 class VIEW3D_PT_print3d_analyze(View3DPrintPanel
, Panel
):
45 bmesh
.types
.BMVert
: 'VERTEXSEL',
46 bmesh
.types
.BMEdge
: 'EDGESEL',
47 bmesh
.types
.BMFace
: 'FACESEL',
50 def draw_report(self
, context
):
55 is_edit
= context
.edit_object
is not None
57 layout
.label(text
="Result")
61 for i
, (text
, data
) in enumerate(info
):
62 if is_edit
and data
and data
[1]:
63 bm_type
, _bm_array
= data
64 col
.operator("mesh.print3d_select_report", text
=text
, icon
=self
._type
_to
_icon
[bm_type
],).index
= i
68 def draw(self
, context
):
71 print_3d
= context
.scene
.print_3d
75 layout
.label(text
="Statistics")
76 row
= layout
.row(align
=True)
77 row
.operator("mesh.print3d_info_volume", text
="Volume")
78 row
.operator("mesh.print3d_info_area", text
="Area")
80 layout
.label(text
="Checks")
81 col
= layout
.column(align
=True)
82 col
.operator("mesh.print3d_check_solid", text
="Solid")
83 col
.operator("mesh.print3d_check_intersect", text
="Intersections")
84 row
= col
.row(align
=True)
85 row
.operator("mesh.print3d_check_degenerate", text
="Degenerate")
86 row
.prop(print_3d
, "threshold_zero", text
="")
87 row
= col
.row(align
=True)
88 row
.operator("mesh.print3d_check_distort", text
="Distorted")
89 row
.prop(print_3d
, "angle_distort", text
="")
90 row
= col
.row(align
=True)
91 row
.operator("mesh.print3d_check_thick", text
="Thickness")
92 row
.prop(print_3d
, "thickness_min", text
="")
93 row
= col
.row(align
=True)
94 row
.operator("mesh.print3d_check_sharp", text
="Edge Sharp")
95 row
.prop(print_3d
, "angle_sharp", text
="")
96 row
= col
.row(align
=True)
97 row
.operator("mesh.print3d_check_overhang", text
="Overhang")
98 row
.prop(print_3d
, "angle_overhang", text
="")
99 layout
.operator("mesh.print3d_check_all", text
="Check All")
101 self
.draw_report(context
)
104 class VIEW3D_PT_print3d_cleanup(View3DPrintPanel
, Panel
):
105 bl_label
= "Clean Up"
106 bl_options
= {"DEFAULT_CLOSED"}
108 def draw(self
, context
):
111 print_3d
= context
.scene
.print_3d
113 row
= layout
.row(align
=True)
114 row
.operator("mesh.print3d_clean_distorted", text
="Distorted")
115 row
.prop(print_3d
, "angle_distort", text
="")
116 layout
.operator("mesh.print3d_clean_non_manifold", text
="Make Manifold")
118 # layout.operator("mesh.print3d_clean_thin", text="Wall Thickness")
121 class VIEW3D_PT_print3d_transform(View3DPrintPanel
, Panel
):
122 bl_label
= "Transform"
123 bl_options
= {"DEFAULT_CLOSED"}
125 def draw(self
, context
):
128 layout
.label(text
="Scale To")
129 row
= layout
.row(align
=True)
130 row
.operator("mesh.print3d_scale_to_volume", text
="Volume")
131 row
.operator("mesh.print3d_scale_to_bounds", text
="Bounds")
134 class VIEW3D_PT_print3d_export(View3DPrintPanel
, Panel
):
136 bl_options
= {"DEFAULT_CLOSED"}
138 def draw(self
, context
):
140 layout
.use_property_split
= True
141 layout
.use_property_decorate
= False
143 print_3d
= context
.scene
.print_3d
145 layout
.prop(print_3d
, "export_path", text
="")
147 col
= layout
.column()
148 col
.prop(print_3d
, "use_apply_scale")
149 col
.prop(print_3d
, "use_export_texture")
151 layout
.prop(print_3d
, "export_format")
152 layout
.operator("mesh.print3d_export", text
="Export", icon
='EXPORT')