Example #1
0
def addHollowPegSocket(derivation, hollowPegSocket, negatives, positives):
	'Add the socket and hollow peg.'
	pegHeight = derivation.pegHeight
	pegRadians = derivation.pegRadians
	pegRadiusComplex = complex(derivation.pegRadius, derivation.pegRadius)
	pegTip = 0.8 * derivation.pegRadius
	sides = derivation.pegSides
	start = Vector3(hollowPegSocket.center.real, hollowPegSocket.center.imag, derivation.height)
	tinyHeight = 0.0001 * pegHeight
	topRadians = 0.25 * math.pi
	boltTop = derivation.height
	if hollowPegSocket.shouldAddPeg:
		boltTop = peg.getTopAddBiconicOutput(
			pegRadians, pegHeight, positives, pegRadiusComplex, sides, start, pegTip, topRadians)
	sides = derivation.socketSides
	socketHeight = 1.05 * derivation.pegHeight
	socketRadiusComplex = complex(derivation.socketRadius, derivation.socketRadius)
	socketTip = 0.5 * derivation.overhangSpan
	start = Vector3(hollowPegSocket.center.real, hollowPegSocket.center.imag, -tinyHeight)
	topRadians = derivation.interiorOverhangRadians
	if hollowPegSocket.shouldAddSocket:
		peg.getTopAddBiconicOutput(pegRadians, socketHeight, negatives, socketRadiusComplex, sides, start, socketTip, topRadians)
	if derivation.boltRadius <= 0.0:
		return
	if (not hollowPegSocket.shouldAddPeg) and (not hollowPegSocket.shouldAddSocket):
		return
	boltRadiusComplex = complex(derivation.boltRadius, derivation.boltRadius)
	cylinder.addCylinderOutputByEndStart(boltTop + tinyHeight, boltRadiusComplex, negatives, derivation.boltSides, start)
Example #2
0
def addHollowPegSocket(derivation, hollowPegSocket, negatives, positives):
	"""Add the socket and hollow peg."""
	pegHeight = derivation.pegHeight
	pegRadians = derivation.pegRadians
	pegRadiusComplex = complex(derivation.pegRadius, derivation.pegRadius)
	pegTip = 0.8 * derivation.pegRadius
	sides = derivation.pegSides
	start = Vector3(hollowPegSocket.center.real, hollowPegSocket.center.imag, derivation.height)
	tinyHeight = 0.0001 * pegHeight
	topRadians = 0.25 * math.pi
	boltTop = derivation.height
	if hollowPegSocket.shouldAddPeg:
		boltTop = peg.getTopAddBiconicOutput(
			pegRadians, pegHeight, positives, pegRadiusComplex, sides, start, pegTip, topRadians)
	sides = derivation.socketSides
	socketHeight = 1.05 * derivation.pegHeight
	socketRadiusComplex = complex(derivation.socketRadius, derivation.socketRadius)
	socketTip = 0.5 * derivation.overhangSpan
	start = Vector3(hollowPegSocket.center.real, hollowPegSocket.center.imag, -tinyHeight)
	topRadians = derivation.interiorOverhangRadians
	if hollowPegSocket.shouldAddSocket:
		peg.getTopAddBiconicOutput(pegRadians, socketHeight, negatives, socketRadiusComplex, sides, start, socketTip, topRadians)
	if derivation.boltRadius <= 0.0:
		return
	if (not hollowPegSocket.shouldAddPeg) and (not hollowPegSocket.shouldAddSocket):
		return
	boltRadiusComplex = complex(derivation.boltRadius, derivation.boltRadius)
	cylinder.addCylinderOutputByEndStart(boltTop + tinyHeight, boltRadiusComplex, negatives, derivation.boltSides, start)
Example #3
0
def addNegativePeg(derivation, negatives, x, y):
	'Add negative cylinder at x and y.'
	negativePegRadius = derivation.pegRadiusArealized + derivation.halfPegClearance
	inradius = complex(negativePegRadius, negativePegRadius)
	copyShallow = derivation.elementNode.getCopyShallow()
	start = Vector3(x, y, derivation.height)
	sides = evaluate.getSidesMinimumThreeBasedOnPrecision(copyShallow, negativePegRadius)
	cylinder.addCylinderOutputByEndStart(0.0, inradius, negatives, sides, start, derivation.topOverBottom)
Example #4
0
def addNegativePeg(derivation, negatives, x, y):
	'Add negative cylinder at x and y.'
	negativePegRadius = derivation.pegRadiusArealized + derivation.halfPegClearance
	inradius = complex(negativePegRadius, negativePegRadius)
	copyShallow = derivation.elementNode.getCopyShallow()
	start = Vector3(x, y, derivation.height)
	sides = evaluate.getSidesMinimumThreeBasedOnPrecision(copyShallow, negativePegRadius)
	cylinder.addCylinderOutputByEndStart(0.0, inradius, negatives, sides, start, derivation.topOverBottom)
Example #5
0
File: peg.py Project: hy19910/Cura
def getTopAddBiconicOutput(bottomRadians, height, outputs, radius, sides, start, tipRadius, topRadians):
    "Get top and add biconic cylinder to outputs."
    radiusMaximum = max(radius.real, radius.imag)
    topRadiusMaximum = radiusMaximum - height * math.tan(bottomRadians)
    trunkEndZ = start.z + height
    trunkTopOverBottom = topRadiusMaximum / radiusMaximum
    topRadiusComplex = trunkTopOverBottom * radius
    cylinder.addCylinderOutputByEndStart(trunkEndZ, radius, outputs, sides, start, trunkTopOverBottom)
    tipOverTop = tipRadius / topRadiusMaximum
    if tipOverTop >= 1.0:
        return trunkEndZ
    capStart = Vector3(start.x, start.y, trunkEndZ)
    capEndZ = trunkEndZ + (topRadiusMaximum - tipRadius) / math.tan(topRadians)
    cylinder.addCylinderOutputByEndStart(capEndZ, topRadiusComplex, outputs, sides, capStart, tipOverTop)
    return capEndZ
Example #6
0
File: peg.py Project: hy19910/Cura
def addPegOutput(bevel, endZ, outputs, radiusArealized, sides, start, topOverBottom):
    "Add beveled cylinder to outputs given bevel, endZ, radiusArealized and start."
    height = abs(start.z - endZ)
    bevelStartRatio = max(1.0 - bevel / height, 0.5)
    oneMinusBevelStartRatio = 1.0 - bevelStartRatio
    trunkEndZ = bevelStartRatio * endZ + oneMinusBevelStartRatio * start.z
    trunkTopOverBottom = bevelStartRatio * topOverBottom + oneMinusBevelStartRatio
    cylinder.addCylinderOutputByEndStart(trunkEndZ, radiusArealized, outputs, sides, start, trunkTopOverBottom)
    capRadius = radiusArealized * trunkTopOverBottom
    capStart = bevelStartRatio * Vector3(start.x, start.y, endZ) + oneMinusBevelStartRatio * start
    radiusMaximum = max(radiusArealized.real, radiusArealized.imag)
    endRadiusMaximum = radiusMaximum * topOverBottom - bevel
    trunkRadiusMaximum = radiusMaximum * trunkTopOverBottom
    capTopOverBottom = endRadiusMaximum / trunkRadiusMaximum
    cylinder.addCylinderOutputByEndStart(endZ, capRadius, outputs, sides, capStart, capTopOverBottom)
Example #7
0
def getTopAddBiconicOutput(bottomRadians, height, outputs, radius, sides, start, tipRadius, topRadians):
	'Get top and add biconic cylinder to outputs.'
	radiusMaximum = max(radius.real, radius.imag)
	topRadiusMaximum = radiusMaximum - height * math.tan(bottomRadians)
	trunkEndZ = start.z + height
	trunkTopOverBottom = topRadiusMaximum / radiusMaximum
	topRadiusComplex = trunkTopOverBottom * radius
	cylinder.addCylinderOutputByEndStart(trunkEndZ, radius, outputs, sides, start, trunkTopOverBottom)
	tipOverTop = tipRadius / topRadiusMaximum
	if tipOverTop >= 1.0:
		return trunkEndZ
	capStart = Vector3(start.x, start.y, trunkEndZ)
	capEndZ = trunkEndZ + (topRadiusMaximum - tipRadius) / math.tan(topRadians)
	cylinder.addCylinderOutputByEndStart(capEndZ, topRadiusComplex, outputs, sides, capStart, tipOverTop)
	return capEndZ
