示例#1
0
	def transformSetBottomTopEdges( self, matrixChain ):
		"Create the shape."
		self.setEdgesForAllFaces()
		newMatrix4X4 = self.matrix4X4.getReverseMultiplied( matrixChain )
		for vertex in self.vertices:
			solid.transformVector3ByMatrix( newMatrix4X4.matrix, vertex )
		self.bottom = euclidean.getBottom( self.vertices )
		self.top = euclidean.getTop( self.vertices )
示例#2
0
 def transformSetBottomTopEdges(self, matrixChain):
     "Create the shape."
     self.setEdgesForAllFaces()
     newMatrix4X4 = self.matrix4X4.getReverseMultiplied(matrixChain)
     for vertex in self.vertices:
         solid.transformVector3ByMatrix(newMatrix4X4.matrix, vertex)
     self.bottom = euclidean.getBottom(self.vertices)
     self.top = euclidean.getTop(self.vertices)
示例#3
0
def getGeometryOutput(xmlElement):
	"Get vector3 vertexes from attribute dictionary."
	gearDerivation = GearDerivation()
	gearDerivation.setToXMLElement(xmlElement)
	creationFirst = gearDerivation.creationType.lower()[: 1]
	pitchRadiusSecond = gearDerivation.pitchRadius * float(gearDerivation.teethSecond) / float(gearDerivation.teethPinion)
	toothProfileFirst = getToothProfileCylinder(gearDerivation, gearDerivation.pitchRadius, gearDerivation.teethPinion)
	toothProfileSecond = getToothProfile(gearDerivation, pitchRadiusSecond, gearDerivation.teethSecond)
	gearProfileFirst = getGearProfileCylinder(gearDerivation.teethPinion, toothProfileFirst)
	gearProfileSecond = getGearProfile(gearDerivation, gearDerivation.teethSecond, toothProfileSecond)
	vector3GearProfileFirst = euclidean.getVector3Path(gearProfileFirst)
	vector3GearProfileSecond = euclidean.getVector3Path(gearProfileSecond)
	translation = Vector3()
	moveFirst = gearDerivation.moveType.lower()[: 1]
	if moveFirst != 'n':
		distance = gearDerivation.pitchRadius + pitchRadiusSecond
		if moveFirst != 'm':
			decimalPlaces = 1 - int(math.floor(math.log10(distance)))
			distance += gearDerivation.halfWavelength + gearDerivation.halfWavelength
			distance = round(1.15 * distance, decimalPlaces)
		translation = Vector3(0.0, -distance)
	if gearDerivation.thickness <=0.0:
		return getPathOutput(
			creationFirst, gearDerivation, translation, vector3GearProfileFirst, vector3GearProfileSecond, xmlElement)
	shaftRimRadius = gearDerivation.shaftRadius + gearDerivation.collarWidth
	vector3ShaftPath = getShaftPath(gearDerivation)
	pitchRadius = gearDerivation.pitchRadius
	teeth = gearDerivation.teethPinion
	twist = gearDerivation.helixThickness / gearDerivation.pitchRadius
	extrudeOutputFirst = getOutputCylinder(
		gearDerivation, pitchRadius, shaftRimRadius, teeth, twist, vector3GearProfileFirst, vector3ShaftPath, xmlElement)
	if creationFirst == 'f':
		return extrudeOutputFirst
	pitchRadius = pitchRadiusSecond
	teeth = gearDerivation.teethSecond
	extrudeOutputSecond = None
	if teeth == 0:
		extrudeOutputSecond = getOutputRack(gearDerivation, vector3GearProfileSecond, xmlElement)
	else:
		twist = -gearDerivation.helixThickness / pitchRadiusSecond
		extrudeOutputSecond = getOutputCylinder(
			gearDerivation, pitchRadius, shaftRimRadius, teeth, twist, vector3GearProfileSecond, vector3ShaftPath, xmlElement)
	if creationFirst == 's':
		return extrudeOutputSecond
	if moveFirst == 'v':
		connectionVertexes = matrix.getConnectionVertexes(extrudeOutputSecond)
		translation = Vector3(0.0, 0.0, euclidean.getTop(connectionVertexes))
		euclidean.translateVector3Path(matrix.getConnectionVertexes(extrudeOutputFirst), translation)
	else:
		euclidean.translateVector3Path(matrix.getConnectionVertexes(extrudeOutputSecond), translation)
	return {'group' : {'shapes' : [extrudeOutputFirst, extrudeOutputSecond]}}
示例#4
0
def getGeometryOutput(xmlElement):
    "Get vector3 vertexes from attribute dictionary."
    gearDerivation = GearDerivation()
    gearDerivation.setToXMLElement(xmlElement)
    creationFirst = gearDerivation.creationType.lower()[:1]
    pitchRadiusSecond = gearDerivation.pitchRadius * float(
        gearDerivation.teethSecond) / float(gearDerivation.teethPinion)
    toothProfileFirst = getToothProfileCylinder(gearDerivation,
                                                gearDerivation.pitchRadius,
                                                gearDerivation.teethPinion)
    toothProfileSecond = getToothProfile(gearDerivation, pitchRadiusSecond,
                                         gearDerivation.teethSecond)
    gearProfileFirst = getGearProfileCylinder(gearDerivation.teethPinion,
                                              toothProfileFirst)
    gearProfileSecond = getGearProfile(gearDerivation,
                                       gearDerivation.teethSecond,
                                       toothProfileSecond)
    vector3GearProfileFirst = euclidean.getVector3Path(gearProfileFirst)
    vector3GearProfileSecond = euclidean.getVector3Path(gearProfileSecond)
    translation = Vector3()
    moveFirst = gearDerivation.moveType.lower()[:1]
    if moveFirst != 'n':
        distance = gearDerivation.pitchRadius + pitchRadiusSecond
        if moveFirst != 'm':
            decimalPlaces = 1 - int(math.floor(math.log10(distance)))
            distance += gearDerivation.halfWavelength + gearDerivation.halfWavelength
            distance = round(1.15 * distance, decimalPlaces)
        translation = Vector3(0.0, -distance)
    if gearDerivation.thickness <= 0.0:
        return getPathOutput(creationFirst, gearDerivation, translation,
                             vector3GearProfileFirst, vector3GearProfileSecond,
                             xmlElement)
    shaftRimRadius = gearDerivation.shaftRadius + gearDerivation.collarWidth
    vector3ShaftPath = getShaftPath(gearDerivation)
    pitchRadius = gearDerivation.pitchRadius
    teeth = gearDerivation.teethPinion
    twist = gearDerivation.helixThickness / gearDerivation.pitchRadius
    extrudeOutputFirst = getOutputCylinder(gearDerivation, pitchRadius,
                                           shaftRimRadius, teeth, twist,
                                           vector3GearProfileFirst,
                                           vector3ShaftPath, xmlElement)
    if creationFirst == 'f':
        return extrudeOutputFirst
    pitchRadius = pitchRadiusSecond
    teeth = gearDerivation.teethSecond
    extrudeOutputSecond = None
    if teeth == 0:
        extrudeOutputSecond = getOutputRack(gearDerivation,
                                            vector3GearProfileSecond,
                                            xmlElement)
    else:
        twist = -gearDerivation.helixThickness / pitchRadiusSecond
        extrudeOutputSecond = getOutputCylinder(gearDerivation, pitchRadius,
                                                shaftRimRadius, teeth, twist,
                                                vector3GearProfileSecond,
                                                vector3ShaftPath, xmlElement)
    if creationFirst == 's':
        return extrudeOutputSecond
    if moveFirst == 'v':
        connectionVertexes = matrix.getConnectionVertexes(extrudeOutputSecond)
        translation = Vector3(0.0, 0.0, euclidean.getTop(connectionVertexes))
        euclidean.translateVector3Path(
            matrix.getConnectionVertexes(extrudeOutputFirst), translation)
    else:
        euclidean.translateVector3Path(
            matrix.getConnectionVertexes(extrudeOutputSecond), translation)
    return {'group': {'shapes': [extrudeOutputFirst, extrudeOutputSecond]}}