Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DMDesign
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
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
Amanda Ghassaei
DMDesign
Commits
388a5e10
Commit
388a5e10
authored
10 years ago
by
Amanda Ghassaei
Browse files
Options
Downloads
Patches
Plain Diff
stl uploader
parent
8c724177
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
css/main.css
+21
-0
21 additions, 0 deletions
css/main.css
js/importSTL.js
+21
-3
21 additions, 3 deletions
js/importSTL.js
main.html
+4
-1
4 additions, 1 deletion
main.html
with
46 additions
and
4 deletions
css/main.css
+
21
−
0
View file @
388a5e10
...
...
@@ -42,3 +42,24 @@ body {
nav
.btn
{
margin-top
:
5px
;
}
.btn-file
input
[
type
=
file
]
{
position
:
absolute
;
top
:
0
;
right
:
0
;
min-width
:
100%
;
min-height
:
100%
;
font-size
:
100px
;
text-align
:
right
;
filter
:
alpha
(
opacity
=
0
);
opacity
:
0
;
outline
:
none
;
background
:
white
;
cursor
:
inherit
;
display
:
block
;
}
.btn-file
{
position
:
relative
;
overflow
:
hidden
;
}
This diff is collapsed.
Click to expand it.
js/importSTL.js
+
21
−
3
View file @
388a5e10
...
...
@@ -6,7 +6,7 @@ $(function(){
threeMain
=
threeMain
||
{};
function
loadSTL
(
file
name
){
function
loadSTL
(
file
){
var
loader
=
new
THREE
.
STLLoader
();
loader
.
addEventListener
(
'
load
'
,
function
(
e
)
{
...
...
@@ -14,12 +14,30 @@ $(function(){
threeMain
.
scene
.
add
(
new
THREE
.
Mesh
(
geometry
)
);
});
loader
.
load
(
'
data/
'
+
filename
);
loader
.
load
(
file
);
}
$
(
"
.stlImport
"
).
click
(
function
(
e
){
e
.
preventDefault
();
loadSTL
(
$
(
this
).
data
(
"
file
"
));
loadSTL
(
'
data/
'
+
$
(
this
).
data
(
"
file
"
));
});
$
(
"
#uploadSTL
"
).
change
(
function
()
{
var
input
=
$
(
this
),
numFiles
=
input
.
get
(
0
).
files
?
input
.
get
(
0
).
files
.
length
:
1
,
label
=
input
.
val
().
replace
(
/
\\
/g
,
'
/
'
).
replace
(
/.*
\/
/
,
''
);
input
.
trigger
(
'
fileselect
'
,
[
numFiles
,
label
,
input
.
get
(
0
).
files
]);
});
$
(
'
.btn-file :file
'
).
on
(
'
fileselect
'
,
function
(
event
,
numFiles
,
label
,
files
)
{
var
reader
=
new
FileReader
();
reader
.
readAsDataURL
(
files
[
0
]);
reader
.
onload
=
(
function
()
{
return
function
(
e
)
{
loadSTL
(
e
.
target
.
result
);
}
})();
console
.
log
(
"
loaded
"
+
label
);
});
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
main.html
+
4
−
1
View file @
388a5e10
...
...
@@ -72,7 +72,10 @@
<div
id=
"importGeometry"
class=
"row navMenu"
>
<div
class=
"row demo-row"
>
<div
class=
"col-xs-3"
>
<a
href=
"#fakelink"
class=
"btn btn-block btn-lg btn-default"
>
Upload STL
</a>
<span
class=
"btn btn-default btn-file"
>
Upload STL
<input
id=
"uploadSTL"
type=
"file"
>
</span>
<!--<a id="uploadSTL" href="#fakelink" class="btn btn-block btn-lg btn-default">Upload STL</a>-->
</div>
<div
class=
"col-xs-1"
>
OR
...
...
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