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
c462c38d
Commit
c462c38d
authored
10 years ago
by
Amanda Ghassaei
Browse files
Options
Downloads
Patches
Plain Diff
dimensions added back in
parent
2ceb0dc7
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/main.js
+1
-1
1 addition, 1 deletion
js/main.js
js/models/fillGeometry.js
+9
-1
9 additions, 1 deletion
js/models/fillGeometry.js
js/views/importMenu.js
+5
-4
5 additions, 4 deletions
js/views/importMenu.js
js/views/importView.js
+5
-3
5 additions, 3 deletions
js/views/importView.js
with
20 additions
and
9 deletions
js/main.js
+
1
−
1
View file @
c462c38d
...
@@ -8,7 +8,7 @@ $(function(){
...
@@ -8,7 +8,7 @@ $(function(){
three
=
Three
();
three
=
Three
();
//init models and views
//init models and views
window
.
fillGeometry
=
new
FillGeometry
();
//init a singleton, add to global scope
fillGeometry
=
new
FillGeometry
();
//init a singleton, add to global scope
new
ImportView
({
model
:
window
.
fillGeometry
});
new
ImportView
({
model
:
window
.
fillGeometry
});
...
...
This diff is collapsed.
Click to expand it.
js/models/fillGeometry.js
+
9
−
1
View file @
c462c38d
...
@@ -15,7 +15,7 @@ FillGeometry = Backbone.Model.extend({
...
@@ -15,7 +15,7 @@ FillGeometry = Backbone.Model.extend({
side
:
THREE
.
DoubleSide
}),
side
:
THREE
.
DoubleSide
}),
geometry
:
new
THREE
.
BoxGeometry
(
100
,
100
,
100
),
geometry
:
new
THREE
.
BoxGeometry
(
100
,
100
,
100
),
filename
:
"
Cube
"
,
filename
:
"
Cube
"
,
orientation
:
""
,
orientation
:
[
0
,
0
,
0
]
},
},
initialize
:
function
(){
initialize
:
function
(){
...
@@ -53,11 +53,14 @@ FillGeometry = Backbone.Model.extend({
...
@@ -53,11 +53,14 @@ FillGeometry = Backbone.Model.extend({
makeBoundingBoxHelper
:
function
(){
makeBoundingBoxHelper
:
function
(){
var
helper
=
new
THREE
.
BoundingBoxHelper
(
this
.
get
(
"
mesh
"
),
0x000000
);
var
helper
=
new
THREE
.
BoundingBoxHelper
(
this
.
get
(
"
mesh
"
),
0x000000
);
this
.
set
(
"
boundingBoxHelper
"
,
helper
);
this
.
set
(
"
boundingBoxHelper
"
,
helper
);
helper
.
update
();
three
.
scene
.
add
(
helper
.
object
);
three
.
scene
.
add
(
helper
.
object
);
console
.
log
(
helper
.
box
);
},
},
updateBoundingBox
:
function
(){
updateBoundingBox
:
function
(){
this
.
get
(
"
boundingBoxHelper
"
).
update
();
this
.
get
(
"
boundingBoxHelper
"
).
update
();
console
.
log
(
helper
.
box
);
// var boundingBox = this.get("geometry").boundingBox;
// var boundingBox = this.get("geometry").boundingBox;
// if (!boundingBox){
// if (!boundingBox){
...
@@ -75,14 +78,19 @@ FillGeometry = Backbone.Model.extend({
...
@@ -75,14 +78,19 @@ FillGeometry = Backbone.Model.extend({
},
},
rotate
:
function
(
axis
){
rotate
:
function
(
axis
){
var
orientation
=
this
.
get
(
"
orientation
"
);
var
mesh
=
this
.
get
(
"
mesh
"
);
var
mesh
=
this
.
get
(
"
mesh
"
);
if
(
axis
==
"
x
"
){
if
(
axis
==
"
x
"
){
mesh
.
rotateX
(
Math
.
PI
/
2
);
mesh
.
rotateX
(
Math
.
PI
/
2
);
orientation
[
0
]
+=
Math
.
PI
/
2
;
}
else
if
(
axis
==
"
y
"
){
}
else
if
(
axis
==
"
y
"
){
mesh
.
rotateX
(
Math
.
PI
/
2
);
mesh
.
rotateX
(
Math
.
PI
/
2
);
orientation
[
1
]
+=
Math
.
PI
/
2
;
}
else
{
}
else
{
mesh
.
rotateX
(
Math
.
PI
/
2
);
mesh
.
rotateX
(
Math
.
PI
/
2
);
orientation
[
2
]
+=
Math
.
PI
/
2
;
}
}
this
.
trigger
(
"
change:orientation
"
);
}
}
});
});
...
...
This diff is collapsed.
Click to expand it.
js/views/importMenu.js
+
5
−
4
View file @
c462c38d
...
@@ -80,10 +80,11 @@ $(function(){
...
@@ -80,10 +80,11 @@ $(function(){
$
(
"
#STLFilename
"
).
html
(
"
Current file loaded:  
"
+
name
);
$
(
"
#STLFilename
"
).
html
(
"
Current file loaded:  
"
+
name
);
}
}
function
showDimensions
(
scale
){
function
showDimensions
(
scale
,
orintation
){
var
boundingBox
=
modelMesh
.
geometry
.
boundingBox
;
//todo add in orientation effects
$
(
"
#meshDimensions
"
).
html
(
"
Dimensions:
"
+
((
boundingBox
.
max
.
x
-
boundingBox
.
min
.
x
)
*
scale
).
toFixed
(
1
)
+
"
x
"
+
var
bounds
=
this
.
model
.
get
(
"
bounds
"
);
((
boundingBox
.
max
.
y
-
boundingBox
.
min
.
y
)
*
scale
).
toFixed
(
1
)
+
"
x
"
+
((
boundingBox
.
max
.
z
-
boundingBox
.
min
.
z
)
*
scale
).
toFixed
(
1
));
$
(
"
#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
){
$
(
"
#stlRotateX
"
).
click
(
function
(
e
){
...
...
This diff is collapsed.
Click to expand it.
js/views/importView.js
+
5
−
3
View file @
c462c38d
...
@@ -66,9 +66,11 @@ ImportView = Backbone.View.extend({
...
@@ -66,9 +66,11 @@ ImportView = Backbone.View.extend({
},
},
makeDimensionString
:
function
(){
makeDimensionString
:
function
(){
// var boundingBox = this.model.get("boundingBox");
//todo add in orientation effects
// return ((boundingBox.max.x - boundingBox.min.x)*scale).toFixed(1) + " x " +
var
scale
=
this
.
model
.
get
(
"
scale
"
);
// ((boundingBox.max.y - boundingBox.min.y)*scale).toFixed(1) + " x " + ((boundingBox.max.z - boundingBox.min.z)*scale).toFixed(1);
var
bounds
=
this
.
model
.
get
(
"
bounds
"
);
return
((
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
);
},
},
rotate
:
function
(
e
){
rotate
:
function
(
e
){
...
...
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