Открыть боковую панель
nikitronn
sverchok
Коммиты
ff37808c
Не подтверждена
Коммит
ff37808c
создал
Июн 26, 2022
по автору
Dealga McArdle
Зафиксировано автором
GitHub
Июн 26, 2022
Просмотр файлов
adds cleanup into module (#4544)
владелец
3fb0371c
Изменения
1
Скрыть пробелы
Построчно
Рядом
utils/modules/FreeCAD_utils.py
Просмотр файла @
ff37808c
...
@@ -15,6 +15,34 @@ if FreeCAD:
...
@@ -15,6 +15,34 @@ if FreeCAD:
def
rounded
(
rgba
,
level
=
5
):
def
rounded
(
rgba
,
level
=
5
):
return
tuple
(
round
(
c
,
level
)
for
c
in
rgba
)
return
tuple
(
round
(
c
,
level
)
for
c
in
rgba
)
def
cleanup
(
faces
,
faces_data
):
"""
this avoids the following bmesh exception:
faces.new(verts): face already exists
"""
faces_set
=
set
()
new_faces
=
[]
new_faces_data
=
[]
good_face
=
new_faces
.
append
good_face_data
=
new_faces_data
.
append
for
idx
,
face
in
enumerate
(
faces
):
proposed_face
=
tuple
(
sorted
(
face
))
if
proposed_face
in
faces_set
:
continue
else
:
faces_set
.
add
(
proposed_face
)
good_face
(
face
)
if
faces_data
:
color
=
faces_data
[
0
]
if
len
(
faces_data
)
==
1
else
faces_data
[
idx
]
good_face_data
(
color
)
return
new_faces
,
new_faces_data
from
sverchok.utils.decorators
import
duration
from
sverchok.utils.decorators
import
duration
import
Part
import
Part
...
@@ -118,7 +146,7 @@ if FreeCAD:
...
@@ -118,7 +146,7 @@ if FreeCAD:
skiphidden
=
True
,
skiphidden
=
True
,
scale
=
1.0
,
scale
=
1.0
,
sharemats
=
True
,
sharemats
=
True
,
re
port
=
Non
e
):
re
move_duplicate_faces
=
Tru
e
):
guidata
=
get_guidata
(
filename
)
guidata
=
get_guidata
(
filename
)
...
@@ -258,8 +286,6 @@ if FreeCAD:
...
@@ -258,8 +286,6 @@ if FreeCAD:
new_quaternion
=
Quaternion
((
w
,
x
,
y
,
z
))
new_quaternion
=
Quaternion
((
w
,
x
,
y
,
z
))
current_obj
.
matrix
=
new_quaternion
.
to_matrix
().
to_4x4
()
current_obj
.
matrix
=
new_quaternion
.
to_matrix
().
to_4x4
()
current_obj
.
loc
=
placement
.
Base
.
multiply
(
scale
)[:]
current_obj
.
loc
=
placement
.
Base
.
multiply
(
scale
)[:]
obj_data
.
append
(
current_obj
)
if
verts
and
(
faces
or
edges
):
if
verts
and
(
faces
or
edges
):
...
@@ -300,7 +326,13 @@ if FreeCAD:
...
@@ -300,7 +326,13 @@ if FreeCAD:
polycolors
.
append
(
rgba
)
polycolors
.
append
(
rgba
)
FreeCAD
.
closeDocument
(
docname
)
if
remove_duplicate_faces
and
current_obj
.
faces
:
current_obj
.
faces
,
current_obj
.
polycolors
=
cleanup
(
current_obj
.
faces
,
current_obj
.
polycolors
)
obj_data
.
append
(
current_obj
)
FreeCAD
.
closeDocument
(
docname
)
print
(
"Import finished without errors"
)
print
(
"Import finished without errors"
)
return
obj_data
return
obj_data
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать