Esempio n. 1
0
def addSegmentOutline(isThick, outlines, pointBegin, pointEnd, width):
    "Add a diamond or hexagonal outline for a line segment."
    width = abs(width)
    exclusionWidth = 0.6 * width
    slope = 0.2
    if isThick:
        slope = 3.0
        exclusionWidth = 0.8 * width
    segment = pointEnd - pointBegin
    segmentLength = abs(segment)
    if segmentLength == 0.0:
        return
    normalizedSegment = segment / segmentLength
    outline = []
    segmentYMirror = complex(normalizedSegment.real, -normalizedSegment.imag)
    pointBeginRotated = segmentYMirror * pointBegin
    pointEndRotated = segmentYMirror * pointEnd
    along = 0.05
    alongLength = along * segmentLength
    if alongLength > 0.1 * exclusionWidth:
        along *= 0.1 * exclusionWidth / alongLength
    alongEnd = 1.0 - along
    remainingToHalf = 0.5 - along
    alongToWidth = exclusionWidth / slope / segmentLength
    pointBeginIntermediate = euclidean.getIntermediateLocation(
        along, pointBeginRotated, pointEndRotated)
    pointEndIntermediate = euclidean.getIntermediateLocation(
        alongEnd, pointBeginRotated, pointEndRotated)
    outline.append(pointBeginIntermediate)
    verticalWidth = complex(0.0, exclusionWidth)
    if alongToWidth > 0.9 * remainingToHalf:
        verticalWidth = complex(0.0, slope * remainingToHalf * segmentLength)
        middle = (pointBeginIntermediate + pointEndIntermediate) * 0.5
        middleDown = middle - verticalWidth
        middleUp = middle + verticalWidth
        outline.append(middleUp)
        outline.append(pointEndIntermediate)
        outline.append(middleDown)
    else:
        alongOutsideBegin = along + alongToWidth
        alongOutsideEnd = alongEnd - alongToWidth
        outsideBeginCenter = euclidean.getIntermediateLocation(
            alongOutsideBegin, pointBeginRotated, pointEndRotated)
        outsideBeginCenterDown = outsideBeginCenter - verticalWidth
        outsideBeginCenterUp = outsideBeginCenter + verticalWidth
        outsideEndCenter = euclidean.getIntermediateLocation(
            alongOutsideEnd, pointBeginRotated, pointEndRotated)
        outsideEndCenterDown = outsideEndCenter - verticalWidth
        outsideEndCenterUp = outsideEndCenter + verticalWidth
        outline.append(outsideBeginCenterUp)
        outline.append(outsideEndCenterUp)
        outline.append(pointEndIntermediate)
        outline.append(outsideEndCenterDown)
        outline.append(outsideBeginCenterDown)
    outlines.append(euclidean.getPointsRoundZAxis(normalizedSegment, outline))
Esempio n. 2
0
	def addHop( self, begin, end ):
		"Add hop to highest point."
		beginEndDistance = begin.distance( end )
		if beginEndDistance < 3.0 * self.absolutePerimeterWidth:
			return
		alongWay = self.absolutePerimeterWidth / beginEndDistance
		closeToOldLocation = euclidean.getIntermediateLocation( alongWay, begin, end )
		closeToOldLocation.z = self.highestZ
		self.distanceFeedRate.addLine( self.getLinearMoveWithFeedRate( self.travelFeedRatePerMinute, closeToOldLocation ) )
		closeToOldArrival = euclidean.getIntermediateLocation( alongWay, end, begin )
		closeToOldArrival.z = self.highestZ
		self.distanceFeedRate.addLine( self.getLinearMoveWithFeedRate( self.travelFeedRatePerMinute, closeToOldArrival ) )
Esempio n. 3
0
def addSegmentOutline( isThick, outlines, pointBegin, pointEnd, width ):
	"Add a diamond or hexagonal outline for a line segment."
	width = abs( width )
	exclusionWidth = 0.6 * width
	slope = 0.2
	if isThick:
		slope = 3.0
		exclusionWidth = 0.8 * width
	segment = pointEnd - pointBegin
	segmentLength = abs( segment )
	if segmentLength == 0.0:
		return
	normalizedSegment = segment / segmentLength
	outline = []
	segmentYMirror = complex( normalizedSegment.real, - normalizedSegment.imag )
	pointBeginRotated = segmentYMirror * pointBegin
	pointEndRotated = segmentYMirror * pointEnd
	along = 0.05
	alongLength = along * segmentLength
	if alongLength > 0.1 * exclusionWidth:
		along *= 0.1 * exclusionWidth / alongLength
	alongEnd = 1.0 - along
	remainingToHalf = 0.5 - along
	alongToWidth = exclusionWidth / slope / segmentLength
	pointBeginIntermediate = euclidean.getIntermediateLocation( along, pointBeginRotated, pointEndRotated )
	pointEndIntermediate = euclidean.getIntermediateLocation( alongEnd, pointBeginRotated, pointEndRotated )
	outline.append( pointBeginIntermediate )
	verticalWidth = complex( 0.0, exclusionWidth )
	if alongToWidth > 0.9 * remainingToHalf:
		verticalWidth = complex( 0.0, slope * remainingToHalf * segmentLength )
		middle = ( pointBeginIntermediate + pointEndIntermediate ) * 0.5
		middleDown = middle - verticalWidth
		middleUp = middle + verticalWidth
		outline.append( middleUp )
		outline.append( pointEndIntermediate )
		outline.append( middleDown )
	else:
		alongOutsideBegin = along + alongToWidth
		alongOutsideEnd = alongEnd - alongToWidth
		outsideBeginCenter = euclidean.getIntermediateLocation( alongOutsideBegin, pointBeginRotated, pointEndRotated )
		outsideBeginCenterDown = outsideBeginCenter - verticalWidth
		outsideBeginCenterUp = outsideBeginCenter + verticalWidth
		outsideEndCenter = euclidean.getIntermediateLocation( alongOutsideEnd, pointBeginRotated, pointEndRotated )
		outsideEndCenterDown = outsideEndCenter - verticalWidth
		outsideEndCenterUp = outsideEndCenter + verticalWidth
		outline.append( outsideBeginCenterUp )
		outline.append( outsideEndCenterUp )
		outline.append( pointEndIntermediate )
		outline.append( outsideEndCenterDown )
		outline.append( outsideBeginCenterDown )
	outlines.append( euclidean.getPointsRoundZAxis( normalizedSegment, outline ) )
Esempio n. 4
0
 def addAlongWayLine(self, alongWay, location):
     "Add stretched gcode line, along the way from the location to the old location."
     alongWayLocation = euclidean.getIntermediateLocation(
         alongWay, location, self.oldLocation)
     alongWayLine = self.getStretchedLineFromIndexLocation(
         self.lineIndex - 1, self.lineIndex, alongWayLocation)
     self.addLine(alongWayLine)
Esempio n. 5
0
	def addFloat( self, begin, end ):
		"Add dive to the original height."
		beginEndDistance = begin.distance( end )
		alongWay = self.absolutePerimeterWidth / beginEndDistance
		closeToEnd = euclidean.getIntermediateLocation( alongWay, end, begin )
		closeToEnd.z = self.highestZ
		self.distanceFeedRate.addLine( self.distanceFeedRate.getLinearGcodeMovementWithFeedRate( self.travelFeedRatePerMinute, closeToEnd.dropAxis( 2 ), closeToEnd.z ) )
Esempio n. 6
0
 def addHop(self, begin, end):
     "Add hop to highest point."
     beginEndDistance = begin.distance(end)
     if beginEndDistance < 3.0 * self.extrusionWidth:
         return
     alongWay = self.extrusionWidth / beginEndDistance
     closeToOldLocation = euclidean.getIntermediateLocation(
         alongWay, begin, end)
     closeToOldLocation.z = self.highestZ
     self.addLine(
         self.getLinearMoveWithFeedrate(self.travelFeedratePerMinute,
                                        closeToOldLocation))
     closeToOldArrival = euclidean.getIntermediateLocation(
         alongWay, end, begin)
     closeToOldArrival.z = self.highestZ
     self.addLine(
         self.getLinearMoveWithFeedrate(self.travelFeedratePerMinute,
                                        closeToOldArrival))
Esempio n. 7
0
 def addFloat(self, begin, end):
     "Add dive to the original height."
     beginEndDistance = begin.distance(end)
     alongWay = self.absolutePerimeterWidth / beginEndDistance
     closeToEnd = euclidean.getIntermediateLocation(alongWay, end, begin)
     closeToEnd.z = self.highestZ
     self.distanceFeedRate.addLine(
         self.distanceFeedRate.getLinearGcodeMovementWithFeedRate(
             self.travelFeedRatePerMinute, closeToEnd.dropAxis(2),
             closeToEnd.z))
Esempio n. 8
0
	def addAlongWayLine( self, alongWay, location ):
		"Add stretched gcode line, along the way from the location to the old location."
		alongWayLocation = euclidean.getIntermediateLocation( alongWay, location, self.oldLocation )
		alongWayLine = self.getStretchedLineFromIndexLocation( self.lineIndex - 1, self.lineIndex, alongWayLocation )
		self.distanceFeedRate.addLine( alongWayLine )