def createSkirtLoops(self): 'Create the skirt loops.' points = euclidean.getPointsByHorizontalDictionary(self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.edgeWidth) outerLoops = getOuterLoops(loops) outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(outerLoops, -self.skirtOutset-self.edgeWidth*(self.repository.brimWidth.value+1)) self.outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: self.outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(self.outsetLoops))] self.outsetBrimLoops = [] for self.brimLine in xrange( self.repository.brimWidth.value-1, self.brimLine, -1 ): points = euclidean.getPointsByHorizontalDictionary(self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.edgeWidth) outerLoops = getOuterLoops(loops) outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(outerLoops, -self.edgeWidth*(self.brimLine+0.5)) outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(outsetLoops))] self.outsetBrimLoops += outsetLoops if self.repository.brimWidth.value > 0: points = euclidean.getPointsByHorizontalDictionary(self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.edgeWidth) outerLoops = getOuterLoops(loops) outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(outerLoops, -self.edgeWidth*0.5) outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(outsetLoops))] self.outsetBrimLoops += outsetLoops
def createSkirtLoops(self): 'Create the skirt loops.' points = euclidean.getPointsByHorizontalDictionary(self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.edgeWidth) outerLoops = getOuterLoops(loops) outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(outerLoops, -self.skirtOutset-self.edgeWidth*(self.repository.brimWidth.value+1)) self.outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: self.outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(self.outsetLoops))] if self.repository.brimWidth.value > 0: points = euclidean.getPointsByHorizontalDictionary(self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.edgeWidth) outerLoops = getOuterLoops(loops) outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(outerLoops, -self.edgeWidth*0.5) outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(outsetLoops))] self.outsetBrimLoops = outsetLoops for self.brimLine in xrange(self.brimLine+1,self.repository.brimWidth.value): points = euclidean.getPointsByHorizontalDictionary(self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.edgeWidth) outerLoops = getOuterLoops(loops) outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(outerLoops, -self.edgeWidth*(self.brimLine+0.5)) outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(outsetLoops))] self.outsetBrimLoops += outsetLoops
def getGeometryOutput(derivation, xmlElement): "Get triangle mesh from attribute dictionary." if derivation == None: derivation = ExtrudeDerivation() derivation.setToXMLElement(xmlElement) if derivation.radius != complex(): maximumRadius = max(derivation.radius.real, derivation.radius.imag) sides = int( math.ceil( evaluate.getSidesMinimumThreeBasedOnPrecisionSides( maximumRadius, xmlElement))) loop = [] sideAngle = 2.0 * math.pi / sides angleTotal = 0.0 for side in xrange(sides): point = euclidean.getWiddershinsUnitPolar(angleTotal) loop.append( Vector3(point.real * derivation.radius.real, point.imag * derivation.radius.imag)) angleTotal += sideAngle derivation.target = [loop] + derivation.target if len(euclidean.getConcatenatedList(derivation.target)) == 0: print('Warning, in extrude there are no paths.') print(xmlElement.attributeDictionary) return None negatives = [] positives = [] addNegativesPositives(derivation, negatives, derivation.target, positives) return getGeometryOutputByNegativesPositives(derivation, negatives, positives, xmlElement)
def getPillarOutput( loops ): "Get pillar output." faces = [] vertices = euclidean.getConcatenatedList( loops ) for vertexIndex in xrange( len( vertices ) ): vertices[ vertexIndex ].index = vertexIndex addPillarFromConvexLoops( faces, loops ) return { 'trianglemesh' : { 'vertex' : vertices, 'face' : faces } }
def getPillarOutput(loops): "Get pillar output." faces = [] vertexes = euclidean.getConcatenatedList(loops) for vertexIndex in xrange(len(vertexes)): vertexes[vertexIndex].index = vertexIndex addPillarByLoops(faces, loops) return {'trianglemesh': {'vertex': vertexes, 'face': faces}}
def getGeometryOutput(derivation, xmlElement): 'Get triangle mesh from attribute dictionary.' if derivation == None: derivation = ExtrudeDerivation(xmlElement) if len(euclidean.getConcatenatedList(derivation.target)) == 0: print('Warning, in extrude there are no paths.') print(xmlElement.attributeDictionary) return None return getGeometryOutputByLoops(derivation, derivation.target)
def createSkirtLoops(self): 'Create the skirt loops.' points = euclidean.getPointsByHorizontalDictionary(self.perimeterWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.perimeterWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.perimeterWidth) outerLoops = getOuterLoops(loops) outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(-self.skirtOutset, outerLoops) self.outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: self.outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(self.outsetLoops))]
def getOutsetLoops(self, outerLoops, distance, convex): outsetLoops = intercircle.getInsetSeparateLoopsFromLoops( outerLoops, distance) outsetLoops = getOuterLoops(outsetLoops) if convex: outsetLoops = [ euclidean.getLoopConvex( euclidean.getConcatenatedList(outsetLoops)) ] return outsetLoops
def createSkirtLoops(self): "Create the skirt loops." points = euclidean.getPointsByHorizontalDictionary(self.perimeterWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.perimeterWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.perimeterWidth) outerLoops = getOuterLoops(loops) outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(outerLoops, -self.skirtOutset) self.outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: self.outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(self.outsetLoops))]
def getGeometryOutput(derivation, xmlElement): "Get triangle mesh from attribute dictionary." if derivation == None: derivation = ConcatenateDerivation(xmlElement) concatenatedList = euclidean.getConcatenatedList(derivation.target)[:] if len(concatenatedList) == 0: print("Warning, in concatenate there are no paths.") print(xmlElement.attributeDictionary) return None if "closed" not in xmlElement.attributeDictionary: xmlElement.attributeDictionary["closed"] = "true" return lineation.getGeometryOutputByLoop(lineation.SideLoop(concatenatedList, None, None), xmlElement)
def getGeometryOutput(derivation, elementNode): "Get triangle mesh from attribute dictionary." if derivation == None: derivation = LatheDerivation(elementNode) if len(euclidean.getConcatenatedList(derivation.target)) == 0: print('Warning, in lathe there are no paths.') print(elementNode.attributes) return None negatives = [] positives = [] addNegativesPositives(derivation, negatives, derivation.target, positives) return getGeometryOutputByNegativesPositives(derivation, elementNode, negatives, positives)
def getGeometryOutput(derivation, elementNode): 'Get triangle mesh from attribute dictionary.' if derivation == None: derivation = ConcatenateDerivation(elementNode) concatenatedList = euclidean.getConcatenatedList(derivation.target)[:] if len(concatenatedList) == 0: print('Warning, in concatenate there are no paths.') print(elementNode.attributes) return None if 'closed' not in elementNode.attributes: elementNode.attributes['closed'] = 'true' return lineation.getGeometryOutputByLoop(elementNode, lineation.SideLoop(concatenatedList, None, None))
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}
def getGeometryOutput(derivation, elementNode): 'Get triangle mesh from attribute dictionary.' if derivation == None: derivation = ConcatenateDerivation(elementNode) concatenatedList = euclidean.getConcatenatedList(derivation.target)[:] if len(concatenatedList) == 0: print('Warning, in concatenate there are no paths.') print(elementNode.attributes) return None if 'closed' not in elementNode.attributes: elementNode.attributes['closed'] = 'true' return lineation.getGeometryOutputByLoop(elementNode, lineation.SideLoop(concatenatedList))
def getExtruderPaths( self, shouldPrintWarning, z ): "Get extruder loops." rotatedBoundaryLayer = euclidean.RotatedLoopLayer( z ) visibleObjectLoopsList = booleansolid.getVisibleObjectLoopsList( self.importRadius, evaluate.getVisibleObjects( self.archivableObjects ), z ) rotatedBoundaryLayer.loops = euclidean.getConcatenatedList( visibleObjectLoopsList ) if euclidean.isLoopListIntersecting( rotatedBoundaryLayer.loops, z ): rotatedBoundaryLayer.loops = booleansolid.getLoopsUnified( self.importRadius, visibleObjectLoopsList ) if shouldPrintWarning: print('Warning, the triangle mesh slice intersects itself.') print( "Something will still be printed, but there is no guarantee that it will be the correct shape." ) print('Once the gcode is saved, you should check over the layer with a z of:') print( z ) return rotatedBoundaryLayer
def createSkirtLoops(self): 'Create the skirt loops.' points = euclidean.getPointsByHorizontalDictionary(self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.edgeWidth) outerLoops = getOuterLoops(loops) self.outsetLoops = [] for i in xrange(self.repository.skirtLineCount.value, 0, -1): outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(outerLoops, -self.skirtOutset - i * self.edgeWidth) outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(outsetLoops))] self.outsetLoops.extend(outsetLoops)
def getGeometryOutput(derivation, xmlElement): 'Get triangle mesh from attribute dictionary.' if derivation == None: derivation = ConcatenateDerivation(xmlElement) concatenatedList = euclidean.getConcatenatedList(derivation.target)[:] if len(concatenatedList) == 0: print('Warning, in concatenate there are no paths.') print(xmlElement.attributeDictionary) return None if 'closed' not in xmlElement.attributeDictionary: xmlElement.attributeDictionary['closed'] = 'true' return lineation.getGeometryOutputByLoop( lineation.SideLoop(concatenatedList, None, None), xmlElement)
def getEmptyZExtruderPaths( self, shouldPrintWarning, z ): "Get extruder loops." z = trianglemesh.getEmptyZ(self, z) rotatedBoundaryLayer = euclidean.RotatedLoopLayer(z) visibleObjectLoopsList = booleansolid.getVisibleObjectLoopsList( self.importRadius, evaluate.getVisibleObjects(self.archivableObjects), z ) rotatedBoundaryLayer.loops = euclidean.getConcatenatedList( visibleObjectLoopsList ) if euclidean.isLoopListIntersecting(rotatedBoundaryLayer.loops): rotatedBoundaryLayer.loops = booleansolid.getLoopsUnified(self.importRadius, visibleObjectLoopsList) if shouldPrintWarning: print('Warning, the triangle mesh slice intersects itself in getExtruderPaths in boolean_geometry.') print( "Something will still be printed, but there is no guarantee that it will be the correct shape." ) print('Once the gcode is saved, you should check over the layer with a z of:') print(z) return rotatedBoundaryLayer
def getEmptyZLoops(archivableObjects, importRadius, shouldPrintWarning, z, zoneArrangement): 'Get loops at empty z level.' emptyZ = zoneArrangement.getEmptyZ(z) visibleObjects = evaluate.getVisibleObjects(archivableObjects) visibleObjectLoopsList = boolean_solid.getVisibleObjectLoopsList(importRadius, visibleObjects, emptyZ) loops = euclidean.getConcatenatedList(visibleObjectLoopsList) if euclidean.isLoopListIntersecting(loops): loops = boolean_solid.getLoopsUnion(importRadius, visibleObjectLoopsList) if shouldPrintWarning: print('Warning, the triangle mesh slice intersects itself in getExtruderPaths in boolean_geometry.') print('Something will still be printed, but there is no guarantee that it will be the correct shape.') print('Once the gcode is saved, you should check over the layer with a z of:') print(z) return loops
def getLoopsUnified( importRadius, loopLists ): "Get joined loops sliced through shape." allPoints = [] corners = getLoopsListsIntersections(loopLists) radiusSide = 0.01 * importRadius intercircle.directLoopLists( True, loopLists ) for loopListIndex in xrange( len(loopLists) ): insetLoops = loopLists[ loopListIndex ] inBetweenInsetLoops = getInBetweenLoopsFromLoops( importRadius, insetLoops ) otherLoops = euclidean.getConcatenatedList( loopLists[ : loopListIndex ] + loopLists[ loopListIndex + 1 : ] ) corners += getInsetPointsByInsetLoops( insetLoops, False, otherLoops, radiusSide ) allPoints += getInsetPointsByInsetLoops( inBetweenInsetLoops, False, otherLoops, radiusSide ) allPoints += corners[:] return trianglemesh.getDescendingAreaLoops(allPoints, corners, importRadius)
def getLoopsUnified(importRadius, loopLists): 'Get joined loops sliced through shape.' allPoints = [] corners = getLoopsListsIntersections(loopLists) radiusSide = 0.01 * importRadius radiusSideNegative = -radiusSide intercircle.directLoopLists(True, loopLists) for loopListIndex in xrange(len(loopLists)): insetLoops = loopLists[ loopListIndex ] inBetweenInsetLoops = getInBetweenLoopsFromLoops(insetLoops, importRadius) otherLoops = euclidean.getConcatenatedList(loopLists[: loopListIndex] + loopLists[loopListIndex + 1 :]) corners += getInsetPointsByInsetLoops(insetLoops, False, otherLoops, radiusSide) allPoints += getInsetPointsByInsetLoops(inBetweenInsetLoops, False, otherLoops, radiusSideNegative) allPoints += corners[:] return triangle_mesh.getDescendingAreaLoops(allPoints, corners, importRadius)
def getGeometryOutput(elementNode): 'Get vector3 vertexes from attribute dictionary.' derivation = VoronoiDerivation(elementNode) complexPath = euclidean.getConcatenatedList(euclidean.getComplexPaths(derivation.target)) geometryOutput = [] topRight = derivation.inradius squareLoop = euclidean.getSquareLoopWiddershins(-topRight, topRight) loopComplexes = [] for pointIndex, point in enumerate(complexPath): outsides = complexPath[: pointIndex] + complexPath[pointIndex + 1 :] loopComplex = getVoronoiLoopByPoints(point, squareLoop, outsides) loopComplex = intercircle.getLargestInsetLoopFromLoop(loopComplex, derivation.radius) loopComplexes.append(loopComplex) elementNode.attributes['closed'] = 'true' for loopComplex in loopComplexes: vector3Path = euclidean.getVector3Path(loopComplex) geometryOutput += lineation.SideLoop(vector3Path).getManipulationPluginLoops(elementNode) return geometryOutput
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 )
def createSkirtLoops(self, gap, shellCount): "Create the skirt loops." outset = gap + self.edgeWidth points = euclidean.getPointsByHorizontalDictionary(self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.edgeWidth) outerLoops = self.getOuterLoops(loops) skirtLoops = [] for shellNo in xrange(shellCount): outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(-(outset + self.edgeWidth * shellNo), outerLoops) outsetLoops = self.getOuterLoops(outsetLoops) if self.convex: outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(outsetLoops))] for outsetLoop in outsetLoops: skirtLoops.append(outsetLoop + [outsetLoop[0]]) return skirtLoops
def getLoopsUnified(importRadius, loopLists): "Get joined loops sliced through shape." allPoints = [] corners = getLoopsListsIntersections(loopLists) radiusSide = 0.01 * importRadius directLoopLists(True, loopLists) for loopListIndex in xrange(len(loopLists)): insetLoops = loopLists[loopListIndex] inBetweenInsetLoops = getInBetweenLoopsFromLoops( importRadius, insetLoops) otherLoops = euclidean.getConcatenatedList(loopLists[:loopListIndex] + loopLists[loopListIndex + 1:]) corners += getInsetPointsByInsetLoops(insetLoops, False, otherLoops, radiusSide) allPoints += getInsetPointsByInsetLoops(inBetweenInsetLoops, False, otherLoops, radiusSide) allPoints += corners[:] return trianglemesh.getInclusiveLoops(allPoints, corners, importRadius, True)
def createSkirtLoops(self, gap, shellCount): 'Create the skirt loops.' outset = gap + self.edgeWidth points = euclidean.getPointsByHorizontalDictionary(self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.edgeWidth) outerLoops = self.getOuterLoops(loops) skirtLoops = [] for shellNo in xrange(shellCount): outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(-(outset + self.edgeWidth * shellNo), outerLoops) outsetLoops = self.getOuterLoops(outsetLoops) if self.convex: outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(outsetLoops))] for outsetLoop in outsetLoops: skirtLoops.append(outsetLoop + [outsetLoop[0]]) return skirtLoops
def getGeometryOutput(derivation, xmlElement): 'Get triangle mesh from attribute dictionary.' if derivation == None: derivation = ExtrudeDerivation(xmlElement) if derivation.radius != complex(): maximumRadius = max(derivation.radius.real, derivation.radius.imag) sides = int(math.ceil(evaluate.getSidesMinimumThreeBasedOnPrecisionSides(maximumRadius, xmlElement))) loop = [] sideAngle = 2.0 * math.pi / sides angleTotal = 0.0 for side in xrange(sides): point = euclidean.getWiddershinsUnitPolar(angleTotal) loop.append(Vector3(point.real * derivation.radius.real, point.imag * derivation.radius.imag)) angleTotal += sideAngle derivation.target = [loop] + derivation.target if len(euclidean.getConcatenatedList(derivation.target)) == 0: print('Warning, in extrude there are no paths.') print(xmlElement.attributeDictionary) return None return getGeometryOutputByLoops(derivation, derivation.target)
def createSkirtLoops(self): 'Create the skirt loops.' points = euclidean.getPointsByHorizontalDictionary( self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary( self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops( points, points, 2.5 * self.edgeWidth) outerLoops = getOuterLoops(loops) self.outsetLoops = [] for i in xrange(self.repository.skirtLineCount.value, 0, -1): outsetLoops = intercircle.getInsetSeparateLoopsFromLoops( outerLoops, -self.skirtOutset - (i - 1) * self.edgeWidth) outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: outsetLoops = [ euclidean.getLoopConvex( euclidean.getConcatenatedList(outsetLoops)) ] self.outsetLoops.extend(outsetLoops)
def getGeometryOutput(xmlElement): "Get triangle mesh from attribute dictionary." paths = evaluate.getTransformedPathsByKey('target', xmlElement) radius = lineation.getRadiusComplex(complex(), xmlElement) if radius != complex(): sides = int(math.ceil(evaluate.getSidesMinimumThreeBasedOnPrecisionSides(max(radius.real, radius.imag), xmlElement))) loop = [] sideAngle = 2.0 * math.pi / sides angleTotal = 0.0 for side in xrange(sides): point = euclidean.getWiddershinsUnitPolar(angleTotal) loop.append(Vector3(point.real * radius.real, point.imag * radius.imag)) angleTotal += sideAngle paths = [loop] + paths if len(euclidean.getConcatenatedList(paths)) == 0: print('Warning, in extrude there are no paths.') print(xmlElement.attributeDictionary) return None extrudeDerivation = ExtrudeDerivation() extrudeDerivation.setToXMLElement(xmlElement) return getGeometryOutputByExtrudePaths(extrudeDerivation, paths, xmlElement)
def getVerticesByKey(key, xmlElement): "Get the vertices by key." return euclidean.getConcatenatedList( evaluate.getPathsByKey(key, xmlElement))
def getVerticesByKey( key, xmlElement ): "Get the vertices by key." return euclidean.getConcatenatedList( evaluate.getPathsByKey( key, xmlElement ) )
def getVertexesByKey(key, xmlElement): "Get the vertexes by key." return euclidean.getConcatenatedList(evaluate.getTransformedPathsByKey([], key, xmlElement))
def getVertexesByKey(key, xmlElement): "Get the vertexes by key." return euclidean.getConcatenatedList( evaluate.getTransformedPathsByKey([], key, xmlElement))