예제 #1
0
def getGeometryOutputByNegativesPositivesOnly(negatives, positives, xmlElement):
	'Get triangle mesh from derivation, negatives, positives and xmlElement.'
	positiveOutput = trianglemesh.getUnifiedOutput(positives)
	if len(negatives) < 1:
		return solid.getGeometryOutputByManipulation(positiveOutput, xmlElement)
	if len(positives) < 1:
		negativeOutput = trianglemesh.getUnifiedOutput(negatives)
		return solid.getGeometryOutputByManipulation(negativeOutput, xmlElement)
	return solid.getGeometryOutputByManipulation({'difference' : {'shapes' : [positiveOutput] + negatives}}, xmlElement)
예제 #2
0
def getGeometryOutputByNegativesPositives(derivation, negatives, positives, xmlElement):
	"Get triangle mesh from derivation, negatives, positives and xmlElement."
	interpolationOffset = derivation.interpolationDictionary['offset']
	positiveOutput = trianglemesh.getUnifiedOutput(positives)
	if len(negatives) < 1:
		return getGeometryOutputByOffset(positiveOutput, interpolationOffset, xmlElement)
	if len(positives) < 1:
		negativeOutput = trianglemesh.getUnifiedOutput(negatives)
		return getGeometryOutputByOffset(negativeOutput, interpolationOffset, xmlElement)
	return getGeometryOutputByOffset({'difference' : {'shapes' : [positiveOutput] + negatives}}, interpolationOffset, xmlElement)
예제 #3
0
def getGeometryOutputByNegativesPositives(extrudeDerivation, negatives, positives, xmlElement):
	"Get triangle mesh from extrudeDerivation, negatives, positives and xmlElement."
	positiveOutput = trianglemesh.getUnifiedOutput( positives )
	interpolationOffset = extrudeDerivation.interpolationDictionary['offset']
	if len(negatives) < 1:
		return getGeometryOutputWithConnection(positiveOutput, interpolationOffset, xmlElement)
	return getGeometryOutputWithConnection({'difference' : {'shapes' : [positiveOutput] + negatives}}, interpolationOffset, xmlElement)
예제 #4
0
def getOutputCylinder(
		collarThickness, derivation, gearHolePaths, pitchRadius, teeth, twist, vector3GearProfile, xmlElement):
	"Get extrude output for a cylinder gear."
	extrudeDerivation = extrude.ExtrudeDerivation()
	extrudeDerivation.offsetPathDefault = [Vector3(), Vector3(0.0, 0.0, derivation.pinionThickness)]
	extrudeDerivation.setToXMLElement(derivation.copyShallow)
	negatives = []
	positives = []
	if twist != 0.0:
		twistDegrees = math.degrees(twist)
		extrudeDerivation.twistPathDefault = []
		for complexPoint in derivation.helixPath:
			extrudeDerivation.twistPathDefault.append(Vector3(complexPoint.real, twistDegrees * complexPoint.imag))
		extrude.insertTwistPortions(extrudeDerivation, xmlElement)
	if derivation.operatingAngle != 180.0:
		addBevelGear(derivation, extrudeDerivation, pitchRadius, positives, teeth, vector3GearProfile)
		addCollarShaft(collarThickness, derivation, negatives, positives, xmlElement)
		return extrude.getGeometryOutputByNegativesPositives(extrudeDerivation, negatives, positives, xmlElement)
	if pitchRadius > 0:
		extrude.addNegativesPositives(extrudeDerivation, negatives, vector3GearProfile, positives)
		addLighteningHoles(derivation, gearHolePaths, negatives, pitchRadius, positives)
		addCollarShaft(collarThickness, derivation, negatives, positives, xmlElement)
		return extrude.getGeometryOutputByNegativesPositives(extrudeDerivation, negatives, positives, xmlElement)
	if derivation.plateThickness <= 0.0:
		extrude.addNegativesPositives(extrudeDerivation, negatives, vector3GearProfile, positives)
		return extrude.getGeometryOutputByNegativesPositives(extrudeDerivation, negatives, positives, xmlElement)
	portionDirections = extrude.getSpacedPortionDirections(extrudeDerivation.interpolationDictionary)
	outerGearProfile = vector3GearProfile[0]
	outerLoopLists = extrude.getLoopListsByPath(extrudeDerivation, None, outerGearProfile, portionDirections)
	addBottomLoop(-derivation.plateClearance, outerLoopLists[0])
	geometryOutput = trianglemesh.getPillarsOutput(outerLoopLists)
	positives.append(geometryOutput)
	innerLoopLists = extrude.getLoopListsByPath(extrudeDerivation, None, vector3GearProfile[1], portionDirections)
	addBottomLoop(-derivation.plateClearance, innerLoopLists[0])
	geometryOutput = trianglemesh.getPillarsOutput(innerLoopLists)
	negatives.append(geometryOutput)
	connectionStart = Vector3(0.0, 0.0, -derivation.plateThickness)
	plateDerivation = extrude.ExtrudeDerivation()
	plateDerivation.offsetPathDefault = [connectionStart, Vector3(0.0, 0.0, -derivation.plateClearance)]
	plateDerivation.setToXMLElement(derivation.copyShallow)
	extrude.addNegativesPositives(plateDerivation, negatives, [outerGearProfile], positives)
	vector3LighteningHoles = getLighteningHoles(derivation, gearHolePaths, pitchRadius)
	extrude.addNegativesPositives(plateDerivation, negatives, vector3LighteningHoles, positives)
	addShaft(derivation, negatives, positives)
	connectionEnd = Vector3(0.0, 0.0, derivation.pinionThickness)
	positiveOutput = trianglemesh.getUnifiedOutput(positives)
	annulusPlateOutput = {'difference' : {'shapes' : [positiveOutput] + negatives}}
	if collarThickness <= 0.0:
		outputCylinder = extrude.getGeometryOutputByConnection(connectionEnd, connectionStart, annulusPlateOutput, xmlElement)
		return getLiftedOutput(derivation, outputCylinder, xmlElement)
	negatives = []
	positives = []
	connectionEnd = Vector3(0.0, 0.0, derivation.pinionThickness + collarThickness)
	collarDerivation = extrude.ExtrudeDerivation()
	collarDerivation.offsetPathDefault = [Vector3(0.0, 0.0, -derivation.plateClearance), connectionEnd]
	addCollarShaftSetDerivation(collarDerivation, collarThickness, derivation, negatives, positives, xmlElement)
	collarOutput = {'difference' : {'shapes' : positives + negatives}}
	cylinderOutput = {'union' : {'shapes' : [annulusPlateOutput, collarOutput]}}
	outputCylinder = extrude.getGeometryOutputByConnection(connectionEnd, connectionStart, cylinderOutput, xmlElement)
	return getLiftedOutput(derivation, outputCylinder, xmlElement)
예제 #5
0
def getGeometryOutputByNegativesPositives(extrudeDerivation, negatives, positives, xmlElement):
	"Get triangle mesh from extrudeDerivation, negatives, positives and xmlElement."
	positiveOutput = trianglemesh.getUnifiedOutput( positives )
	interpolationOffset = extrudeDerivation.interpolationDictionary['offset']
	if len(negatives) < 1:
		return getGeometryOutputWithConnection(positiveOutput, interpolationOffset, xmlElement)
	return getGeometryOutputWithConnection({'difference' : {'shapes' : [positiveOutput] + negatives}}, interpolationOffset, xmlElement)
예제 #6
0
def getGeometryOutputByNegativesPositives(extrudeDerivation, negatives, positives, xmlElement):
    "Get triangle mesh from extrudeDerivation, negatives, positives and xmlElement."
    positiveOutput = trianglemesh.getUnifiedOutput(positives)
    interpolationOffset = extrudeDerivation.interpolationDictionary["offset"]
    if len(negatives) < 1:
        return getGeometryOutputByOffset(positiveOutput, interpolationOffset, xmlElement)
    return getGeometryOutputByOffset(
        {"difference": {"shapes": [positiveOutput] + negatives}}, interpolationOffset, xmlElement
    )
예제 #7
0
def getGeometryOutput(xmlElement):
    "Get vector3 vertices from attribute dictionary."
    paths = evaluate.getPathsByKeys(['crosssection', 'section', 'target'],
                                    xmlElement)
    if len(euclidean.getConcatenatedList(paths)) == 0:
        print('Warning, in extrude there are no paths.')
        print(xmlElement.attributeDictionary)
        return None
    offsetPathDefault = [Vector3(), Vector3(0.0, 0.0, 1.0)]
    extrude = Extrude()
    extrude.tiltFollow = evaluate.getEvaluatedBooleanDefault(
        extrude.tiltFollow, 'tiltfollow', xmlElement)
    extrude.tiltTop = evaluate.getVector3ByPrefix('tilttop', extrude.tiltTop,
                                                  xmlElement)
    extrude.maximumUnbuckling = evaluate.getEvaluatedFloatDefault(
        5.0, 'maximumunbuckling', xmlElement)
    scalePathDefault = [Vector3(1.0, 1.0, 0.0), Vector3(1.0, 1.0, 1.0)]
    extrude.interpolationDictionary['scale'] = evaluate.Interpolation(
    ).getByPrefixZ(scalePathDefault, 'scale', xmlElement)
    if extrude.tiltTop == None:
        extrude.interpolationDictionary['offset'] = evaluate.Interpolation(
        ).getByPrefixZ(offsetPathDefault, '', xmlElement)
        tiltPathDefault = [Vector3(), Vector3(0.0, 0.0, 1.0)]
        interpolationTilt = evaluate.Interpolation().getByPrefixZ(
            tiltPathDefault, 'tilt', xmlElement)
        extrude.interpolationDictionary['tilt'] = interpolationTilt
        for point in interpolationTilt.path:
            point.x = math.radians(point.x)
            point.y = math.radians(point.y)
    else:
        offsetAlongDefault = [Vector3(), Vector3(1.0, 0.0, 0.0)]
        extrude.interpolationDictionary['offset'] = evaluate.Interpolation(
        ).getByPrefixAlong(offsetAlongDefault, '', xmlElement)
    insertTwistPortions(extrude.interpolationDictionary, xmlElement)
    segments = evaluate.getEvaluatedIntOne('segments', xmlElement)
    negatives = []
    positives = []
    portionDirections = evaluate.getSpacedPortionDirections(
        extrude.interpolationDictionary)
    for path in paths:
        endMultiplier = None
        if not euclidean.getIsWiddershinsByVector3(path):
            endMultiplier = 1.000001
        geometryOutput = getGeometryOutputByPath(endMultiplier, extrude, path,
                                                 portionDirections)
        if endMultiplier == None:
            positives.append(geometryOutput)
        else:
            negatives.append(geometryOutput)
    positiveOutput = trianglemesh.getUnifiedOutput(positives)
    if len(negatives) < 1:
        return positiveOutput
    return {'difference': [positiveOutput] + negatives}
