def build(self):
		self.shapes = []
		commonParams = {
			'maxDepth': 1,
			'angles': [0, 55],
			'featureSize': 1,
			'featureSizeFactor': [1, 0.6],
			'length': 6,
			'lengthFactor': [0.91, 0.67],
			'minLength': 0.1,
			'minFeatureSize': 0.1,
			'directionalitySum': 1,
			'directionalityExponent': 0.6,
			'directionalityFactor': -20,
			'skipPercentage': 0,
		}
		branch1Params = commonParams.copy()
		branch1Params.update({
			'featureSizeFactor': [1.0, 0.6],
			'featureSize': 1,
		})
		branch2Params = commonParams.copy()
		branch2Params.update({
			'featureSizeFactor': [0.92, 0.57],
			'featureSize': 1.8,
		})
		branch1 = ChandBranch(branch1Params)
		branch2 = ChandBranch(branch2Params)
		topShape = ShapeGroup(
			'topshape', branch1, branch1.getTransformedCopy(angle=120), branch1.getTransformedCopy(angle=240),
			branch2, branch2.getTransformedCopy(angle=120), branch2.getTransformedCopy(angle=240)
		)
		self.shapes.append(topShape)
		Design.build(self)
	def build(self):
		self.shapes = []
		trace = BranchingShape(TwoHoleChains, {
			'startPoint' : (36, 5),
			'lengthScaling' : 0.6,
			'featureScaling' : 0.6,
			'angle' : 90,
			'depth' : 0,
			'maxDepth' : 9,
			'angles' : [70, -70],
			'directionalitySum' : 0,
			'featureScalingFactor' : [0.9, 0.9],
			'lengthScalingFactor' : [0.8, 0.8],
			'minLengthScaling' : 0.05,
			'minFeatureScaling' : 0,
			'directionalityAngleAdjustmentExponent' : 1.6,
			'directionalityAngleAdjustmentFactor' : 2,
			'distanceLimitingFactor' : 0,
			'skipPercentage' : 15,
			'baseRadius' : 0.9,
			'holeRadiiFactors' : [0.5, 0.4, 0.6, 1],
			'baseLength' : 22.5,
			'exponentialDistanceLimitingFactor' : 1.1,
			'limitLines' : [((0, 0), (72, 0.1)), ((72, 0.1), (72.1, 36)), ((72.1, 36), (0.1, 36.1)), ((0.1, 36.1), (0, 0))]
		})
		topShape = ShapeGroup('topshape', trace) 
		self.shapes.append(topShape)
		Design.build(self)
	def build(self):
		self.shapes = []
		commonParams = {
			'maxDepth': 6,
			'angles': [-50, 70],
			'featureSizeFactor': [1.0, 0.6],
			'featureSize': 2,
			'lengthFactor': [1.08, 0.8],
			'length': 5,
			'minLength': 0.1,
			'minFeatureSize': 0.6,
			'directionalityExponent': 0.8,
			'directionalityFactor': 1,
		}
		branch1Params = commonParams.copy()
		branch1Params.update({
			'featureSizeFactor': [1.0, 0.6],
			'featureSize': 2,
		})
		branch2Params = commonParams.copy()
		branch2Params.update({
			'featureSizeFactor': [0.97, 0.57],
			'featureSize': 2.8,
		})
		branch = HoneycombSpiral(branch1Params)
		branch2 = HoneycombSpiral(branch2Params)
		topShape = ShapeGroup(
			'topshape', 
			branch,
			branch2
		)
		self.shapes.append(topShape)
		Design.build(self)
Example #4
0
	def build(self):
		self.shapes = []
		spirals = ShapeGroup('apirals')
		spiralAngleSpan = 30
		spiralSpacing = 5
		for i in range(12):
			innerSpiral = Spiral({
				'rotationAngle' : 0,
				'sweepStartAngle' : i * (spiralAngleSpan + spiralSpacing),
				'centerPoint' : (0, 0),
				'scaleFactor' : 0.5,
				'growthFactorAdjustment' : 0.5,
				'sweepAngleSpan' : spiralAngleSpan,
				'reverse' : True,
				'id' : 'innerSpiral'
			})
			outerSpiral = Spiral({
				'rotationAngle' : 0,
				'sweepStartAngle' : i * (spiralAngleSpan + spiralSpacing),
				'centerPoint' : (0, 0),
				'scaleFactor' : 0.5,
				'growthFactorAdjustment' : 1,
				'sweepAngleSpan' : spiralAngleSpan,
				'reverse' : True,
				'id' : 'outerSpiral'
			})
			lArc = Arc({
				'startPoint' : '%outerSpiral.endPoint',
				'startAngle' : '%outerSpiral.endAngle - 70',
				'reverse' : True,
				'endPoint' : '%innerSpiral.endPoint'
			})
			rArc = Arc({
				'startPoint' : '%outerSpiral.startPoint',
				'startAngle' : '%outerSpiral.startAngle - 70',
				'reverse' : True,
				'endPoint' : '%innerSpiral.startPoint'
			})
			circle = Circle({
				'centerPoint' : 'avgPoints(%outerSpiral.endPoint , %innerSpiral.startPoint )',
				'radius' : 'distanceBetween(%outerSpiral.startPoint , %innerSpiral.startPoint ) / 4'
			})
			segment = ShapeGroup('segment' + str(i), innerSpiral, outerSpiral, lArc, rArc, circle)
			spirals.addSubShape(segment)
		topShape = ShapeGroup('top', spirals)
		self.shapes.append(topShape)
		Design.build(self)
	def build(self):
		trace = BranchingShape(CirclesAtNodes, {
			'startPoint' : (0, 0),
			'lengthScaling' : 1.1,
			'featureScaling' : 2,
			'angle' : 90,
			'depth' : 0,
			'maxDepth' : 7,
			'angles' : [60, 0],
			'directionalitySum' : 0,
			'featureScalingFactor' : [0.6, 1, 0.6],
			'lengthScalingFactor' : [0.48, 0.85, 0.35],
			'minLengthScaling' : 0.1,
			'minFeatureScaling' : 0.1,
			'directionalityAngleAdjustmentExponent' : 1.6,
			'directionalityAngleAdjustmentFactor' : 8,
			'distanceLimitingFactor' : 0.2,
			'skipPercentage' : 0,
		})
		topShape = ShapeGroup('topshape', trace, trace.getTransformedCopy(angle = 120), trace.getTransformedCopy(angle = 240))
		self.shapes.append(topShape)
		Design.build(self)
