Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
blender-addons
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blender
blender-addons
Commits
5ff6d0c4
Commit
5ff6d0c4
authored
4 years ago
by
Mikhail Rachinskiy
Browse files
Options
Downloads
Patches
Plain Diff
3D-Print: reduce the scope of mesh_helpers module
parent
7eff774b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
object_print3d_utils/__init__.py
+3
-2
3 additions, 2 deletions
object_print3d_utils/__init__.py
object_print3d_utils/operators.py
+21
-6
21 additions, 6 deletions
object_print3d_utils/operators.py
with
24 additions
and
8 deletions
object_print3d_utils/__init__.py
+
3
−
2
View file @
5ff6d0c4
...
...
@@ -21,7 +21,7 @@
bl_info
=
{
"
name
"
:
"
3D-Print Toolbox
"
,
"
author
"
:
"
Campbell Barton
"
,
"
blender
"
:
(
2
,
82
,
0
),
"
blender
"
:
(
3
,
0
,
0
),
"
location
"
:
"
3D View > Sidebar
"
,
"
description
"
:
"
Utilities for 3D printing
"
,
"
doc_url
"
:
"
{BLENDER_MANUAL_URL}/addons/mesh/3d_print_toolbox.html
"
,
...
...
@@ -34,7 +34,8 @@ if "bpy" in locals():
import
importlib
importlib
.
reload
(
ui
)
importlib
.
reload
(
operators
)
importlib
.
reload
(
mesh_helpers
)
if
"
mesh_helpers
"
in
locals
():
importlib
.
reload
(
mesh_helpers
)
if
"
export
"
in
locals
():
importlib
.
reload
(
export
)
else
:
...
...
This diff is collapsed.
Click to expand it.
object_print3d_utils/operators.py
+
21
−
6
View file @
5ff6d0c4
...
...
@@ -31,10 +31,7 @@ from bpy.props import (
)
import
bmesh
from
.
import
(
mesh_helpers
,
report
,
)
from
.
import
report
def
clean_float
(
text
:
str
)
->
str
:
...
...
@@ -48,8 +45,8 @@ def clean_float(text: str) -> str:
return
text
def
get_unit
(
unit_system
,
unit
)
->
tuple
[
float
,
str
]:
# Returns unit length relative to meter and symbol
def
get_unit
(
unit_system
:
str
,
unit
:
str
)
->
tuple
[
float
,
str
]:
# Returns unit length relative to meter and
unit
symbol
units
=
{
"
METRIC
"
:
{
...
...
@@ -84,6 +81,8 @@ class MESH_OT_print3d_info_volume(Operator):
bl_description
=
"
Report the volume of the active mesh
"
def
execute
(
self
,
context
):
from
.
import
mesh_helpers
scene
=
context
.
scene
unit
=
scene
.
unit_settings
scale
=
1.0
if
unit
.
system
==
'
NONE
'
else
unit
.
scale_length
...
...
@@ -113,6 +112,8 @@ class MESH_OT_print3d_info_area(Operator):
bl_description
=
"
Report the surface area of the active mesh
"
def
execute
(
self
,
context
):
from
.
import
mesh_helpers
scene
=
context
.
scene
unit
=
scene
.
unit_settings
scale
=
1.0
if
unit
.
system
==
'
NONE
'
else
unit
.
scale_length
...
...
@@ -164,6 +165,7 @@ class MESH_OT_print3d_check_solid(Operator):
@staticmethod
def
main_check
(
obj
,
info
):
import
array
from
.
import
mesh_helpers
bm
=
mesh_helpers
.
bmesh_copy_from_object
(
obj
,
transform
=
False
,
triangulate
=
False
)
...
...
@@ -189,6 +191,8 @@ class MESH_OT_print3d_check_intersections(Operator):
@staticmethod
def
main_check
(
obj
,
info
):
from
.
import
mesh_helpers
faces_intersect
=
mesh_helpers
.
bmesh_check_self_intersect_object
(
obj
)
info
.
append
((
f
"
Intersect Face:
{
len
(
faces_intersect
)
}
"
,
(
bmesh
.
types
.
BMFace
,
faces_intersect
)))
...
...
@@ -207,6 +211,7 @@ class MESH_OT_print3d_check_degenerate(Operator):
@staticmethod
def
main_check
(
obj
,
info
):
import
array
from
.
import
mesh_helpers
scene
=
bpy
.
context
.
scene
print_3d
=
scene
.
print_3d
...
...
@@ -234,6 +239,7 @@ class MESH_OT_print3d_check_distorted(Operator):
@staticmethod
def
main_check
(
obj
,
info
):
import
array
from
.
import
mesh_helpers
scene
=
bpy
.
context
.
scene
print_3d
=
scene
.
print_3d
...
...
@@ -265,6 +271,8 @@ class MESH_OT_print3d_check_thick(Operator):
@staticmethod
def
main_check
(
obj
,
info
):
from
.
import
mesh_helpers
scene
=
bpy
.
context
.
scene
print_3d
=
scene
.
print_3d
...
...
@@ -282,6 +290,8 @@ class MESH_OT_print3d_check_sharp(Operator):
@staticmethod
def
main_check
(
obj
,
info
):
from
.
import
mesh_helpers
scene
=
bpy
.
context
.
scene
print_3d
=
scene
.
print_3d
angle_sharp
=
print_3d
.
angle_sharp
...
...
@@ -309,6 +319,7 @@ class MESH_OT_print3d_check_overhang(Operator):
@staticmethod
def
main_check
(
obj
,
info
):
from
mathutils
import
Vector
from
.
import
mesh_helpers
scene
=
bpy
.
context
.
scene
print_3d
=
scene
.
print_3d
...
...
@@ -382,6 +393,8 @@ class MESH_OT_print3d_clean_distorted(Operator):
)
def
execute
(
self
,
context
):
from
.
import
mesh_helpers
obj
=
context
.
active_object
bm
=
mesh_helpers
.
bmesh_from_object
(
obj
)
bm
.
normal_update
()
...
...
@@ -646,6 +659,8 @@ class MESH_OT_print3d_scale_to_volume(Operator):
def
invoke
(
self
,
context
,
event
):
def
calc_volume
(
obj
):
from
.
import
mesh_helpers
bm
=
mesh_helpers
.
bmesh_copy_from_object
(
obj
,
apply_modifiers
=
True
)
volume
=
bm
.
calc_volume
(
signed
=
True
)
bm
.
free
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment