Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Instrument Control
Protos
Nomad 3D
nomad-3d-commons
Commits
8850d263
Commit
8850d263
authored
Jun 09, 2017
by
Ivan Dages
Browse files
fix converter : blender script moved
parent
1df3aa43
Changes
4
Hide whitespace changes
Inline
Side-by-side
scripts/simplify.py
deleted
100644 → 0
View file @
1df3aa43
import
sys
,
os
,
glob
import
bpy
def
printUsage
():
print
(
"Usage : "
)
print
(
"blender --background --python simplify.py file.STL input_dir output_dir"
)
print
(
"[INFO] Blender executable : "
+
sys
.
argv
[
0
])
print
(
"[INFO] Working directory : "
+
os
.
getcwd
())
print
(
" "
)
# Clear scene
print
(
"[INFO] Clearing scene..."
)
bpy
.
ops
.
object
.
select_all
(
action
=
'SELECT'
)
bpy
.
ops
.
object
.
delete
()
decimateRatio
=
0.5
if
len
(
sys
.
argv
)
>=
7
:
decimateRatio
=
float
(
sys
.
argv
[
6
])
if
len
(
sys
.
argv
)
<
5
:
print
(
"[ERROR] No input directory provided"
)
printUsage
()
exit
(
1
)
elif
len
(
sys
.
argv
)
<
6
:
print
(
"[ERROR] No output directory provided"
)
printUsage
()
exit
(
1
)
else
:
inDirPath
=
sys
.
argv
[
4
]
outDirPath
=
sys
.
argv
[
5
]
stlFiles
=
glob
.
glob
(
os
.
path
.
join
(
inDirPath
,
"*.STL"
))
i
=
0
for
file
in
stlFiles
:
i
=
i
+
1
print
(
"[INFO] File "
+
str
(
i
)
+
" / "
+
str
(
len
(
stlFiles
)))
fileName
=
os
.
path
.
basename
(
file
)
inFilePath
=
os
.
path
.
join
(
inDirPath
,
fileName
)
outFilePath
=
os
.
path
.
join
(
outDirPath
,
fileName
)
print
(
"[INFO] STL file : "
+
fileName
)
bpy
.
ops
.
import_mesh
.
stl
(
filepath
=
inFilePath
,
files
=
[{
"name"
:
fileName
,
"name"
:
fileName
}],
directory
=
inDirPath
)
bpy
.
ops
.
object
.
select_all
(
action
=
'SELECT'
)
bpy
.
ops
.
object
.
mode_set
(
mode
=
'EDIT'
)
bpy
.
ops
.
mesh
.
remove_doubles
()
bpy
.
ops
.
mesh
.
normals_make_consistent
()
bpy
.
ops
.
mesh
.
decimate
(
ratio
=
decimateRatio
)
# Change of coordinate system
bpy
.
ops
.
object
.
mode_set
(
mode
=
'OBJECT'
)
factor
=
0.99
# z-fighting
bpy
.
ops
.
transform
.
resize
(
value
=
(
factor
,
-
factor
,
-
factor
))
bpy
.
ops
.
export_mesh
.
stl
(
filepath
=
outFilePath
)
bpy
.
ops
.
object
.
delete
()
print
(
" "
)
print
(
"[INFO] Work done, exiting Blender..."
)
exit
()
scripts/simplify.sh
deleted
100644 → 0
View file @
1df3aa43
#!/bin/bash
directory
=
"
$1
"
# Remove last '/' if there is one
directory
=
${
directory
%/
}
outDirectory
=
"
$2
"
outDirectory
=
${
outDirectory
%/
}
if
[
-d
"
$outDirectory
"
]
then
rm
--verbose
-rf
"
$outDirectory
"
fi
mkdir
--verbose
-p
"
$outDirectory
"
for
xmlFile
in
"
$directory
"
/
*
.xml
do
echo
"
$xmlFile
"
cp
--verbose
"
$xmlFile
"
"
$outDirectory
"
done
echo
"SW export directory :
$directory
"
echo
"Blender export directory :
$outDirectory
"
echo
""
/c/Program
\
Files/Blender
\
Foundation/Blender/blender.exe
--background
--python
simplify.py
"
$directory
"
"
$outDirectory
"
scripts/test_stl.sh
deleted
100644 → 0
View file @
1df3aa43
#!/bin/bash
dir1
=
"
$1
"
dir1
=
${
dir1
%/
}
dir2
=
"
$2
"
dir2
=
${
dir2
%/
}
for
filePath
in
"
$dir1
"
/
*
.STL
do
file
=
${
filePath
##*/
}
echo
"
$file
:"
diff
"
$dir1
"
/
"
$file
"
"
$dir2
"
/
"
$file
"
done
\ No newline at end of file
src/main/java/fr/ill/ics/n3d/model/Component.java
View file @
8850d263
...
...
@@ -220,11 +220,13 @@ public class Component {
return
false
;
}
child
.
parent
=
null
;
try
{
((
Group
)
this
.
sceneNode
).
getChildren
().
remove
(
child
.
getSceneNode
());
((
Group
)
this
.
sceneNode
).
getChildren
().
remove
(
child
.
getAxis
().
getVisualGroup
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
if
(
this
.
sceneNode
!=
null
)
{
try
{
((
Group
)
this
.
sceneNode
).
getChildren
().
remove
(
child
.
getSceneNode
());
((
Group
)
this
.
sceneNode
).
getChildren
().
remove
(
child
.
getAxis
().
getVisualGroup
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
return
this
.
children
.
remove
(
child
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment