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
7b95b84a
Commit
7b95b84a
authored
10 years ago
by
Amanda Ghassaei
Browse files
Options
Downloads
Patches
Plain Diff
removing some stuff
parent
6c2d9bcc
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
js/menus/importMenu.js
+0
-107
0 additions, 107 deletions
js/menus/importMenu.js
with
0 additions
and
107 deletions
js/menus/importMenu.js
deleted
100644 → 0
+
0
−
107
View file @
6c2d9bcc
/**
* Created by aghassaei on 1/8/15.
*/
$
(
function
(){
three
=
three
||
{};
workers
=
workers
||
{};
modelMesh
=
{};
var
modelScaleSlider
=
$
(
'
#stlModelScale
'
);
function
loadSTL
(
file
){
var
loader
=
new
THREE
.
STLLoader
();
loader
.
addEventListener
(
'
load
'
,
function
(
e
)
{
var
geometry
=
e
.
content
;
resetUI
();
// _.each(workers.allWorkers, function(worker){
// worker.postMessage({model: JSON.stringify(e.content)});
// });
var
material
=
new
THREE
.
MeshLambertMaterial
(
{
color
:
0xffa500
,
shading
:
THREE
.
FlatShading
,
transparent
:
true
,
opacity
:
0.5
,
side
:
THREE
.
DoubleSide
}
);
modelMesh
=
new
THREE
.
Mesh
(
geometry
,
material
);
three
.
scene
.
add
(
modelMesh
);
three
.
render
();
showDimensions
(
1
);
$
(
"
#STLImportStats
"
).
fadeIn
();
});
loader
.
load
(
file
);
}
function
resetUI
(){
three
.
clearAll
();
modelScaleSlider
.
slider
(
'
setValue
'
,
1
);
}
//load file from data folder
$
(
"
.stlImport
"
).
click
(
function
(
e
){
e
.
preventDefault
();
var
fileName
=
$
(
this
).
data
(
"
file
"
);
loadSTL
(
'
data/
'
+
fileName
);
setFileName
(
fileName
);
});
//upload from local filesystem
$
(
"
#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
]);
input
.
val
(
""
);
});
$
(
'
.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
);
setFileName
(
label
);
}
})();
});
modelScaleSlider
.
slider
({
formatter
:
function
(
value
)
{
return
value
;
}
});
modelScaleSlider
.
change
(
function
(){
var
value
=
$
(
this
).
slider
(
'
getValue
'
);
modelMesh
.
scale
.
set
(
value
,
value
,
value
);
showDimensions
(
value
);
three
.
render
();
});
function
setFileName
(
name
){
$
(
"
#STLFilename
"
).
html
(
"
Current file loaded:  
"
+
name
);
}
function
showDimensions
(
scale
,
orintation
){
//todo add in orientation effects
var
bounds
=
this
.
model
.
get
(
"
bounds
"
);
$
(
"
#meshDimensions
"
).
html
(
"
Dimensions:
"
+
((
bounds
.
max
.
x
-
bounds
.
min
.
x
)
*
scale
).
toFixed
(
1
)
+
"
x
"
+
((
bounds
.
max
.
y
-
bounds
.
min
.
y
)
*
scale
).
toFixed
(
1
)
+
"
x
"
+
((
bounds
.
max
.
z
-
bounds
.
min
.
z
)
*
scale
).
toFixed
(
1
));
}
$
(
"
#stlRotateX
"
).
click
(
function
(
e
){
e
.
preventDefault
();
modelMesh
.
rotateX
(
Math
.
PI
/
2
);
three
.
render
();
});
$
(
"
#stlRotateY
"
).
click
(
function
(
e
){
e
.
preventDefault
();
modelMesh
.
rotateY
(
Math
.
PI
/
2
);
three
.
render
();
});
$
(
"
#stlRotateZ
"
).
click
(
function
(
e
){
e
.
preventDefault
();
modelMesh
.
rotateZ
(
Math
.
PI
/
2
);
three
.
render
();
});
});
\ No newline at end of file
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