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
3b32f145
Commit
3b32f145
authored
10 years ago
by
Amanda Ghassaei
Browse files
Options
Downloads
Patches
Plain Diff
lattice model
parent
2d37b605
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
js/models/fillGeometry.js
+3
-4
3 additions, 4 deletions
js/models/fillGeometry.js
js/models/lattice.js
+20
-0
20 additions, 0 deletions
js/models/lattice.js
js/views/importView.js
+7
-8
7 additions, 8 deletions
js/views/importView.js
main.html
+4
-4
4 additions, 4 deletions
main.html
with
34 additions
and
16 deletions
js/models/fillGeometry.js
+
3
−
4
View file @
3b32f145
...
...
@@ -6,7 +6,6 @@
FillGeometry
=
Backbone
.
Model
.
extend
({
defaults
:
{
scale
:
1.0
,
material
:
new
THREE
.
MeshLambertMaterial
(
{
color
:
0xffa500
,
shading
:
THREE
.
FlatShading
,
...
...
@@ -23,9 +22,9 @@ FillGeometry = Backbone.Model.extend({
//bind events
this
.
on
(
"
change:mesh
"
,
this
.
getBounds
);
this
.
on
(
"
change:mesh
"
,
this
.
makeBoundingBoxHelper
);
this
.
on
(
"
change:scale
change:orientation
"
,
this
.
updateBoundingBox
);
this
.
on
(
"
change:orientation
"
,
this
.
updateBoundingBox
);
this
.
on
(
"
change:geometry
"
,
this
.
buildNewMesh
);
this
.
on
(
"
change:mesh
change:scale
change:orientation
"
,
this
.
render
);
this
.
on
(
"
change:mesh change:orientation
"
,
this
.
render
);
this
.
buildNewMesh
();
},
...
...
@@ -33,7 +32,7 @@ FillGeometry = Backbone.Model.extend({
buildNewMesh
:
function
(){
if
(
this
.
previous
(
"
mesh
"
))
three
.
scene
.
remove
(
this
.
previous
(
"
mesh
"
));
//remove current mesh from scene
this
.
set
({
scale
:
this
.
defaults
.
scale
,
orientation
:
this
.
defaults
.
orientation
},
{
silent
:
true
});
//restore defaults
this
.
set
({
orientation
:
this
.
defaults
.
orientation
},
{
silent
:
true
});
//restore defaults
var
mesh
=
new
THREE
.
Mesh
(
this
.
get
(
"
geometry
"
),
this
.
get
(
"
material
"
));
three
.
scene
.
add
(
mesh
);
this
.
set
({
mesh
:
mesh
});
...
...
This diff is collapsed.
Click to expand it.
js/models/lattice.js
0 → 100644
+
20
−
0
View file @
3b32f145
/**
* Created by aghassaei on 1/16/15.
*/
Lattice
=
Backbone
.
Model
.
extend
({
defaults
:
{
scale
:
1.0
},
initialize
:
function
(){
//bind events
}
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
js/views/importView.js
+
7
−
8
View file @
3b32f145
...
...
@@ -12,13 +12,12 @@ ImportView = Backbone.View.extend({
"
click .selectMesh
"
:
"
selectMesh
"
,
"
fileselect .btn-file :file
"
:
"
readDataURL
"
,
"
click .stlRotate
"
:
"
rotate
"
,
"
slide #modelScale
"
:
"
scale
"
},
initialize
:
function
(){
_
.
bindAll
(
this
,
"
render
"
,
"
onMeshLoad
"
);
this
.
model
.
bind
(
"
change:filename change:boundingBoxHelper
"
,
this
.
render
);
//boundingBoxHelper covers orientation
/scale
this
.
model
.
bind
(
"
change:filename change:boundingBoxHelper
"
,
this
.
render
);
//boundingBoxHelper covers orientation
this
.
render
();
},
...
...
@@ -61,9 +60,9 @@ ImportView = Backbone.View.extend({
this
.
model
.
set
(
"
geometry
"
,
e
.
content
);
},
scale
:
function
(
e
){
this
.
model
.
set
(
"
scale
"
,
$
(
e
.
target
).
slider
(
'
getValue
'
));
},
//
scale: function(e){
//
this.model.set("scale", $(e.target).slider('getValue'));
//
},
makeDimensionString
:
function
(){
var
bounds
=
this
.
model
.
get
(
"
boundingBoxHelper
"
).
box
;
...
...
@@ -111,9 +110,9 @@ ImportView = Backbone.View.extend({
</div>
\
</div> <!-- /.col-xs-3 -->
\
<div class="col-xs-9">
\
Geometry: <%= filename %><br/>
\
Dimensions: <%= dimensions %>
\
<div>Change model scale:</div
>
\
<div>
Geometry: <%= filename %><br/>
\
Dimensions: <%= dimensions %>
<br/>
\
Units: </div></br
>
\
<div class="col-xs-4">
\
<a href="#" data-axis="z" class="stlRotate btn btn-block btn-lg btn-default">Rotate X</a>
\
</div>
\
...
...
This diff is collapsed.
Click to expand it.
main.html
+
4
−
4
View file @
3b32f145
...
...
@@ -29,8 +29,9 @@
<script
src=
"dependencies/OrbitControls.js"
></script>
<script
src=
"js/threeMain.js"
></script>
<!--stl export-->
<!--stl
import/
export-->
<script
src=
"dependencies/THREE2STL.js"
></script>
<script
src=
"dependencies/loaders/STLLoader.js"
></script>
<!--numerical javascript-->
<script
src=
"dependencies/numeric-1.2.6.js"
></script>
...
...
@@ -39,17 +40,16 @@
<script
src=
"js/worker.js"
></script>
<script
src=
"js/persistentWorkers.js"
></script>
<!--global workers-->
<script
src=
"js/main.js"
></script>
<!--models-->
<script
src=
"js/models/fillGeometry.js"
></script>
<script
src=
"js/models/Lattice.js"
></script>
<!--views-->
<script
src=
"js/views/importView.js"
></script>
<script
src=
"js/main.js"
></script>
<script
src=
"dependencies/loaders/STLLoader.js"
></script>
<!--<script src="js/views/importMenu.js"></script>-->
<!--<script src="js/views/elementMenu.js"></script>-->
<script
src=
"js/views/exportMenu.js"
></script>
...
...
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