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
3614d7ae
Commit
3614d7ae
authored
6 years ago
by
Neil Gershenfeld
Browse files
Options
Downloads
Patches
Plain Diff
ready to accumulate
parent
dfbf2d1a
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/processes/mill/raster/2.5D
+41
-37
41 additions, 37 deletions
modules/processes/mill/raster/2.5D
with
41 additions
and
37 deletions
modules/processes/mill/raster/2.5D
+
41
−
37
View file @
3614d7ae
...
@@ -54,10 +54,10 @@ var inputs = {
...
@@ -54,10 +54,10 @@ var inputs = {
event:function(evt){
event:function(evt){
if (mod.label.nodeValue == 'calculating') {
if (mod.label.nodeValue == 'calculating') {
//
//
// calculation in progress,
sho
w and accumulate
// calculation in progress,
dra
w and accumulate
//
//
draw_
path
(evt.detail)
draw_
layer
(evt.detail)
accumulate_
path
(evt.detail)
accumulate_
layer
(evt.detail)
mod.offsetCount += 1
mod.offsetCount += 1
if ((mod.offsetCount != parseInt(mod.number.value))
if ((mod.offsetCount != parseInt(mod.number.value))
&& (evt.detail.length > 0)) {
&& (evt.detail.length > 0)) {
...
@@ -65,32 +65,34 @@ var inputs = {
...
@@ -65,32 +65,34 @@ var inputs = {
// layer detail present and offset not complete
// layer detail present and offset not complete
//
//
mod.offset += parseFloat(mod.stepover.value)
mod.offset += parseFloat(mod.stepover.value)
outputs.offset.event()
outputs.offset.event(
mod.offset*parseFloat(mod.dia_in.value)*mod.dpi)
}
}
else if (mod.depth < parseFloat(mod.max_mm.value)) {
else if (mod.depth
mm
< parseFloat(mod.max_mm.value)) {
//
//
// layer loop not complete
// layer loop not complete
//
//
merge_
path
()
merge_
layer
()
accumulate_
tool
path()
accumulate_path()
clear_
path
()
clear_
layer
()
mod.depth += parseFloat(mod.cut_mm.value)
mod.depth
mm
+= parseFloat(mod.cut_mm.value)
if (mod.depth > parseFloat(mod.max_mm.value)) {
if (mod.depth
mm
> parseFloat(mod.max_mm.value)) {
mod.depth = parseFloat(mod.max_mm.value)
mod.depth
mm
= parseFloat(mod.max_mm.value)
}
}
//
//
// clear offset
// clear offset
//
//
mods.
output
(mod,'offset',
'')
output
s.offset.event(
'')
//
//
// set new depth
// set new depth
//
//
outputs.depth.event()
outputs.depth.event(
mod.depthmm
)
//
//
// set new offset
// set new offset
//
//
mod.offsetCount = 0
mod.offsetCount = 0
outputs.offset.event()
outputs.offset.event(
mod.offset*parseFloat(mod.dia_in.value)*mod.dpi)
}
}
else {
else {
//
//
...
@@ -116,8 +118,8 @@ var inputs = {
...
@@ -116,8 +118,8 @@ var inputs = {
//
//
var outputs = {
var outputs = {
depth:{type:'',
depth:{type:'',
event:function(){
event:function(
depth
){
mods.output(mod,'depth',{depthmm:
mod.
depth})
mods.output(mod,'depth',{depthmm:depth})
}
}
},
},
diameter:{type:'',
diameter:{type:'',
...
@@ -126,13 +128,13 @@ var outputs = {
...
@@ -126,13 +128,13 @@ var outputs = {
}
}
},
},
offset:{type:'',
offset:{type:'',
event:function(){
event:function(size){
var pixels = mod.offset*parseFloat(mod.dia_in.value)*mod.dpi
mods.output(mod,'offset',size)
mods.output(mod,'offset',pixels)
}
}
},
},
toolpath:{type:'',
toolpath:{type:'',
event:function(){
event:function(){
console.log(mod.path)
cmd = {}
cmd = {}
cmd.path = mod.path
cmd.path = mod.path
cmd.name = mod.name
cmd.name = mod.name
...
@@ -317,15 +319,16 @@ var interface = function(div){
...
@@ -317,15 +319,16 @@ var interface = function(div){
mod.labelspan = span
mod.labelspan = span
btn.appendChild(span)
btn.appendChild(span)
btn.addEventListener('click',function(){
btn.addEventListener('click',function(){
mods.output(mod,'offset','')
mods.output(mod,'depth',{depthmm:mod.depth})
mod.label.nodeValue = 'calculating'
mod.label.nodeValue = 'calculating'
mod.labelspan.style.fontWeight = 'bold'
mod.labelspan.style.fontWeight = 'bold'
mod.depth = parseFloat(mod.cut_mm.value)
outputs.offset.event('') // clear offset
mod.toolpath = []
mod.depthmm = parseFloat(mod.cut_mm.value)
clear_path()
outputs.depth.event(mod.depthmm) // set depth
mod.toolpath = [] // start new toolpath
clear_layer() // clear layer
outputs.diameter.event()
outputs.diameter.event()
outputs.offset.event()
outputs.offset.event( // set offset
mod.offset*parseFloat(mod.dia_in.value)*mod.dpi)
})
})
div.appendChild(btn)
div.appendChild(btn)
div.appendChild(document.createTextNode(' '))
div.appendChild(document.createTextNode(' '))
...
@@ -404,14 +407,15 @@ function set_values(settings) {
...
@@ -404,14 +407,15 @@ function set_values(settings) {
}
}
}
}
//
//
// clear_
path
// clear_
layer
//
//
function clear_
path
() {
function clear_
layer
() {
mod.path = []
mod.path = []
mod.offset = 0.5
mod.offset = 0.5
mod.offsetCount = 0
mod.offsetCount = 0
var svg = document.getElementById(mod.div.id+'svg')
var svg = document.getElementById(mod.div.id+'svg')
svg.setAttribute('viewBox',"0 0 "+(mod.img.width-1)+" "+(mod.img.height-1))
svg.setAttribute(
'viewBox',"0 0 "+(mod.img.width-1)+" "+(mod.img.height-1))
var g = document.getElementById(mod.div.id+'g')
var g = document.getElementById(mod.div.id+'g')
svg.removeChild(g)
svg.removeChild(g)
var g = document.createElementNS('http://www.w3.org/2000/svg','g')
var g = document.createElementNS('http://www.w3.org/2000/svg','g')
...
@@ -419,11 +423,11 @@ function clear_path() {
...
@@ -419,11 +423,11 @@ function clear_path() {
svg.appendChild(g)
svg.appendChild(g)
}
}
//
//
// accumulate_
path
// accumulate_
layer
// todo: replace inefficient insertion sort
// todo: replace inefficient insertion sort
// todo: move sort out of main thread
// todo: move sort out of main thread
//
//
function accumulate_
path
(path) {
function accumulate_
layer
(path) {
var forward = mod.forward.checked
var forward = mod.forward.checked
var conventional = mod.conventional.checked
var conventional = mod.conventional.checked
var sort = mod.sort.checked
var sort = mod.sort.checked
...
@@ -462,9 +466,9 @@ function accumulate_path(path) {
...
@@ -462,9 +466,9 @@ function accumulate_path(path) {
}
}
}
}
//
//
// merge_
path
// merge_
layer
//
//
function merge_
path
() {
function merge_
layer
() {
var dmerge = mod.dpi*parseFloat(mod.merge.value)*parseFloat(mod.dia_in.value)
var dmerge = mod.dpi*parseFloat(mod.merge.value)*parseFloat(mod.dia_in.value)
var seg = 0
var seg = 0
while (seg < (mod.path.length-1)) {
while (seg < (mod.path.length-1)) {
...
@@ -482,10 +486,10 @@ function merge_path() {
...
@@ -482,10 +486,10 @@ function merge_path() {
}
}
}
}
//
//
// accumulate_
tool
path
// accumulate_path
//
//
function accumulate_
tool
path() {
function accumulate_path() {
console.log('accum '+mod.depth)
console.log('accum '+mod.depth
mm
)
}
}
//
//
// add_depth
// add_depth
...
@@ -534,9 +538,9 @@ function add_depth() {
...
@@ -534,9 +538,9 @@ function add_depth() {
mod.depth = Math.round(parseFloat(mod.max_in.value)*mod.dpi)
mod.depth = Math.round(parseFloat(mod.max_in.value)*mod.dpi)
}
}
//
//
// draw_
path
// draw_
layer
//
//
function draw_
path
(path) {
function draw_
layer
(path) {
var g = document.getElementById(mod.div.id+'g')
var g = document.getElementById(mod.div.id+'g')
var h = mod.img.height
var h = mod.img.height
var w = mod.img.width
var w = mod.img.width
...
...
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