Esempio n. 1
0
 def getLayerRoundZ(self, layerIndex):
     "Get the plane angle around z that the layer is rotated by."
     rotation = self.rotatedLayers[layerIndex].rotation
     if rotation != None:
         return rotation
     return euclidean.getPolar(
         self.fillBeginRotation + float(
             (layerIndex % 2) * self.fillOddLayerExtraRotation), 1.0)
Esempio n. 2
0
	def addArc( self, afterCenterDifferenceAngle, afterPoint, beforeCenterSegment, beforePoint, center ):
		"Add arc segments to the filleted skein."
		curveSection = 0.5
		absoluteDifferenceAngle = abs( afterCenterDifferenceAngle )
		steps = int( math.ceil( max( absoluteDifferenceAngle * 2.4, absoluteDifferenceAngle * beforeCenterSegment.length() / curveSection ) ) )
		stepPlaneAngle = euclidean.getPolar( afterCenterDifferenceAngle / steps, 1.0 )
		for step in range( 1, steps ):
			beforeCenterSegment = euclidean.getRoundZAxisByPlaneAngle( stepPlaneAngle, beforeCenterSegment )
			arcPoint = center.plus( beforeCenterSegment )
			self.addLinearMovePoint( arcPoint )
		self.addLinearMovePoint( afterPoint )
Esempio n. 3
0
 def helicalMove(self, isCounterclockwise, splitLine):
     "Get statistics for a helical move."
     if self.oldLocation == None:
         return
     location = self.getLocationSetFeedrateToSplitLine(splitLine)
     location.add(self.oldLocation)
     center = Vec3().getFromVec3(self.oldLocation)
     indexOfR = gcodec.indexOfStartingWithSecond("R", splitLine)
     if indexOfR > 0:
         radius = gcodec.getDoubleAfterFirstLetter(splitLine[indexOfR])
         halfLocationMinusOld = location.minus(self.oldLocation)
         halfLocationMinusOld.scale(0.5)
         halfLocationMinusOldLength = halfLocationMinusOld.length()
         centerMidpointDistance = math.sqrt(radius * radius -
                                            halfLocationMinusOldLength *
                                            halfLocationMinusOldLength)
         centerMinusMidpoint = euclidean.getRotatedWiddershinsQuarterAroundZAxis(
             halfLocationMinusOld)
         centerMinusMidpoint.normalize()
         centerMinusMidpoint.scale(centerMidpointDistance)
         if isCounterclockwise:
             center.setToVec3(
                 halfLocationMinusOld.plus(centerMinusMidpoint))
         else:
             center.setToVec3(
                 halfLocationMinusOld.minus(centerMinusMidpoint))
     else:
         center.x = gcodec.getDoubleForLetter("I", splitLine)
         center.y = gcodec.getDoubleForLetter("J", splitLine)
     curveSection = 0.5
     center.add(self.oldLocation)
     afterCenterSegment = location.minus(center)
     beforeCenterSegment = self.oldLocation.minus(center)
     afterCenterDifferenceAngle = euclidean.getAngleAroundZAxisDifference(
         afterCenterSegment, beforeCenterSegment)
     absoluteDifferenceAngle = abs(afterCenterDifferenceAngle)
     steps = int(
         round(0.5 + max(
             absoluteDifferenceAngle * 2.4,
             absoluteDifferenceAngle * beforeCenterSegment.length() /
             curveSection)))
     stepPlaneAngle = euclidean.getPolar(afterCenterDifferenceAngle / steps,
                                         1.0)
     zIncrement = (afterCenterSegment.z -
                   beforeCenterSegment.z) / float(steps)
     for step in range(1, steps):
         beforeCenterSegment = euclidean.getRoundZAxisByPlaneAngle(
             stepPlaneAngle, beforeCenterSegment)
         beforeCenterSegment.z += zIncrement
         arcPoint = center.plus(beforeCenterSegment)
         self.addToPath(arcPoint)
     self.addToPath(location)
