mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 22:54:01 -06:00
Update ColorMix.py
Updates based on review.
This commit is contained in:
parent
1b976ca636
commit
9aa6887b02
1 changed files with 11 additions and 19 deletions
|
@ -75,7 +75,7 @@ class ColorMix(Script):
|
||||||
"type": "float",
|
"type": "float",
|
||||||
"default_value": 0,
|
"default_value": 0,
|
||||||
"minimum_value": "0",
|
"minimum_value": "0",
|
||||||
"minimum_value_warning": "0.1",
|
"minimum_value_warning": "start_height",
|
||||||
"enabled": "behavior == 'blend_value'"
|
"enabled": "behavior == 'blend_value'"
|
||||||
},
|
},
|
||||||
"mix_start":
|
"mix_start":
|
||||||
|
@ -121,17 +121,11 @@ class ColorMix(Script):
|
||||||
return default
|
return default
|
||||||
|
|
||||||
def execute(self, data):
|
def execute(self, data):
|
||||||
#get user variables
|
|
||||||
firstHeight = 0.0
|
|
||||||
secondHeight = 0.0
|
|
||||||
firstMix = 0.0
|
|
||||||
SecondMix = 0.0
|
|
||||||
modelNumber = 0
|
|
||||||
|
|
||||||
firstHeight = self.getSettingValueByKey("start_height")
|
firstHeight = self.getSettingValueByKey("start_height")
|
||||||
secondHeight = self.getSettingValueByKey("finish_height")
|
secondHeight = self.getSettingValueByKey("finish_height")
|
||||||
firstMix = self.getSettingValueByKey("mix_start")
|
firstMix = self.getSettingValueByKey("mix_start")
|
||||||
SecondMix = self.getSettingValueByKey("mix_finish")
|
secondMix = self.getSettingValueByKey("mix_finish")
|
||||||
modelOfInterest = self.getSettingValueByKey("objectNumber")
|
modelOfInterest = self.getSettingValueByKey("objectNumber")
|
||||||
|
|
||||||
#get layer height
|
#get layer height
|
||||||
|
@ -144,20 +138,18 @@ class ColorMix(Script):
|
||||||
break
|
break
|
||||||
if layerHeight != 0:
|
if layerHeight != 0:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
#default layerHeight if not found
|
||||||
|
if layerHeight == 0:
|
||||||
|
layerHeight = .2
|
||||||
|
|
||||||
#get layers to use
|
#get layers to use
|
||||||
startLayer = 0
|
startLayer = 0
|
||||||
endLayer = 0
|
endLayer = 0
|
||||||
if self.getSettingValueByKey("unitsOfMeasurement") == "mm":
|
if self.getSettingValueByKey("unitsOfMeasurement") == "mm":
|
||||||
if firstHeight == 0:
|
startLayer = round(firstHeight / layerHeight)
|
||||||
startLayer = 0
|
endLayer = round(secondHeight / layerHeight)
|
||||||
else:
|
else: #layer height shifts down by one for g-code
|
||||||
startLayer = round(firstHeight / layerHeight)
|
|
||||||
if secondHeight == 0:
|
|
||||||
endLayer = 0
|
|
||||||
else:
|
|
||||||
endLayer = round(secondHeight / layerHeight)
|
|
||||||
else: #layer height
|
|
||||||
if firstHeight <= 0:
|
if firstHeight <= 0:
|
||||||
firstHeight = 1
|
firstHeight = 1
|
||||||
if secondHeight <= 0:
|
if secondHeight <= 0:
|
||||||
|
@ -169,7 +161,7 @@ class ColorMix(Script):
|
||||||
endLayer = startLayer
|
endLayer = startLayer
|
||||||
firstExtruderIncrements = 0
|
firstExtruderIncrements = 0
|
||||||
else: #blend
|
else: #blend
|
||||||
firstExtruderIncrements = (SecondMix - firstMix) / (endLayer - startLayer)
|
firstExtruderIncrements = (secondMix - firstMix) / (endLayer - startLayer)
|
||||||
firstExtruderValue = 0
|
firstExtruderValue = 0
|
||||||
index = 0
|
index = 0
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue