Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mods
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
mods
Commits
f19eabde
Commit
f19eabde
authored
6 years ago
by
Neil Gershenfeld
Browse files
Options
Downloads
Patches
Plain Diff
2.5D working?
parent
47934396
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/processes/mill/raster/2.5D
+17
-63
17 additions, 63 deletions
modules/processes/mill/raster/2.5D
programs/processes/mill/raster/2.5D
+1
-1
1 addition, 1 deletion
programs/processes/mill/raster/2.5D
with
18 additions
and
64 deletions
modules/processes/mill/raster/2.5D
+
17
−
63
View file @
f19eabde
...
...
@@ -56,8 +56,8 @@ var inputs = {
//
// calculation in progress, draw and accumulate
//
draw_
layer
(evt.detail)
accumulate_
layer
(evt.detail)
draw_
path
(evt.detail)
accumulate_
path
(evt.detail)
mod.offsetCount += 1
if ((mod.offsetCount != parseInt(mod.number.value))
&& (evt.detail.length > 0)) {
...
...
@@ -73,7 +73,7 @@ var inputs = {
// layer loop not complete
//
merge_layer()
accumulate_path()
accumulate_
tool
path()
clear_layer()
mod.depthmm += parseFloat(mod.cut_mm.value)
if (mod.depthmm > parseFloat(mod.max_mm.value)) {
...
...
@@ -98,8 +98,8 @@ var inputs = {
//
// done, finish and output
//
//
draw_path(mod.path)
//
draw_connections()
draw_path(mod.
tool
path)
draw_connections(
mod.toolpath
)
mod.label.nodeValue = 'calculate'
mod.labelspan.style.fontWeight = 'normal'
outputs.toolpath.event()
...
...
@@ -422,11 +422,11 @@ function clear_layer() {
svg.appendChild(g)
}
//
// accumulate_
layer
// accumulate_
path
// todo: replace inefficient insertion sort
// todo: move sort out of main thread
//
function accumulate_
layer
(path) {
function accumulate_
path
(path) {
var forward = mod.forward.checked
var conventional = mod.conventional.checked
var sort = mod.sort.checked
...
...
@@ -485,9 +485,9 @@ function merge_layer() {
}
}
//
// accumulate_path
// accumulate_
tool
path
//
function accumulate_path() {
function accumulate_
tool
path() {
for (var seg = 0; seg < mod.path.length; ++seg) {
var newseg = []
for (var pt = 0; pt < mod.path[seg].length; ++pt) {
...
...
@@ -499,55 +499,9 @@ function accumulate_path() {
}
}
//
// add_depth
//
function add_depth() {
var cut = parseFloat(mod.cut_in.value)
var max = parseFloat(mod.max_in.value)
var newpath = []
for (var seg = 0; seg < mod.path.length; ++seg) {
var depth = cut
if (mod.path[seg][0][0] == mod.path[seg][mod.path[seg].length-1][0]) {
var newseg = []
while (depth <= max) {
var idepth = -Math.round(mod.dpi*depth)
for (var pt = 0; pt < mod.path[seg].length; ++pt) {
var point = mod.path[seg][pt].concat(idepth)
newseg.splice(newseg.length,0,point)
}
if (depth == max)
break
depth += cut
if (depth > max)
depth = max
}
newpath.splice(newpath.length,0,newseg)
}
else {
var newseg = []
while (depth <= max) {
var idepth = -Math.round(mod.dpi*depth)
for (var pt = 0; pt < mod.path[seg].length; ++pt) {
var point = mod.path[seg][pt].concat(idepth)
newseg.splice(newseg.length,0,point)
}
newpath.splice(newpath.length,0,newseg)
newseg = []
if (depth == max)
break
depth += cut
if (depth > max)
depth = max
}
}
}
mod.path = newpath
mod.depth = Math.round(parseFloat(mod.max_in.value)*mod.dpi)
}
//
// draw_layer
// draw_path
//
function draw_
layer
(path) {
function draw_
path
(path) {
var g = document.getElementById(mod.div.id+'g')
var h = mod.img.height
var w = mod.img.width
...
...
@@ -601,14 +555,14 @@ function draw_layer(path) {
//
// draw_connections
//
function draw_connections() {
function draw_connections(
path
) {
var g = document.getElementById(mod.div.id+'g')
var h = mod.img.height
var w = mod.img.width
//
// loop over segments
//
for (var segment = 1; segment <
mod.
path.length; ++segment) {
for (var segment = 1; segment < path.length; ++segment) {
//
// draw connection from previous segment
//
...
...
@@ -617,10 +571,10 @@ function draw_connections() {
line.setAttribute('stroke','red')
line.setAttribute('stroke-width',1)
line.setAttribute('stroke-linecap','round')
var x1 =
mod.
path[segment-1][
mod.
path[segment-1].length-1][0]
var y1 = h-
mod.
path[segment-1][
mod.
path[segment-1].length-1][1]-1
var x2 =
mod.
path[segment][0][0]
var y2 = h-
mod.
path[segment][0][1]-1
var x1 = path[segment-1][path[segment-1].length-1][0]
var y1 = h-path[segment-1][path[segment-1].length-1][1]-1
var x2 = path[segment][0][0]
var y2 = h-path[segment][0][1]-1
line.setAttribute('x1',x1)
line.setAttribute('y1',y1)
line.setAttribute('x2',x2)
...
...
This diff is collapsed.
Click to expand it.
programs/processes/mill/raster/2.5D
+
1
−
1
View file @
f19eabde
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