Example #6
0
	def build(self):
		self.shapes = []
		arc = Arc({
			'startPoint' : (0, -1),
			'endPoint' : (1, 0),
			'radius' : 0.8,
			'id' : 'arc1'
		})
		xLine = Line({
			'startPoint' : (0, 0),
			'endPoint' : (5, 0)
		})
		yLine = Line({
			'startPoint' : (0, 0),
			'endPoint' : (0, 5)
		})
		circle = Circle({
			'centerPoint' : '%arc1.centerPoint',
			'radius' : 0.1
		})
		topShape = ShapeGroup('top', arc, xLine, yLine, circle)
		self.shapes.append(topShape)
		Design.build(self)
	def build(self):
		spiralSweep = 330 - 15 * self.sizeIndex
		growthFactorDiff = 0.35 + 0.02 * self.sizeIndex
		self.shapes = []
		inner = ArcChain('inner', [{
			'rotationAngle' :  - 13 * self.sizeIndex,
			'centerPoint' : (0, 0),
			'scaleFactor' : 0.5 + 0.1 * self.sizeIndex,
			'growthFactorAdjustment' : 1.0 - growthFactorDiff/2,
			'sweepAngleSpan' : 330 + 90 - 13 * self.sizeIndex,
			'reverse' : True
		# },{
			# 'angleSpan' : 25 - 2 * self.sizeIndex,
			# 'radius' :3,
			# 'noDirectionAlternate' : True
		}])
		outer = ArcChain('outer', [{
			'rotationAngle' : '%inner.arc0.rotationAngle',
			'centerPoint' : (0, 0),
			'scaleFactor' : '%inner.arc0.scaleFactor',
			'growthFactorAdjustment' : 1.0 + growthFactorDiff / 2,
			'sweepAngleSpan' : 330 - 15 * self.sizeIndex,
			'reverse' : True
		},{
			'angleSpan' : 45,
			'radius' : 8,
		}])
		holeChain = ArcChain('holeChain', [{
			'rotationAngle' : '%outer.arc0.rotationAngle',
			'centerPoint' : (0, 0),
			'scaleFactor' : '%outer.arc0.scaleFactor',
			'growthFactorAdjustment' : 1.0,
			'sweepAngleSpan' : '%outer.arc0.sweepAngleSpan',
			'reverse' : True
		},{
			'angleSpan' : 41,
			'radius' : '%outer.arc1.radius * 1.2',
		}])
		holes = HolesOnArcChain(holeChain, {
			'holeDistance' : 0.2, 
			'holeRadii' : [0.03, 0.06, 0.3, 0.4, 0.6, 0.7, 0.8],
			'minRadius' : 0.045,
			'id' : 'hole'
		})
		side = ShapeGroup('side', inner, outer, holes)
		side.p.startPoint = '%outer.endPoint'
		side.p.endPoint = '%inner.endPoint'
		# hole = Circle({
			# 'centerPoint' : (3.9 + 0.065 * self.sizeIndex, 0),
			# 'radius' : 0.5 + 0.05 * self.sizeIndex
		# })
		# hole.transform(angle = 3 + 1.5 * self.sizeIndex)

		topShape = ShapeGroup(
			'top', 
			side, 
			# hole, hole.getTransformedCopy(angle = 120), 
			# hole.getTransformedCopy(angle = 240)
		)
		self.shapes.append(topShape)
		Design.build(self)
	def __init__(self, sizeIndex=0):
		Design.__init__(self)
		self.sizeIndex = sizeIndex
	def build(self):
		self.shapes = []
		spiral = Spiral({
			'rotationAngle' : 45, 
			'centerPoint' : (0,0), 
			'sweepAngleSpan' : 420, 
			'scaleFactor' : 0.5, 
			'growthFactorAdjustment' : 1, 
			'reverse' : True,
			'id' : 'spiral'
		})
		arc1 = Arc({
			'startPoint' : 'spiral.endPoint',
			'startAngle' : 'spiral.endAngle+180',
			'endAngle' : 'spiral.endAngle+250',
			'radius' : 4,
			'reverse' : False,
			'id' : 'arc1',
			'changeableParams' : []
		})
		arc2 = Arc({
			'startPoint' : 'arc1.endPoint',
			'startAngle' : 'arc1.endAngle+180',
			'radius' : 5,
			'endAngle' : 'arc1.endAngle+100',
			'reverse' : True,
			'id' : 'arc2',
			'changeableParams' : ['endAngle']
		})
		middleCurve = ShapeGroup('middleCurve', spiral, arc1, arc2)

		spiral = Spiral({
			'rotationAngle' : 'middleCurve.spiral.rotationAngle', 
			'centerPoint' : (0,0), 
			'sweepAngleSpan' : 'middleCurve.spiral.sweepAngleSpan', 
			'scaleFactor' : 'middleCurve.spiral.scaleFactor*1.2', 
			'growthFactorAdjustment' : 1, 
			'reverse' : True,
			'id' : 'spiral'
		})
		arc1 = Arc({
			'startPoint' : 'spiral.endPoint',
			'startAngle' : 'spiral.endAngle+180',
			'endAngle' : 'spiral.endAngle+250',
			'radius' : 'middleCurve.arc1.radius*0.7',
			'reverse' : False,
			'id' : 'arc1',
			'changeableParams' : []
		})
		arc2 = Arc({
			'startPoint' : 'arc1.endPoint',
			'startAngle' : 'arc1.endAngle+180',
			'radius' : 'middleCurve.arc2.radius*1.4',
			'endAngle' : 'arc1.endAngle+120',
			'reverse' : True,
			'id' : 'arc2',
			'changeableParams' : ['endAngle']
		})
		outerCurve = ShapeGroup('outerCurve', spiral, arc1, arc2)

		spiral = Spiral({
			'rotationAngle' : 'middleCurve.spiral.rotationAngle', 
			'centerPoint' : (0,0), 
			'sweepAngleSpan' : 'middleCurve.spiral.sweepAngleSpan+30', 
			'scaleFactor' : 'middleCurve.spiral.scaleFactor*0.8', 
			'growthFactorAdjustment' : 1, 
			'reverse' : True,
			'id' : 'spiral'
		})
		arc1 = Arc({
			'startPoint' : 'spiral.endPoint',
			'startAngle' : 'spiral.endAngle+180',
			'endAngle' : 'spiral.endAngle+250',
			'radius' : 'middleCurve.arc1.radius*1.2',
			'reverse' : False,
			'id' : 'arc1',
			'changeableParams' : []
		})
		arc2 = Arc({
			'startPoint' : 'arc1.endPoint',
			'startAngle' : 'arc1.endAngle+180',
			'radius' : 'middleCurve.arc2.radius*0.8',
			'endAngle' : 'arc1.endAngle+100',
			'reverse' : True,
			'id' : 'arc2',
			'changeableParams' : ['endAngle']
		})
		innerCurve = ShapeGroup('innerCurve', spiral, arc1, arc2)
		holes = HolesOnArcChain(middleCurve, {
			'holeDistance' : 0.125, 
			'holeRadii' : [0.125, 0.25, 1, 0.5],
			'id' : 'holeChain',
			'changeableParams' : ['holeDistance']
		})
		topShape = ShapeGroup('top', innerCurve, holes, outerCurve, middleCurve)
		middleCurve.updateParam('excludeSubShapes', True)
		self.shapes.append(topShape)
		Design.build(self)