Example #8
0
def addPegOutput(bevel, endZ, outputs, radiusArealized, sides, start, topOverBottom):
	'Add beveled cylinder to outputs given bevel, endZ, radiusArealized and start.'
	height = abs(start.z - endZ)
	bevelStartRatio = max(1.0 - bevel / height, 0.5)
	oneMinusBevelStartRatio = 1.0 - bevelStartRatio
	trunkEndZ = bevelStartRatio * endZ + oneMinusBevelStartRatio * start.z
	trunkTopOverBottom = bevelStartRatio * topOverBottom + oneMinusBevelStartRatio
	cylinder.addCylinderOutputByEndStart(trunkEndZ, radiusArealized, outputs, sides, start, trunkTopOverBottom)
	capRadius = radiusArealized * trunkTopOverBottom
	capStart = bevelStartRatio * Vector3(start.x, start.y, endZ) + oneMinusBevelStartRatio * start
	radiusMaximum = max(radiusArealized.real, radiusArealized.imag)
	endRadiusMaximum = radiusMaximum * topOverBottom - bevel
	trunkRadiusMaximum = radiusMaximum * trunkTopOverBottom
	capTopOverBottom = endRadiusMaximum / trunkRadiusMaximum
	cylinder.addCylinderOutputByEndStart(endZ, capRadius, outputs, sides, capStart, capTopOverBottom)
Example #9
0
File: peg.py Project: Sciumo/SFACT
def addPegOutput(bevel, endZ, outputs, radius, start, topOverBottom, xmlElement):
	"""Add beveled cylinder to outputs given bevel, endZ, radius and start."""
	height = abs(start.z - endZ)
	bevelStartRatio = max(1.0 - bevel / height, 0.5)
	oneMinusBevelStartRatio = 1.0 - bevelStartRatio
	trunkEndZ = bevelStartRatio * endZ + oneMinusBevelStartRatio * start.z
	trunkTopOverBottom = bevelStartRatio * topOverBottom + oneMinusBevelStartRatio
	sides = evaluate.getSidesMinimumThreeBasedOnPrecision(max(radius.real, radius.imag), xmlElement )
	cylinder.addCylinderOutputByEndStart(trunkEndZ, radius, outputs, sides, start, trunkTopOverBottom)
	capRadius = radius * trunkTopOverBottom
	capStart = bevelStartRatio * Vector3(start.x, start.y, endZ) + oneMinusBevelStartRatio * start
	radiusMaximum = max(radius.real, radius.imag)
	endRadiusMaximum = radiusMaximum * topOverBottom - bevel
	trunkRadiusMaximum = radiusMaximum * trunkTopOverBottom
	capTopOverBottom = endRadiusMaximum / trunkRadiusMaximum
	cylinder.addCylinderOutputByEndStart(endZ, capRadius, outputs, sides, capStart, capTopOverBottom)
Example #10
0
def addPegOutput(bevel, endZ, outputs, radius, start, topOverBottom,
                 xmlElement):
    'Add beveled cylinder to outputs given bevel, endZ, radius and start.'
    height = abs(start.z - endZ)
    bevelStartRatio = max(1.0 - bevel / height, 0.5)
    oneMinusBevelStartRatio = 1.0 - bevelStartRatio
    trunkEndZ = bevelStartRatio * endZ + oneMinusBevelStartRatio * start.z
    trunkTopOverBottom = bevelStartRatio * topOverBottom + oneMinusBevelStartRatio
    sides = evaluate.getSidesMinimumThreeBasedOnPrecision(
        max(radius.real, radius.imag), xmlElement)
    cylinder.addCylinderOutputByEndStart(trunkEndZ, radius, outputs, sides,
                                         start, trunkTopOverBottom)
    capRadius = radius * trunkTopOverBottom
    capStart = bevelStartRatio * Vector3(
        start.x, start.y, endZ) + oneMinusBevelStartRatio * start
    radiusMaximum = max(radius.real, radius.imag)
    endRadiusMaximum = radiusMaximum * topOverBottom - bevel
    trunkRadiusMaximum = radiusMaximum * trunkTopOverBottom
    capTopOverBottom = endRadiusMaximum / trunkRadiusMaximum
    cylinder.addCylinderOutputByEndStart(endZ, capRadius, outputs, sides,
                                         capStart, capTopOverBottom)