Esempio n. 4
0
 def addArc(self, afterCenterDifferenceAngle, afterPoint,
            beforeCenterSegment, beforePoint, center):
     "Add arc segments to the filleted skein."
     curveSection = 0.5
     absoluteDifferenceAngle = abs(afterCenterDifferenceAngle)
     steps = int(
         math.ceil(
             max(
                 absoluteDifferenceAngle * 2.4,
                 absoluteDifferenceAngle * beforeCenterSegment.length() /
                 curveSection)))
     stepPlaneAngle = euclidean.getPolar(afterCenterDifferenceAngle / steps,
                                         1.0)
     for step in range(1, steps):
         beforeCenterSegment = euclidean.getRoundZAxisByPlaneAngle(
             stepPlaneAngle, beforeCenterSegment)
         arcPoint = center.plus(beforeCenterSegment)
         self.addLinearMovePoint(arcPoint)
     self.addLinearMovePoint(afterPoint)
Esempio n. 5
0
	def helicalMove( self, isCounterclockwise, splitLine ):
		"Get statistics for a helical move."
		if self.oldLocation == None:
			return
		location = self.getLocationSetFeedrateToSplitLine( splitLine )
		location.add( self.oldLocation )
		center = Vec3().getFromVec3( self.oldLocation )
		indexOfR = gcodec.indexOfStartingWithSecond( "R", splitLine )
		if indexOfR > 0:
			radius = gcodec.getDoubleAfterFirstLetter( splitLine[ indexOfR ] )
			halfLocationMinusOld = location.minus( self.oldLocation )
			halfLocationMinusOld.scale( 0.5 )
			halfLocationMinusOldLength = halfLocationMinusOld.length()
			centerMidpointDistance = math.sqrt( radius * radius - halfLocationMinusOldLength * halfLocationMinusOldLength )
			centerMinusMidpoint = euclidean.getRotatedWiddershinsQuarterAroundZAxis( halfLocationMinusOld )
			centerMinusMidpoint.normalize()
			centerMinusMidpoint.scale( centerMidpointDistance )
			if isCounterclockwise:
				center.setToVec3( halfLocationMinusOld.plus( centerMinusMidpoint ) )
			else:
				center.setToVec3( halfLocationMinusOld.minus( centerMinusMidpoint ) )
		else:
			center.x = gcodec.getDoubleForLetter( "I", splitLine )
			center.y = gcodec.getDoubleForLetter( "J", splitLine )
		curveSection = 0.5
		center.add( self.oldLocation )
		afterCenterSegment = location.minus( center )
		beforeCenterSegment = self.oldLocation.minus( center )
		afterCenterDifferenceAngle = euclidean.getAngleAroundZAxisDifference( afterCenterSegment, beforeCenterSegment )
		absoluteDifferenceAngle = abs( afterCenterDifferenceAngle )
		steps = int( round( 0.5 + max( absoluteDifferenceAngle * 2.4, absoluteDifferenceAngle * beforeCenterSegment.length() / curveSection ) ) )
		stepPlaneAngle = euclidean.getPolar( afterCenterDifferenceAngle / steps, 1.0 )
		zIncrement = ( afterCenterSegment.z - beforeCenterSegment.z ) / float( steps )
		for step in range( 1, steps ):
			beforeCenterSegment = euclidean.getRoundZAxisByPlaneAngle( stepPlaneAngle, beforeCenterSegment )
			beforeCenterSegment.z += zIncrement
			arcPoint = center.plus( beforeCenterSegment )
			self.addToPath( arcPoint )
		self.addToPath( location )
Esempio n. 6
0
	def getLayerRoundZ( self, layerIndex ):
		"Get the plane angle around z that the layer is rotated by."
		rotation = self.rotatedLayers[ layerIndex ].rotation
		if rotation != None:
			return rotation
		return euclidean.getPolar( self.fillBeginRotation + float( ( layerIndex % 2 ) * self.fillOddLayerExtraRotation ), 1.0 )