Example #10
0
	def build(self):
		self.shapes = []
		spirals = ShapeGroup('apirals')
		spiralAngleSpan = 65.
		spiralSpacing = 5.
		spiralInterval = spiralAngleSpan + spiralSpacing
		scaleFactors = (0.125, 0.125)
		growthFactors = (0.5, 0.707)
		def makeSegment(innerSizeFactor, outerSizeFactor, startAngle, angleSpan):
			innerGrowthFactor = interpolate(innerSizeFactor, growthFactors)
			outerGrowthFactor = interpolate(outerSizeFactor, growthFactors)
			innerScaleFactor = interpolate(innerSizeFactor, scaleFactors)
			outerScaleFactor = interpolate(outerSizeFactor, scaleFactors)
			innerSpiral = Spiral({
				'rotationAngle' : 0,
				'sweepStartAngle' : startAngle,
				'centerPoint' : (0, 0),
				'scaleFactor' : innerScaleFactor,
				'growthFactorAdjustment' : innerGrowthFactor,
				'sweepAngleSpan' : angleSpan,
				'reverse' : True,
				'id' : 'innerSpiral'
			})
			outerSpiral = Spiral({
				'rotationAngle' : 0,
				'sweepStartAngle' : startAngle,
				'centerPoint' : (0, 0),
				'scaleFactor' : outerScaleFactor,
				'growthFactorAdjustment' : outerGrowthFactor,
				'sweepAngleSpan' : angleSpan,
				'reverse' : True,
				'id' : 'outerSpiral'
			})
			lArc = Arc({
				'startPoint' : '%outerSpiral.endPoint',
				'startAngle' : '%outerSpiral.endAngle + 30',
				'reverse' : False,
				'endPoint' : '%innerSpiral.endPoint'
			})
			rArc = Arc({
				'startPoint' : '%outerSpiral.startPoint',
				'startAngle' : '%outerSpiral.startAngle + 30',
				'reverse' : False,
				'endPoint' : '%innerSpiral.startPoint'
			})
			segment = ShapeGroup('segment' + str(i), innerSpiral, outerSpiral, lArc, rArc)
			spirals.addSubShape(segment)
		i = 0
		while i < 6:
			makeSegment(0, 1, i * spiralInterval, spiralAngleSpan)
			i += 1
		makeSegment(0.52, 1, i * spiralInterval, (spiralAngleSpan / 2) - spiralSpacing)
		while i < 8:
			makeSegment(0, 0.5, i * spiralInterval, spiralAngleSpan)
			makeSegment(0.52, 1, i * spiralInterval + spiralAngleSpan / 2, spiralAngleSpan)
			i += 1
		makeSegment(0.77, 1, i * spiralInterval + spiralAngleSpan / 2, (spiralAngleSpan / 2) - spiralSpacing)
		while i < 10:
			makeSegment(0, 0.5, i * spiralInterval, spiralAngleSpan)
			makeSegment(0.52, 0.75, i * spiralInterval + spiralAngleSpan / 2, spiralAngleSpan)
			makeSegment(0.77, 1, i * spiralInterval + spiralAngleSpan, spiralAngleSpan)
			i += 1
		topShape = ShapeGroup('top', spirals)
		self.shapes.append(topShape)
		Design.build(self)
	def build(self):
		self.shapes = []
		traces = NodeyCircuitTraceGroup({
			'points' : [(0, 0), (0, 10), (5, 15), (5, 20), (10, 25)],
			'numTraces' : 5,
		})
		traces2 = NodeyCircuitTraceGroup({
			'points' : [(-3.75, 0), (-3.75, 20), (-15, 20), (-15, 30)],
			'numTraces' : 5,
		})
		spine = SpineyCircuitTraceGroup({
			'vectors' : [(15, 0), (0, 20), getEndPoint((0, 0), 60, endY=10), (0, 15), getEndPoint((0, 0), 120, endY=10), getEndPoint((0, 0), 121, endY=18)],
			'id' : 'spine',
			'numTraces' : 1,
			'segmentLength' : 20,
		})
		spine.calculate()
		topShape = ShapeGroup('top', spine)
		numPoints = len(spine.p.attachmentPoints[0])
		oldAngle = False
		segmentIndex = -1
		directions = [(-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1)]
		line1Lengths = [(5, 3), (4, 2.5), (1.5, 4), (1.5, 4), (6, 4)]
		line2Lengths = [(17, 23), (9, 14), (14, 10), (10, 10), (18, 10)]
		line2Angles = [(0, 30), (30, 0), (30, 0), (30, 30), (0, 30)]
		groupEndPoints = [[], []]
		traceCounts = [[], []]
		traceEndPoints = [[], []]
		for i in range(numPoints):
			spineAngle = spine.p.attachmentPoints[0][i][1] - 60
			if not spineAngle == oldAngle:
				segmentCount = 0
				segmentIndex += 1
				oldAngle = spineAngle
				startLinePos = transformPoint(spine.p.attachmentPoints[0][i][0], - (spineAngle - 90))[1]
				for j in range(2):
					if traceEndPoints[j]:
						groupEndPoints[j].append(avgPoints(*traceEndPoints[j]))
						traceCounts[j].append(len(traceEndPoints[j]))
					traceEndPoints[j] = []
				firstLineEndPoints = [[False, False], [False, False]]
			for j in range(2):
				if j == 0:
					line1Angle = spineAngle + 60
					line2Angle = spineAngle + line2Angles[segmentIndex][j]
				else:
					line1Angle = spineAngle - 60
					line2Angle = spineAngle - line2Angles[segmentIndex][j]
				if directions[segmentIndex][j]:
					if not firstLineEndPoints[j][0]:
						vector = transformPoint((line1Lengths[segmentIndex][j], 0), line1Angle)
						line1EndPoint = addVectors(spine.p.attachmentPoints[j][i][0], vector)
						vector = transformPoint((line2Lengths[segmentIndex][j], 0), line2Angle)
						line2EndPoint = addVectors(line1EndPoint, vector)
						firstLineEndPoints[j] = [line1EndPoint, line2EndPoint]
					else:
						offsetVector = transformPoint((0.75 * (directions[segmentIndex][j] * segmentCount), 0), line2Angle + 90 - 180 * j)
						point = addVectors(offsetVector, firstLineEndPoints[j][0])
						line1EndPoint = getIntersect(point, line2Angle, spine.p.attachmentPoints[j][i][0], line1Angle)
						line2EndPoint = addVectors(firstLineEndPoints[j][1], offsetVector)
					topShape.addSubShape(NodeyCircuitTrace({
						'startPoint' : spine.p.attachmentPoints[j][i][0],
						'endPoint' : line1EndPoint,
					}))
					topShape.addSubShape(NodeyCircuitTrace({
						'startPoint' : line1EndPoint,
						'endPoint' : line2EndPoint
					}))
					traceEndPoints[j].append(line2EndPoint)
			segmentCount += 1
		for j in range(2):
			if traceEndPoints[j]:
				groupEndPoints[j].append(avgPoints(*traceEndPoints[j]))
				traceCounts[j].append(len(traceEndPoints[j]))
		topShape.addSubShape(NodeyCircuitTraceGroup({
			'vectors' : [groupEndPoints[0][0], (0, 5), getEndPoint((0, 0), 120, endY=10), getEndPoint((0, 0), 150, endY=10)],
			'numTraces' : traceCounts[0][0],
		}))
		topShape.addSubShape(NodeyCircuitTraceGroup({
			'vectors' : [groupEndPoints[0][1], getEndPoint((0, 0), 90, endY=2), getEndPoint((0, 0), 120, endY=5), getEndPoint((0, 0), 150, endY=10)],
			'numTraces' : traceCounts[0][1],
		}))
		topShape.addSubShape(NodeyCircuitTraceGroup({
			'vectors' : [groupEndPoints[0][2], getEndPoint((0, 0), 120, endY=2), getEndPoint((0, 0), 150, endY=10)],
			'numTraces' : traceCounts[0][2],
		}))
		topShape.addSubShape(NodeyCircuitTraceGroup({
			'vectors' : [groupEndPoints[0][3], getEndPoint((0, 0), 150, endY=10)],
			'numTraces' : traceCounts[0][3],
		}))
		topShape.addSubShape(NodeyCircuitTraceGroup({
			'vectors' : [groupEndPoints[1][0], getEndPoint((0, 0), 60, endY=2), (0, 40), getEndPoint((0, 0), 60, endY=6)],
			'numTraces' : traceCounts[1][0],
		}))
		topShape.addSubShape(NodeyCircuitTraceGroup({
			'vectors' : [groupEndPoints[1][1], getEndPoint((0, 0), 60, endY=2), (0, 31), getEndPoint((0, 0), 60, endY=6)],
			'numTraces' : traceCounts[1][1],
		}))
		topShape.addSubShape(NodeyCircuitTraceGroup({
			'vectors' : [groupEndPoints[1][2], (0, 1.5), getEndPoint((0, 0), 60, endY=2), (0, 31), getEndPoint((0, 0), 60, endY=6)],
			'numTraces' : traceCounts[1][2],
		}))
		topShape.addSubShape(Line({'startPoint' : (0, 0), 'endPoint' : (33, 0)}))
		topShape.addSubShape(Line({'startPoint' : (33, 0), 'endPoint' : (33, 70)}))
		topShape.addSubShape(Line({'startPoint' : (33, 70), 'endPoint' : (0, 70)}))
		topShape.addSubShape(Line({'startPoint' : (0, 70), 'endPoint' : (0, 0)}))
		self.shapes.append(topShape)
		Design.build(self)
	def build(self):
		self.shapes = []
		arcChain = ArcChain('arcChain', [{
			'startPoint' : (0, 0),
			'startAngle' : 120, 
			'angleSpan' : 30, 
			'radius' : 5,
			'reverse' : True,
		},{
			'angleSpan' : 60,
			'radius' :5,
		},{
			'angleSpan' : 60,
			'radius' : 3
		},{
			'angleSpan' : 60,
			'radius' : '%arc1.radius',
		},{
			'angleSpan' : 30,
			'radius' : '%arc0.radius',
		}])

		endArc = Arc({
			'startPoint' : (0, 0),
			'startAngle' : 110,
			'endAngle' : 250,
			'radius' : 3,
			'reverse' : True,
			'id' : 'endArc'
		})
		oneSide = ShapeChain('oneSide', (endArc, 'es'), (arcChain, 'se'))
		sides = ShapeChain('sides', (oneSide, 'es'), (oneSide.getTransformedCopy(angle=120), 'es'), (oneSide.getTransformedCopy(angle=240), 'es'))
		sides.transform(distance = 'subtractVectors((0 , 0), avgPoints(%oneSide.endArc.centerPoint, %oneSide1.endArc.centerPoint, %oneSide2.endArc.centerPoint))')
		arcChainForHoles = ArcChain('arcChainForHoles', [{
			'rotationAngle' : 0,
			'centerPoint' : (0, 0),
			'scaleFactor' : 0.5,
			'growthFactorAdjustment' : 1.0,
			'sweepAngleSpan' : 360,
			'reverse' : True
		},{
			'angleSpan' : 25 ,
			'radius' : 5,
		},{
			'angleSpan' : 60 ,
			'radius' : '%oneSide.arcChain.arc2.radius - 0.75',
		},{
			'angleSpan' : 30,
			'radius' : '%oneSide.arcChain.arc3.radius + 0.75',
		},{
			'angleSpan' : 50,
			'radius' : 4,
			'noDirectionAlternate' : True
		}])
		holes = HolesOnArcChain(arcChainForHoles, {
			'holeDistance' : 0.2, 
			'holeRadii' : [0.1, 0.2, 0.125, 0.4, 0.2, 0.1],
			'id' : 'holeChain'
		})
		holes.transform(angle = '%oneSide.arcChain.arc2.startAngle - %arc2.startAngle')
		holes.transform(distance = 'subtractVectors (%oneSide.arcChain.arc2.centerPoint , %arc2.centerPoint )')
		sideHoles = ShapeGroup('sideHoles', holes, holes.getTransformedCopy(angle=120), holes.getTransformedCopy(angle=240))
		circle = Circle({
			'centerPoint' : '%oneSide.arcChain.arc2.centerPoint',
			'radius' : 1,
			'id' : 'circle'
		})
		topShape = ShapeGroup('top', sides, sideHoles, circle, circle.getTransformedCopy(angle=120), circle.getTransformedCopy(angle=240))
		self.shapes.append(topShape)
		Design.build(self)