예제 #8
0
def getGeometryOutput(xmlElement):
	"Get triangle mesh from attribute dictionary."
	paths = evaluate.getPathsByKeys( ['crosssection', 'section', 'target'], xmlElement )
	if len( euclidean.getConcatenatedList( paths ) ) == 0:
		print('Warning, in extrude there are no paths.')
		print( xmlElement.attributeDictionary )
		return None
	offsetPathDefault = [ Vector3(), Vector3( 0.0, 0.0, 1.0 ) ]
	extrude = Extrude()
	extrude.tiltFollow = evaluate.getEvaluatedBooleanDefault( extrude.tiltFollow, 'tiltfollow', xmlElement )
	extrude.tiltTop = evaluate.getVector3ByPrefix('tilttop', extrude.tiltTop, xmlElement )
	extrude.maximumUnbuckling = evaluate.getEvaluatedFloatDefault( 5.0, 'maximumunbuckling', xmlElement )
	scalePathDefault = [ Vector3( 1.0, 1.0, 0.0 ), Vector3( 1.0, 1.0, 1.0 ) ]
	extrude.interpolationDictionary['scale'] = Interpolation().getByPrefixZ( scalePathDefault, 'scale', xmlElement )
	if extrude.tiltTop == None:
		extrude.interpolationDictionary['offset'] = Interpolation().getByPrefixZ( offsetPathDefault, '', xmlElement )
		tiltPathDefault = [ Vector3(), Vector3( 0.0, 0.0, 1.0 ) ]
		interpolationTilt = Interpolation().getByPrefixZ( tiltPathDefault, 'tilt', xmlElement )
		extrude.interpolationDictionary['tilt'] = interpolationTilt
		for point in interpolationTilt.path:
			point.x = math.radians( point.x )
			point.y = math.radians( point.y )
	else:
		offsetAlongDefault = [ Vector3(), Vector3( 1.0, 0.0, 0.0 ) ]
		extrude.interpolationDictionary['offset'] = Interpolation().getByPrefixAlong( offsetAlongDefault, '', xmlElement )
	insertTwistPortions( extrude.interpolationDictionary, xmlElement )
	segments = evaluate.getEvaluatedIntOne('segments', xmlElement )
	negatives = []
	positives = []
	portionDirections = getSpacedPortionDirections( extrude.interpolationDictionary )
	for path in paths:
		endMultiplier = None
		if not euclidean.getIsWiddershinsByVector3( path ):
			endMultiplier = 1.000001
		geometryOutput = getGeometryOutputByPath( endMultiplier, extrude, path, portionDirections )
		if endMultiplier == None:
			positives.append( geometryOutput )
		else:
			negatives.append( geometryOutput )
	positiveOutput = trianglemesh.getUnifiedOutput( positives )
	interpolationOffset = extrude.interpolationDictionary['offset']
	if len( negatives ) < 1:
		return getGeometryOutputWithConnection( positiveOutput, interpolationOffset, xmlElement )
	return getGeometryOutputWithConnection( { 'difference' : [ positiveOutput ] + negatives }, interpolationOffset, xmlElement )