-This SkeinPyPy version is based in Skeinforge: 49
+This SkeinPyPy version is based in Skeinforge: 50
return - 1
return 0
-def concatenateRemovePath( connectedPaths, pathIndex, paths, pixelDictionary, segments, width ):
+def concatenateRemovePath(connectedPaths, pathIndex, paths, pixelDictionary, segments, sharpestProduct, width):
'Get connected paths from paths.'
- bottomSegment = segments[ pathIndex ]
- path = paths[ pathIndex ]
+ bottomSegment = segments[pathIndex]
+ path = paths[pathIndex]
if bottomSegment == None:
connectedPaths.append(path)
return
- endpoints = getEndpointsFromSegments( segments[ pathIndex + 1 : ] )
+ endpoints = getEndpointsFromSegments(segments[pathIndex + 1 :])
bottomSegmentEndpoint = bottomSegment[0]
- nextEndpoint = bottomSegmentEndpoint.getClosestMissCheckEndpointPath( endpoints, bottomSegmentEndpoint.path, pixelDictionary, width )
+ nextEndpoint = bottomSegmentEndpoint.getClosestMissCheckEndpointPath(endpoints, bottomSegmentEndpoint.path, pixelDictionary, sharpestProduct, width)
if nextEndpoint == None:
bottomSegmentEndpoint = bottomSegment[1]
- nextEndpoint = bottomSegmentEndpoint.getClosestMissCheckEndpointPath( endpoints, bottomSegmentEndpoint.path, pixelDictionary, width )
+ nextEndpoint = bottomSegmentEndpoint.getClosestMissCheckEndpointPath(endpoints, bottomSegmentEndpoint.path, pixelDictionary, sharpestProduct, width)
if nextEndpoint == None:
connectedPaths.append(path)
return
- if len( bottomSegmentEndpoint.path ) > 0 and len( nextEndpoint.path ) > 0:
+ if len(bottomSegmentEndpoint.path) > 0 and len(nextEndpoint.path) > 0:
bottomEnd = bottomSegmentEndpoint.path[-1]
nextBegin = nextEndpoint.path[-1]
- nextMinusBottomNormalized = getNormalized( nextBegin - bottomEnd )
+ nextMinusBottomNormalized = getNormalized(nextBegin - bottomEnd)
if len( bottomSegmentEndpoint.path ) > 1:
bottomPenultimate = bottomSegmentEndpoint.path[-2]
- if getDotProduct( getNormalized( bottomPenultimate - bottomEnd ), nextMinusBottomNormalized ) > 0.9:
+ if getDotProduct(getNormalized(bottomPenultimate - bottomEnd), nextMinusBottomNormalized) > 0.99:
connectedPaths.append(path)
return
if len( nextEndpoint.path ) > 1:
nextPenultimate = nextEndpoint.path[-2]
- if getDotProduct( getNormalized( nextPenultimate - nextBegin ), - nextMinusBottomNormalized ) > 0.9:
+ if getDotProduct(getNormalized(nextPenultimate - nextBegin), - nextMinusBottomNormalized) > 0.99:
connectedPaths.append(path)
return
nextEndpoint.path.reverse()
concatenatedPath = bottomSegmentEndpoint.path + nextEndpoint.path
- paths[ nextEndpoint.pathIndex ] = concatenatedPath
- segments[ nextEndpoint.pathIndex ] = getSegmentFromPath( concatenatedPath, nextEndpoint.pathIndex )
- addValueSegmentToPixelTable( bottomSegmentEndpoint.point, nextEndpoint.point, pixelDictionary, None, width )
+ paths[nextEndpoint.pathIndex] = concatenatedPath
+ segments[nextEndpoint.pathIndex] = getSegmentFromPath(concatenatedPath, nextEndpoint.pathIndex)
+ addValueSegmentToPixelTable(bottomSegmentEndpoint.point, nextEndpoint.point, pixelDictionary, None, width)
def getAngleAroundZAxisDifference( subtractFromVec3, subtractVec3 ):
'Get the angle around the Z axis difference between a pair of Vector3s.'
concatenatedList += originalList
return concatenatedList
-def getConnectedPaths( paths, pixelDictionary, width ):
+def getConnectedPaths(paths, pixelDictionary, sharpestProduct, width):
'Get connected paths from paths.'
if len(paths) < 2:
return paths
connectedPaths = []
segments = []
- for pathIndex in xrange( len(paths) ):
- path = paths[ pathIndex ]
- segments.append( getSegmentFromPath( path, pathIndex ) )
- for pathIndex in xrange( 0, len(paths) - 1 ):
- concatenateRemovePath( connectedPaths, pathIndex, paths, pixelDictionary, segments, width )
- connectedPaths.append( paths[-1] )
+ for pathIndex in xrange(len(paths)):
+ path = paths[pathIndex]
+ segments.append(getSegmentFromPath(path, pathIndex))
+ for pathIndex in xrange(0, len(paths) - 1):
+ concatenateRemovePath(connectedPaths, pathIndex, paths, pixelDictionary, segments, sharpestProduct, width)
+ connectedPaths.append(paths[-1])
return connectedPaths
def getCrossProduct(firstComplex, secondComplex):
pathLength += abs(firstPoint - secondPoint)
return pathLength
-def getPathsFromEndpoints(endpoints, maximumConnectionLength, pixelDictionary, width):
+def getPathsFromEndpoints(endpoints, maximumConnectionLength, pixelDictionary, sharpestProduct, width):
'Get paths from endpoints.'
if len(endpoints) < 2:
return []
path = []
paths = [path]
if len(endpoints) > 1:
- nextEndpoint = otherEndpoint.getClosestMiss(endpoints, path, pixelDictionary, width)
+ nextEndpoint = otherEndpoint.getClosestMiss(endpoints, path, pixelDictionary, sharpestProduct, width)
if nextEndpoint != None:
if abs(nextEndpoint.point - endpointFirst.point) < abs(nextEndpoint.point - otherEndpoint.point):
endpointFirst = endpointFirst.otherEndpoint
if len(endpointTable.values()[0]) < 2:
return []
endpoints = getSquareValuesFromPoint(endpointTable, otherEndpoint.point * oneOverEndpointWidth)
- nextEndpoint = otherEndpoint.getClosestMiss(endpoints, path, pixelDictionary, width)
+ nextEndpoint = otherEndpoint.getClosestMiss(endpoints, path, pixelDictionary, sharpestProduct, width)
if nextEndpoint == None:
path = []
paths.append(path)
closestEndpoint = endpoint
return closestEndpoint
- def getClosestMiss(self, endpoints, path, pixelDictionary, width):
+ def getClosestMiss(self, endpoints, path, pixelDictionary, sharpestProduct, width):
'Get the closest endpoint which the segment to that endpoint misses the other extrusions.'
pathMaskTable = {}
smallestDistance = 987654321.0
endpoints.sort(compareSegmentLength)
for endpoint in endpoints[: 15]: # increasing the number of searched endpoints increases the search time, with 20 fill took 600 seconds for cilinder.gts, with 10 fill took 533 seconds
normalizedSegment = endpoint.segment / endpoint.segmentLength
- isOverlappingSelf = getDotProduct(penultimateMinusPoint, normalizedSegment) > 0.9
+ isOverlappingSelf = getDotProduct(penultimateMinusPoint, normalizedSegment) > sharpestProduct
if not isOverlappingSelf:
if len(path) > 2:
segmentYMirror = complex(normalizedSegment.real, -normalizedSegment.imag)
return endpoint
return None
- def getClosestMissCheckEndpointPath( self, endpoints, path, pixelDictionary, width ):
+ def getClosestMissCheckEndpointPath(self, endpoints, path, pixelDictionary, sharpestProduct, width):
'Get the closest endpoint which the segment to that endpoint misses the other extrusions, also checking the path of the endpoint.'
pathMaskTable = {}
smallestDistance = 987654321.0
penultimateMinusPoint = complex(0.0, 0.0)
if len(path) > 1:
penultimatePoint = path[-2]
- addSegmentToPixelTable( penultimatePoint, self.point, pathMaskTable, 0, 0, width )
+ addSegmentToPixelTable(penultimatePoint, self.point, pathMaskTable, 0, 0, width)
penultimateMinusPoint = penultimatePoint - self.point
if abs(penultimateMinusPoint) > 0.0:
penultimateMinusPoint /= abs(penultimateMinusPoint)
endpoints.sort( compareSegmentLength )
for endpoint in endpoints[ : 15 ]: # increasing the number of searched endpoints increases the search time, with 20 fill took 600 seconds for cilinder.gts, with 10 fill took 533 seconds
normalizedSegment = endpoint.segment / endpoint.segmentLength
- isOverlappingSelf = getDotProduct( penultimateMinusPoint, normalizedSegment ) > 0.9
+ isOverlappingSelf = getDotProduct(penultimateMinusPoint, normalizedSegment) > sharpestProduct
if not isOverlappingSelf:
if len(path) > 2:
segmentYMirror = complex(normalizedSegment.real, -normalizedSegment.imag)
pointRotated = segmentYMirror * self.point
endpointPointRotated = segmentYMirror * endpoint.point
- if isXSegmentIntersectingPath( path[ max( 0, len(path) - 21 ) : - 1 ], pointRotated.real, endpointPointRotated.real, segmentYMirror, pointRotated.imag ):
+ if isXSegmentIntersectingPath(path[ max(0, len(path) - 21) : -1], pointRotated.real, endpointPointRotated.real, segmentYMirror, pointRotated.imag):
isOverlappingSelf = True
endpointPath = endpoint.path
- if len( endpointPath ) > 2:
+ if len(endpointPath) > 2:
segmentYMirror = complex(normalizedSegment.real, -normalizedSegment.imag)
pointRotated = segmentYMirror * self.point
endpointPointRotated = segmentYMirror * endpoint.point
- if isXSegmentIntersectingPath( endpointPath, pointRotated.real, endpointPointRotated.real, segmentYMirror, pointRotated.imag ):
+ if isXSegmentIntersectingPath(endpointPath, pointRotated.real, endpointPointRotated.real, segmentYMirror, pointRotated.imag):
isOverlappingSelf = True
if not isOverlappingSelf:
totalMaskTable = pathMaskTable.copy()
- addSegmentToPixelTable( endpoint.point, endpoint.otherEndpoint.point, totalMaskTable, 0, 0, width )
+ addSegmentToPixelTable(endpoint.point, endpoint.otherEndpoint.point, totalMaskTable, 0, 0, width)
segmentTable = {}
- addSegmentToPixelTable( self.point, endpoint.point, segmentTable, 0, 0, width )
- if not isPixelTableIntersecting( pixelDictionary, segmentTable, totalMaskTable ):
+ addSegmentToPixelTable(self.point, endpoint.point, segmentTable, 0, 0, width)
+ if not isPixelTableIntersecting(pixelDictionary, segmentTable, totalMaskTable):
return endpoint
return None
sortLoopsInOrderOfArea(True, loops)
pointDictionary = {}
for loop in loops:
- if len(loop) > 2 and getOverlapRatio(loop, pointDictionary) < 0.3:
+ if len(loop) > 2 and getOverlapRatio(loop, pointDictionary) < 0.3 and intercircle.getIsLarge(loop, importRadius):
intercircle.directLoop(not euclidean.getIsInFilledRegion(descendingAreaLoops, loop[0]), loop)
descendingAreaLoops.append(loop)
addLoopToPointTable(loop, pointDictionary)
largestInsetLoop = getLargestInsetLoopFromLoop( loop, decreasingRadius )
if len( largestInsetLoop ) > 0:
return largestInsetLoop
- print('This should never happen, there should always be a largestInsetLoop in getLargestInsetLoopFromLoopRegardless in intercircle.')
+ print('Warning, there should always be a largestInsetLoop in getLargestInsetLoopFromLoopRegardless in intercircle.')
print(loop)
return loop
self.setTexts('volume', 'Volume: %s cm3' % self.getRounded(volume))
if not self.addLayerTemplateToSVG:
self.svgElement.getFirstChildByLocalName('script').removeFromIDNameParent()
- self.svgElement.getElementNodeByID('isoControlBox').removeFromIDNameParent()
- self.svgElement.getElementNodeByID('layerControlBox').removeFromIDNameParent()
- self.svgElement.getElementNodeByID('scrollControlBox').removeFromIDNameParent()
+ self.svgElement.getElementNodeByID('controls').removeFromIDNameParent()
self.graphicsElementNode.removeFromIDNameParent()
self.addOriginalAsComment(elementNode)
return documentNode.__repr__()
-12.02.10
\ No newline at end of file
+12.03.14
\ No newline at end of file
===Bed===
The initial bed temperature is defined by 'Bed Temperature'. If the 'Bed Temperature End Change Height' is greater or equal to the 'Bed Temperature Begin Change Height' and the 'Bed Temperature Begin Change Height' is greater or equal to zero, then the temperature will be ramped toward the 'Bed Temperature End'. The ramp will start once the extruder reaches the 'Bed Temperature Begin Change Height', then the bed temperature will approach the 'Bed Temperature End' as the extruder reaches the 'Bed Temperature End Change Height', finally the bed temperature will stay at the 'Bed Temperature End' for the remainder of the build.
+The idea is described at:
+http://www.makerbot.com/blog/2011/03/17/if-you-cant-stand-the-heat/
+
====Bed Temperature====
Default: 60C
"A class to comb a skein of extrusions."
def __init__(self):
'Initialize'
-# self.betweenTable = {}
self.boundaryLoop = None
self.distanceFeedRate = gcodec.DistanceFeedRate()
self.extruderActive = False
def getAroundBetweenPath(self, begin, end):
'Get the path around the loops in the way of the original line segment.'
aroundBetweenPath = []
-# betweens = self.getBetweens()
boundaries = self.getBoundaries()
boundarySegments = self.getBoundarySegments(begin, boundaries, end)
for boundarySegmentIndex, boundarySegment in enumerate(boundarySegments):
del aroundBetweenPath[pointIndex]
return aroundBetweenPath
-# def getBetweens(self):
-# 'Get betweens for the layer.'
-# if not self.layerZ in self.betweenTable:
-# self.betweenTable[self.layerZ] = []
-# for boundary in self.getBoundaries():
-# self.betweenTable[self.layerZ] += intercircle.getInsetLoopsFromLoop(boundary, self.betweenInset)
-# return self.betweenTable[self.layerZ]
-#
def getBoundaries(self):
"Get boundaries for the layer."
if self.layerZ in self.layerTable:
return
elif firstWord == '(<edgeWidth>':
self.edgeWidth = float(splitLine[1])
-# self.betweenInset = 0.7 * self.edgeWidth
self.doubleEdgeWidth = self.edgeWidth + self.edgeWidth
self.halfEdgeWidth = 0.5 * self.edgeWidth
self.quadrupleEdgeWidth = self.doubleEdgeWidth + self.doubleEdgeWidth
def addFlowRate(self, flowRate):
'Add a multipled line of flow rate if different.'
- self.distanceFeedRate.addLine('M108 S' + euclidean.getFourSignificantFigures(flowRate))
+ if flowRate != None:
+ self.distanceFeedRate.addLine('M108 S' + euclidean.getFourSignificantFigures(flowRate))
def addGcodeFromFeedRateMovementZ(self, feedRateMinute, point, z):
'Add a movement to the output.'
"""
This page is in the table of contents.
-Dwindle is a plugin to smooth the surface dwindle of an object by replacing the edge surface with a surface printed at a fraction of the carve
-height. This gives the impression that the object was carved at a much thinner height giving a high-quality finish, but still prints
-in a relatively short time. The latest process has some similarities with a description at:
+Dwindle is a plugin to reduce the feed rate and flow rate at the end of the thread, in order to reduce the ooze when traveling. It reduces the flow rate by a bit more than the feed rate, in order to use up the pent up plastic in the thread so that there is less remaining in the ooze.
The dwindle manual page is at:
http://fabmetheus.crsndoo.com/wiki/index.php/Skeinforge_Dwindle
The default 'Activate Dwindle' checkbox is off. When it is on, the functions described below will work, when it is off, nothing will be done.
==Settings==
-====Vertical Divisions====
-Default: 2
+===End Rate Multiplier===
+Default: 0.5
-Defines the number of times the dwindle infill and edges are divided vertically.
+Defines the ratio of the feed and flow rate at the end over the feed and flow rate of the rest of the thread. With reasonable values for the 'Pent Up Volume' and 'Slowdown Volume', the amount of ooze should be roughly proportional to the square of the 'End Rate Multiplier'. If the 'End Rate Multiplier' is too low, the printing will be very slow because the feed rate will be lower. If the 'End Rate Multiplier' is too high, there will still be a lot of ooze.
+
+===Pent Up Volume===
+Default: 0.4 mm3
+
+When the filament is stopped, there is a pent up volume of plastic that comes out afterwards. For best results, the 'Pent Up Volume' in dwindle should be set to that amount. If the 'Pent Up Volume' is too small, there will still be a lot of ooze. If the 'Pent Up Volume' is too large, the end of the thread will be thinner than the rest of the thread.
+
+===Slowdown Steps===
+Default: 3
+
+Dwindle reduces the feed rate and flow rate in steps so the thread will remain at roughly the same thickness until the end. The "Slowdown Steps" setting is the number of steps, the more steps the smaller the variation in the thread thickness, but the larger the size of the resulting gcode file and the more time spent pausing between segments.
+
+===Slowdown Volume===
+Default: 5 mm3
+
+The 'Slowdown Volume' is the volume of the end of the thread where the feed and flow rates will be decreased. If the 'Slowdown Volume' is too small, there won't be enough time to get rid of the pent up plastic, so there will still be a lot of ooze. If the 'Slowdown Volume' is too large, a bit of time will be wasted because for a large portion of the thread, the feed rate will be slow. Overall, it is best to err on being too large, because too large would only waste machine time in production, rather than the more important string removal labor time.
==Examples==
The following examples dwindle the file Screw Holder Bottom.stl. The examples are run in a terminal in the folder which contains Screw Holder Bottom.stl and dwindle.py.
'A class to handle the dwindle settings.'
def __init__(self):
'Set the default settings, execute title & settings fileName.'
- skeinforge_profile.addListsToCraftTypeRepository('skeinforge_application.skeinforge_plugins.craft_plugins.dwindle.html', self )
- self.fileNameInput = settings.FileNameInput().getFromFileName( fabmetheus_interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Dwindle', self, '')
+ skeinforge_profile.addListsToCraftTypeRepository('skeinforge_application.skeinforge_plugins.craft_plugins.dwindle.html', self)
+ self.fileNameInput = settings.FileNameInput().getFromFileName(fabmetheus_interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Dwindle', self, '')
self.openWikiManualHelpPage = settings.HelpPage().getOpenFromAbsolute('http://fabmetheus.crsndoo.com/wiki/index.php/Skeinforge_Dwindle')
self.activateDwindle = settings.BooleanSetting().getFromValue('Activate Dwindle', self, False)
settings.LabelSeparator().getFromRepository(self)
self.endRateMultiplier = settings.FloatSpin().getFromValue(0.4, 'End Rate Multiplier (ratio):', self, 0.8, 0.5)
self.pentUpVolume = settings.FloatSpin().getFromValue(0.1, 'Pent Up Volume (cubic millimeters):', self, 1.0, 0.4)
self.slowdownSteps = settings.IntSpin().getFromValue(2, 'Slowdown Steps (positive integer):', self, 10, 3)
- self.slowdownVolume = settings.FloatSpin().getFromValue(0.4, 'Slowdown Volume (cubic millimeters):', self, 4.0, 2.0)
+ self.slowdownVolume = settings.FloatSpin().getFromValue(1.0, 'Slowdown Volume (cubic millimeters):', self, 10.0, 5.0)
self.executeTitle = 'Dwindle'
def execute(self):
self.lines = None
self.oldFlowRate = None
self.oldLocation = None
+ self.operatingFlowRate = None
self.threadSections = []
def addThread(self):
self.lines = archive.getTextLines(gcodeText)
self.repository = repository
self.parseInitialization()
- self.area = self.infillWidth * self.layerHeight
+ if self.operatingFlowRate == None:
+ print('Warning, there is no operatingFlowRate so dwindle will do nothing.')
+ return gcodeText
+ self.area = self.infillWidth * self.layerHeight * self.volumeFraction
self.oneOverSteps = 1.0 / float(repository.slowdownSteps.value)
self.halfOverSteps = 0.5 * self.oneOverSteps
for self.lineIndex in xrange(self.lineIndex, len(self.lines)):
elif firstWord == '(<operatingFlowRate>':
self.operatingFlowRate = float(splitLine[1])
self.oldFlowRate = self.operatingFlowRate
+ elif firstWord == '(<volumeFraction>':
+ self.volumeFraction = float(splitLine[1])
self.distanceFeedRate.addLine(line)
def parseLine(self, line):
Defines the ratio of the infill width over the layer height. The higher the value the wider apart the infill will be and therefore the sparser the infill will be.
+===Sharpest Angle===
+Default: 60 degrees
+
+Defines the sharpest angle that a thread is allowed to make before it is separated into two threads. If 'Sharpest Angle' is too low, the extruder will stop and start often, slowing printing and putting more wear and tear on the extruder. If 'Sharpest Angle' is too high, then threads will almost double back on themselves, leading to bumps in the fill, and sometimes filament being dragged by the nozzle.
+
+This parameter is used in fill, raft and skin.
+
===Solid Surface Thickness===
Default is three.
settings.LabelDisplay().getFromName('- Infill -', self )
self.infillBeginRotation = settings.FloatSpin().getFromValue( 0.0, 'Infill Begin Rotation (degrees):', self, 90.0, 45.0 )
self.infillBeginRotationRepeat = settings.IntSpin().getFromValue( 0, 'Infill Begin Rotation Repeat (layers):', self, 3, 1 )
- self.infillOddLayerExtraRotation = settings.FloatSpin().getFromValue( 30.0, 'Infill Odd Layer Extra Rotation (degrees):', self, 90.0, 90.0 )
+ self.infillOddLayerExtraRotation = settings.FloatSpin().getFromValue(30.0, 'Infill Odd Layer Extra Rotation (degrees):', self, 90.0, 90.0)
self.infillPatternLabel = settings.LabelDisplay().getFromName('Infill Pattern:', self )
infillLatentStringVar = settings.LatentStringVar()
self.infillPatternGridCircular = settings.Radio().getFromRadio( infillLatentStringVar, 'Grid Circular', self, False )
self.infillPatternLine = settings.Radio().getFromRadio( infillLatentStringVar, 'Line', self, True )
self.infillPerimeterOverlap = settings.FloatSpin().getFromValue( 0.0, 'Infill Perimeter Overlap (ratio):', self, 0.4, 0.15 )
self.infillSolidity = settings.FloatSpin().getFromValue( 0.04, 'Infill Solidity (ratio):', self, 0.3, 0.2 )
- self.infillWidth = settings.FloatSpin().getFromValue( 0.1, 'Infill Width:', self, 1.7, 0.4 )
settings.LabelSeparator().getFromRepository(self)
+ self.sharpestAngle = settings.FloatSpin().getFromValue(50.0, 'Sharpest Angle (degrees):', self, 70.0, 60.0)
self.solidSurfaceThickness = settings.IntSpin().getFromValue(0, 'Solid Surface Thickness (layers):', self, 5, 3)
self.startFromChoice = settings.MenuButtonDisplay().getFromName('Start From Choice:', self)
self.startFromLowerLeft = settings.MenuRadio().getFromMenuButtonDisplay(self.startFromChoice, 'Lower Left', self, True)
extraShells = 0
self.distanceFeedRate.addLine('(<bridgeRotation> %s )' % layerRotation)
self.distanceFeedRate.addLine('(<rotation> %s )' % layerRotation)
- aroundWidth = 0.34321 * self.infillWidth
+# aroundWidth = 0.34321 * self.infillWidth
+ aroundWidth = 0.24321 * self.infillWidth
doubleInfillWidth = 2.0 * self.infillWidth
gridPointInsetX = 0.5 * self.fillInset
self.lastExtraShells = extraShells
for segments in self.horizontalSegmentsDictionary.values():
for segment in segments:
endpoints += segment
- paths = euclidean.getPathsFromEndpoints(endpoints, 5.0 * self.infillWidth, pixelTable, aroundWidth)
+ paths = euclidean.getPathsFromEndpoints(endpoints, 5.0 * self.infillWidth, pixelTable, self.sharpestProduct, aroundWidth)
if gridCircular:
startAngle = euclidean.globalGoldenAngle * float(layerIndex)
for gridPoint in self.getGridPoints(fillLoops, reverseRotation):
while oldRemovedEndpointLength - len(removedEndpoints) > 0:
oldRemovedEndpointLength = len(removedEndpoints)
removeEndpoints(self.infillWidth, paths, pixelTable, removedEndpoints, aroundWidth)
- paths = euclidean.getConnectedPaths(paths, pixelTable, aroundWidth)
+ paths = euclidean.getConnectedPaths(paths, pixelTable, self.sharpestProduct, aroundWidth)
for path in paths:
addPath(self.infillWidth, infillPaths, path, layerRotation)
euclidean.transferPathsToNestedRings(nestedRings, infillPaths)
'Parse gcode text and store the bevel gcode.'
self.repository = repository
self.lines = archive.getTextLines(gcodeText)
+ self.sharpestProduct = math.sin(math.radians(repository.sharpestAngle.value))
self.threadSequence = None
if repository.threadSequenceInfillLoops.value:
self.threadSequence = ['infill', 'loops', 'edge']
if firstWord == '(<crafting>)':
self.distanceFeedRate.addLine(line)
return
+ elif firstWord == '(<infillWidth>':
+ self.infillWidth = float(splitLine[1])
elif firstWord == '(<layerHeight>':
self.layerHeight = float(splitLine[1])
- self.infillWidth = self.repository.infillWidth.value
self.surroundingSlope = math.tan(math.radians(min(self.repository.surroundingAngle.value, 80.0)))
self.distanceFeedRate.addTagRoundedLine('infillPerimeterOverlap', self.repository.infillPerimeterOverlap.value)
- self.distanceFeedRate.addTagRoundedLine('infillWidth', self.infillWidth)
+ self.distanceFeedRate.addTagRoundedLine('sharpestProduct', self.sharpestProduct)
elif firstWord == '(<edgeWidth>':
self.edgeWidth = float(splitLine[1])
threadSequenceString = ' '.join( self.threadSequence )
When selected, the M104 S0 gcode line will be added to the end of the file to turn the extruder heater off by setting the extruder heater temperature to 0.
+===Volume Fraction===
+Default: 0.82
+
+The 'Volume Fraction' is the estimated volume of the thread compared to the box defined by the layer height and infill width. This is used in dwindle, splodge, and statistic. It is in inset because inset is a required extrusion tool, earlier in the chain than dwindle and splodge. In dwindle and splodge it is used to determine the filament volume, in statistic it is used to determine the extrusion diameter.
+
==Examples==
The following examples inset the file Screw Holder Bottom.stl. The examples are run in a terminal in the folder which contains Screw Holder Bottom.stl and inset.py.
endpoints = euclidean.getEndpointsFromSegmentTable( boundaryLayer.segmentTable )
if len(endpoints) < 1:
return
- paths = euclidean.getPathsFromEndpoints(endpoints, 5.0 * self.millWidth, self.aroundPixelTable, self.aroundWidth)
+ paths = euclidean.getPathsFromEndpoints(endpoints, 5.0 * self.millWidth, self.aroundPixelTable, 1.0, self.aroundWidth)
averageZ = self.average.getAverage()
if self.repository.addInnerLoops.value:
self.addGcodeFromLoops( boundaryLayer.innerLoops, averageZ )
self.operatingLayerEndLine = '(<operatingLayerEnd> </operatingLayerEnd>)'
self.operatingJump = None
self.orbitalFeedRatePerSecond = 2.01
+ self.sharpestProduct = 0.94
self.supportFlowRate = None
self.supportLayers = []
self.supportLayersTemperature = None
return
aroundPixelTable = {}
aroundWidth = 0.34321 * step
- paths = euclidean.getPathsFromEndpoints(endpoints, 1.5 * step, aroundPixelTable, aroundWidth)
+ paths = euclidean.getPathsFromEndpoints(endpoints, 1.5 * step, aroundPixelTable, self.sharpestProduct, aroundWidth)
self.addLayerLine(z)
if self.operatingFlowRate != None:
self.addFlowRate(flowRateMultiplier * self.operatingFlowRate)
aroundBoundaryLoops = intercircle.getAroundsFromLoops(boundaryLoops, halfSupportOutset)
for aroundBoundaryLoop in aroundBoundaryLoops:
euclidean.addLoopToPixelTable(aroundBoundaryLoop, aroundPixelTable, aroundWidth)
- paths = euclidean.getPathsFromEndpoints(endpoints, 1.5 * self.interfaceStep, aroundPixelTable, aroundWidth)
+ paths = euclidean.getPathsFromEndpoints(endpoints, 1.5 * self.interfaceStep, aroundPixelTable, self.sharpestProduct, aroundWidth)
feedRateMinuteMultiplied = self.operatingFeedRateMinute
supportFlowRateMultiplied = self.supportFlowRate
if self.layerIndex == 0:
self.baseTemperature = float(splitLine[1])
elif firstWord == '(<coolingRate>':
self.coolingRate = float(splitLine[1])
+ elif firstWord == '(<edgeWidth>':
+ self.edgeWidth = float(splitLine[1])
+ self.halfEdgeWidth = 0.5 * self.edgeWidth
+ self.quarterEdgeWidth = 0.25 * self.edgeWidth
+ self.supportOutset = self.edgeWidth + self.edgeWidth * self.repository.supportGapOverPerimeterExtrusionWidth.value
elif firstWord == '(</extruderInitialization>)':
self.distanceFeedRate.addTagBracketedProcedure('raft')
elif firstWord == '(<heatingRate>':
self.operatingFlowRate = float(splitLine[1])
self.oldFlowRate = self.operatingFlowRate
self.supportFlowRate = self.operatingFlowRate * self.repository.supportFlowRateOverOperatingFlowRate.value
- elif firstWord == '(<edgeWidth>':
- self.edgeWidth = float(splitLine[1])
- self.halfEdgeWidth = 0.5 * self.edgeWidth
- self.quarterEdgeWidth = 0.25 * self.edgeWidth
- self.supportOutset = self.edgeWidth + self.edgeWidth * self.repository.supportGapOverPerimeterExtrusionWidth.value
+ elif firstWord == '(<sharpestProduct>':
+ self.sharpestProduct = float(splitLine[1])
elif firstWord == '(<supportLayersTemperature>':
self.supportLayersTemperature = float(splitLine[1])
elif firstWord == '(<supportedLayersTemperature>':
self.maximumZFeedRateMinute = 60.0
self.oldFlowRate = None
self.oldLocation = None
+ self.sharpestProduct = 0.94
self.travelFeedRateMinute = 957.0
def addFlowRateLine(self, flowRate):
'Add a flow rate line.'
- self.distanceFeedRate.addLine('M108 S' + euclidean.getFourSignificantFigures(flowRate))
+ if flowRate != None:
+ self.distanceFeedRate.addLine('M108 S' + euclidean.getFourSignificantFigures(flowRate))
def addPerimeterLoop(self, thread, z):
'Add the edge loop to the gcode.'
return
bottomZ = self.oldLocation.z + self.layerHeight / self.verticalDivisionsFloat - self.layerHeight
offsetY = 0.5 * self.skinInfillWidth
- self.addFlowRateLine(self.oldFlowRate / self.verticalDivisionsFloat / self.horizontalInfillDivisionsFloat)
+ if self.oldFlowRate != None:
+ self.addFlowRateLine(self.oldFlowRate / self.verticalDivisionsFloat / self.horizontalInfillDivisionsFloat)
for verticalDivisionIndex in xrange(self.verticalDivisions):
z = bottomZ + self.layerHeight / self.verticalDivisionsFloat * float(verticalDivisionIndex)
self.addSkinnedInfillBoundary(self.infillBoundaries, offsetY * (verticalDivisionIndex % 2 == 0), self.oldLocation.z, z)
for endpoint in segment:
endpoint.point = complex(endpoint.point.real, endpoint.point.imag + offsetY)
endpoints.append(endpoint)
- infillPaths = euclidean.getPathsFromEndpoints(endpoints, 5.0 * self.skinInfillWidth, pixelTable, aroundWidth)
+ infillPaths = euclidean.getPathsFromEndpoints(endpoints, 5.0 * self.skinInfillWidth, pixelTable, self.sharpestProduct, aroundWidth)
for infillPath in infillPaths:
addPointBeforeThread = True
infillRotated = euclidean.getRotatedComplexes(self.rotation, infillPath)
for division in xrange(self.repository.horizontalPerimeterDivisions.value):
edges.append(self.getClippedSimplifiedLoopPathByLoop(intercircle.getLargestInsetLoopFromLoop(edgeThread, radius)))
radius += radiusAddition
- skinnedPerimeterFlowRate = self.oldFlowRate / self.verticalDivisionsFloat
+ skinnedPerimeterFlowRate = None
+ if self.oldFlowRate != None:
+ skinnedPerimeterFlowRate = self.oldFlowRate / self.verticalDivisionsFloat
if getIsMinimumSides(edges):
- self.addFlowRateLine(skinnedPerimeterFlowRate / self.horizontalPerimeterDivisionsFloat)
+ if self.oldFlowRate != None:
+ self.addFlowRateLine(skinnedPerimeterFlowRate / self.horizontalPerimeterDivisionsFloat)
for verticalDivisionIndex in xrange(self.verticalDivisions):
z = bottomZ + self.layerHeight / self.verticalDivisionsFloat * float(verticalDivisionIndex)
for edge in edges:
self.distanceFeedRate.parseSplitLine(firstWord, splitLine)
if firstWord == '(<clipOverEdgeWidth>':
self.clipOverEdgeWidth = float(splitLine[1])
+ elif firstWord == '(<edgeWidth>':
+ self.edgeWidth = float(splitLine[1])
+ self.halfEdgeWidth = 0.5 * self.edgeWidth
elif firstWord == '(</extruderInitialization>)':
self.distanceFeedRate.addTagBracketedProcedure('skin')
return
self.maximumZFeedRateMinute = 60.0 * float(splitLine[1])
elif firstWord == '(<operatingFlowRate>':
self.oldFlowRate = float(splitLine[1])
- elif firstWord == '(<edgeWidth>':
- self.edgeWidth = float(splitLine[1])
- self.halfEdgeWidth = 0.5 * self.edgeWidth
+ elif firstWord == '(<sharpestProduct>':
+ self.sharpestProduct = float(splitLine[1])
elif firstWord == '(<travelFeedRatePerSecond>':
self.travelFeedRateMinute = 60.0 * float(splitLine[1])
self.distanceFeedRate.addLine(line)
'Get new repository.'
return WidenRepository()
-def getWidenedLoop(loop, loopList, outsetLoop, radius):
+def getWidenedLoops(loop, loopList, outsetLoop, radius):
'Get the widened loop.'
intersectingWithinLoops = getIntersectingWithinLoops(loop, loopList, outsetLoop)
if len(intersectingWithinLoops) < 1:
- return loop
+ return [loop]
loopsUnified = boolean_solid.getLoopsUnion(radius, [[loop], intersectingWithinLoops])
if len(loopsUnified) < 1:
- return loop
- return euclidean.getLargestLoop(loopsUnified)
+ return [loop]
+ return loopsUnified
def writeOutput(fileName, shouldAnalyze=True):
'Widen the carving of a gcode file.'
self.openWikiManualHelpPage = settings.HelpPage().getOpenFromAbsolute(
'http://fabmetheus.crsndoo.com/wiki/index.php/Skeinforge_Widen')
self.activateWiden = settings.BooleanSetting().getFromValue('Activate Widen', self, False)
+ self.widenWidthOverEdgeWidth = settings.IntSpin().getFromValue(2, 'Widen Width over Edge Width (ratio):', self, 4, 2)
self.executeTitle = 'Widen'
def execute(self):
else:
widdershinsLoops.append(loop)
else:
-# clockwiseInsetLoop = intercircle.getLargestInsetLoopFromLoop(loop, self.doubleEdgeWidth)
+# clockwiseInsetLoop = intercircle.getLargestInsetLoopFromLoop(loop, self.widenEdgeWidth)
# clockwiseInsetLoop.reverse()
# clockwiseInsetLoops.append(clockwiseInsetLoop)
- clockwiseInsetLoops += intercircle.getInsetLoopsFromLoop(loop, self.doubleEdgeWidth)
+ clockwiseInsetLoops += intercircle.getInsetLoopsFromLoop(loop, self.widenEdgeWidth)
self.distanceFeedRate.addGcodeFromLoop(loop, loopLayer.z)
for widdershinsLoop in widdershinsLoops:
- outsetLoop = intercircle.getLargestInsetLoopFromLoop(widdershinsLoop, -self.doubleEdgeWidth)
- widenedLoop = getWidenedLoop(widdershinsLoop, clockwiseInsetLoops, outsetLoop, self.edgeWidth)
- self.distanceFeedRate.addGcodeFromLoop(widenedLoop, loopLayer.z)
+ outsetLoop = intercircle.getLargestInsetLoopFromLoop(widdershinsLoop, -self.widenEdgeWidth)
+ for widenedLoop in getWidenedLoops(widdershinsLoop, clockwiseInsetLoops, outsetLoop, self.lessThanHalfEdgeWidth):
+ self.distanceFeedRate.addGcodeFromLoop(widenedLoop, loopLayer.z)
def getCraftedGcode(self, gcodeText, repository):
'Parse gcode text and store the widen gcode.'
return
elif firstWord == '(<edgeWidth>':
self.edgeWidth = float(splitLine[1])
- self.doubleEdgeWidth = 2.0 * self.edgeWidth
+ self.widenEdgeWidth = float(self.repository.widenWidthOverEdgeWidth.value) * self.edgeWidth
+ self.lessThanHalfEdgeWidth = 0.49 * self.edgeWidth
self.distanceFeedRate.addLine(line)
def parseLine(self, line):
"Get the plugins directory path."
return archive.getCraftPluginsDirectoryPath()
-def getProcedures( procedure, text ):
- "Get the procedures up to and including the given procedure."
+def getProcedures(procedure, text):
+ 'Get the procedures up to and including the given procedure.'
craftSequence = getReadCraftSequence()
sequenceIndexFromProcedure = 0
if procedure in craftSequence:
sequenceIndexFromProcedure = craftSequence.index(procedure)
- sequenceIndexPlusOneFromText = getSequenceIndexPlusOneFromText(text)
- return craftSequence[ sequenceIndexPlusOneFromText : sequenceIndexFromProcedure + 1 ]
+ craftSequence = craftSequence[: sequenceIndexFromProcedure + 1]
+ for craftSequenceIndex in xrange(len(craftSequence) - 1, -1, -1):
+ procedure = craftSequence[craftSequenceIndex]
+ if gcodec.isProcedureDone(text, procedure):
+ return craftSequence[craftSequenceIndex + 1 :]
+ return craftSequence
def getReadCraftSequence():
"Get profile sequence."
return skeinforge_profile.getCraftTypePluginModule().getCraftSequence()
-def getSequenceIndexPlusOneFromText(fileText):
- "Get the profile sequence index of the file plus one. Return zero if the procedure is not in the file"
- craftSequence = getReadCraftSequence()
- for craftSequenceIndex in xrange( len( craftSequence ) - 1, - 1, - 1 ):
- procedure = craftSequence[ craftSequenceIndex ]
- if gcodec.isProcedureDone( fileText, procedure ):
- return craftSequenceIndex + 1
- return 0
-
def writeChainTextWithNounMessage(fileName, procedure, shouldAnalyze=True):
'Get and write a crafted shape file.'
print('')