Example #13
0
	def build(self):
		self.shapes = []
		spirals = ShapeGroup('apirals')
		spiralAngleSpan = 65.
		spiralSpacing = 5.
		spiralInterval = spiralAngleSpan + spiralSpacing
		scaleFactors = (0.125, 0.125)
		growthFactors = (0.5, 0.707)
		
		def makeSegment(innerSizeFactor, outerSizeFactor, startAngle, angleSpan):
			innerGrowthFactor = interpolate(innerSizeFactor, growthFactors)
			outerGrowthFactor = interpolate(outerSizeFactor, growthFactors)
			innerScaleFactor = interpolate(innerSizeFactor, scaleFactors)
			outerScaleFactor = interpolate(outerSizeFactor, scaleFactors)
			innerSpiral = Spiral({
				'rotationAngle' : 0,
				'sweepStartAngle' : startAngle,
				'centerPoint' : (0, 0),
				'scaleFactor' : innerScaleFactor,
				'growthFactorAdjustment' : innerGrowthFactor,
				'sweepAngleSpan' : angleSpan,
				'reverse' : True,
				'id' : 'innerSpiral'
			})
			outerSpiral = Spiral({
				'rotationAngle' : 0,
				'sweepStartAngle' : startAngle,
				'centerPoint' : (0, 0),
				'scaleFactor' : outerScaleFactor,
				'growthFactorAdjustment' : outerGrowthFactor,
				'sweepAngleSpan' : angleSpan,
				'reverse' : True,
				'id' : 'outerSpiral'
			})
			lArc = Arc({
				'startPoint' : '%outerSpiral.endPoint',
				'startAngle' : '%outerSpiral.endAngle + 30',
				'reverse' : False,
				'endPoint' : '%innerSpiral.endPoint'
			})
			rArc = Arc({
				'startPoint' : '%outerSpiral.startPoint',
				'startAngle' : '%outerSpiral.startAngle + 30',
				'reverse' : False,
				'endPoint' : '%innerSpiral.startPoint'
			})
			holeSpiral = Spiral({
				'rotationAngle' : 0,
				'sweepStartAngle' : startAngle + 5,
				'centerPoint' : (0, 0),
				'scaleFactor' : interpolate(0.57, (innerScaleFactor, outerScaleFactor)),
				'growthFactorAdjustment' : interpolate(0.57, (innerGrowthFactor, outerGrowthFactor)),
				'sweepAngleSpan' : angleSpan - 10,
				'reverse' : True,
				'id' : 'holeSpiral'
			})
			lowerRadius = 0.25 * (outerSpiral.getRadius(startAngle) - innerSpiral.getRadius(startAngle))
			upperRadius = 0.25 * (outerSpiral.getRadius(startAngle + angleSpan) - innerSpiral.getRadius(startAngle + angleSpan))
			holes = HolesOnArcChain(ShapeGroup('holeSpiralGroup', holeSpiral), {
				'holeDistance' : 0.24 - (startAngle/3000)**1.8, 
				'holeRadii' : [lowerRadius, upperRadius],
				'minRadius' : 0.055,
				'id' : 'holes'
			})
			segment = ShapeGroup('segment' + str(i), innerSpiral, outerSpiral, holes, lArc, rArc)
			spirals.addSubShape(segment)
		i = 0
		while i < 12:
			makeSegment(0, 1, i * spiralInterval, spiralAngleSpan)
			i += 1
		innerBound = Spiral({
			'rotationAngle' : 0,
			'sweepStartAngle' : 0,
			'centerPoint' : (0, 0),
			'scaleFactor' : 0.125,
			'growthFactorAdjustment' : 0.48,
			'sweepAngleSpan' : 12 * spiralInterval + 5,
			'reverse' : True,
			'id' : 'innerBound'
		})
		outerBound = Spiral({
			'rotationAngle' : 0,
			'sweepStartAngle' : 0,
			'centerPoint' : (0, 0),
			'scaleFactor' : 0.125,
			'growthFactorAdjustment' : 0.717,
			'sweepAngleSpan' : 12 * spiralInterval + 1,
			'reverse' : True,
			'id' : 'outerBound'
		})
		endArc = Arc({
			'startPoint' : '%outerBound.endPoint',
			'startAngle' : '%outerBound.endAngle + 30',
			'reverse' : False,
			'endPoint' : '%innerBound.endPoint'
		})
		topShape = ShapeGroup('top', spirals)#, innerBound, outerBound, endArc)
		self.shapes.append(topShape)
		Design.build(self)
	def build(self):
		def makeHoleChain(arcChain, id=False, holeradii=[0.125, 0.125, 0.2, 0.3, 0.4]):
			if not id:
				id = 'holes' + str(self.holeChainCount)
			holes = HolesOnArcChain(arcChain, {
				'holeDistance' : 0.3, 
				'holeRadii' : holeradii,
				'minRadius' : 0.125,
				'id' : id 
			})
			topShape.addSubShape(holes)
			self.holeChainCount += 1
			return holes
		self.holeChainCount = 0
		self.shapes = []
		topShape = ShapeGroup('topshape')
		topShape.addSubShape(Circle({'id' : 'heater', 'centerPoint' : (0, 39), 'radius' : 7}))
		topShape.addSubShape(Circle({'id' : 'board', 'centerPoint' : (33, 0), 'radius' : 10}))
		arcChain = ArcChain('arcChain', [{
			'startPoint' : (16, 0),
			'startAngle' : 185, 
			'angleSpan' : 60, 
			'radius' : 13,
			'reverse' : True,
		},{
			'angleSpan' : 105,
			'radius' : 25,
		},{
			'angleSpan' : 30,
			'radius' : 50,
		}])
		topShape.addSubShape(arcChain)
		arcChain.p.excludeSubShapes = True
		for i in range(5):
			offset = OffsetArcChain(arcChain, {
				'id' : 'offset' + str(i),
				'offset' : -1 * i - 0.5,
			})
			offset.transform(angle = 1 + 2 * i)
			offset.transform(distance = (0, -0.5 * i))
			smallholes = HolesOnArcChain(offset, {
				'holeDistance' : 2, 
				'holeRadii' : [0.01, 0.1, 0.3, 0.2, 0.2, 0.4, 0.5],
				'minRadius' : 0.06,
				'id' : 'little' + str(i) 
			})
			topShape.addSubShape(smallholes)
			offset = OffsetArcChain(arcChain, {
				'id' : 'offset' + str(i),
				'offset' : -1 * i,
			})
			offset.transform(angle = 2 * i)
			offset.transform(distance = (0, -0.5 * i))
			holes = makeHoleChain(offset, 'big' + str(i))
			if i==2:
				smallholes.p.startTrim = 1
			if i==3:
				holes.p.startTrim = 19
				smallholes.p.startTrim = 3
			if i==4:
				holes.p.startTrim = 38
				smallholes.p.startTrim = 5
		offset = OffsetArcChain(arcChain, {
			'id' : 'offset' + str(i),
			'offset' : -5.5,
		})
		offset.transform(angle = 11.5)
		offset.transform(distance = (1, -4))
		smallholes = HolesOnArcChain(offset, {
			'holeDistance' : 2, 
			'holeRadii' : [0.01, 0.01, 0.01, 0.01, 0.1, 0.3, 0.3, 0.4, 0.5],
			'minRadius' : 0.06,
			'id' : 'little5' 
		})
		topShape.addSubShape(smallholes)
		spiral = Spiral({
			'rotationAngle' : 0,
			'centerPoint' : (0, 0),
			'scaleFactor' : 1,
			'growthFactorAdjustment' : 0.5,
			'sweepAngleSpan' : 720,
			'reverse' : False,
			'id' : 'spiral4'
		})
		holes = makeHoleChain(ShapeGroup('group', spiral), False, [0.125, 0.125,0.3,  0.2, 0.125])
		holes.transform(angle = '%big4.startAngle - %endAngle + 180')
		holes.transform(distance = 'subtractVectors (%big4.startPoint , %endPoint )')
		spiral = Spiral({
			'rotationAngle' : 0,
			'centerPoint' : (0, 0),
			'scaleFactor' : 0.8,
			'growthFactorAdjustment' : 0.5,
			'sweepAngleSpan' : 650,
			'reverse' : False,
			'id' : 'spiral3'
		})
		holes = makeHoleChain(ShapeGroup('group', spiral), False, [0.125, 0.125,0.3,  0.2, 0.125])
		holes.transform(angle = '%big3.startAngle - %endAngle + 180')
		holes.transform(distance = 'subtractVectors (%big3.startPoint , %endPoint )')
		arcChain = ArcChain('arcChain', [{
			'rotationAngle' : -100,
			'centerPoint' : '%spiral3.centerPoint',
			'scaleFactor' : 0.8,
			'growthFactorAdjustment' : 0.5,
			'sweepAngleSpan' : 690,
			'reverse' : False
		},{
			'angleSpan' : 60,
			'radius' :15,
		}])
		makeHoleChain(arcChain, False, [0.125, 0.125, 0.3, 0.2])
		arcChain = ArcChain('arcChain', [{
			'rotationAngle' : -195,
			'centerPoint' : '%spiral4.centerPoint',
			'scaleFactor' : 1,
			'growthFactorAdjustment' : 0.5,
			'sweepAngleSpan' : 720,
			'reverse' : False
		},{
			'angleSpan' : 19,
			'radius' :30,
			'noDirectionAlternate' : True
		},{
			'angleSpan' : 35,
			'radius' :15,
			'noDirectionAlternate' : True
		},{
			'angleSpan' : 60,
			'radius' :15,
		}])
		makeHoleChain(arcChain, False,  [0.125, 0.2, 0.2])
		arcChain = ArcChain('arcChain', [{
			'rotationAngle' : -231,
			'centerPoint' : (16, 31),
			'scaleFactor' : 0.7,
			'growthFactorAdjustment' : 0.5,
			'sweepAngleSpan' : 725,
			'reverse' : False
		},{
			'angleSpan' : 32,
			'radius' :22,
			'noDirectionAlternate' : True
		},{
			'angleSpan' : 20,
			'radius' : 35,
			'noDirectionAlternate' : True
		},{
			'angleSpan' : 20,
			'radius' : 22,
			'noDirectionAlternate' : True
		},{
			'angleSpan' : 60,
			'radius' : 15,
		}])
		makeHoleChain(arcChain, 'topSpiral', [0.125, 0.2, 0.2])
		arcChain = ArcChain('arcChain', [{ #up from spiral
			'rotationAngle' : -60,
			'centerPoint' : '%topSpiral.arcChain.arc0.centerPoint',
			'scaleFactor' : 0.7,
			'growthFactorAdjustment' : 0.5,
			'sweepAngleSpan' : 790,
			'reverse' : False
		},{
			'angleSpan' : 62,
			'radius' :17,
			'noDirectionAlternate' : True
		},{
			'angleSpan' : 30,
			'radius' : 40,
			'noDirectionAlternate' : False
		}])
		makeHoleChain(arcChain)
		arcChain = ArcChain('arcChain', [{
			'startPoint' : (0.5, -2),
			'startAngle' : -16, 
			'angleSpan' : 25, 
			'radius' : 18,
			'reverse' : False,
		},{
			'angleSpan' : 49,
			'radius' :35,
		},{
			'angleSpan' : 97,
			'radius' : 8.7,
			# 'noDirectionAlternate' : True
		},{
			'angleSpan' : 25,
			'radius' : 50,
		}])
		makeHoleChain(arcChain, False, [0.2, 0.2, 0.3, 0.4])
		topShape.addSubShape(Line({'startPoint' : (0, 0), 'endPoint' : (33, 0)}))
		topShape.addSubShape(Line({'startPoint' : (33, 0), 'endPoint' : (33, 70)}))
		topShape.addSubShape(Line({'startPoint' : (33, 70), 'endPoint' : (0, 70)}))
		topShape.addSubShape(Line({'startPoint' : (0, 70), 'endPoint' : (0, 0)}))
		self.shapes.append(topShape)
		Design.build(self)