示例#1
0
	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
示例#2
0
	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
示例#3
0
文件: extrude.py 项目: folksjos/RepG
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)
示例#4
0
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 } }
示例#5
0
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}}
示例#6
0
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)
示例#7
0
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)
示例#8
0
	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))]
示例#9
0
 def getOutsetLoops(self, outerLoops, distance, convex):
     outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(
         outerLoops, distance)
     outsetLoops = getOuterLoops(outsetLoops)
     if convex:
         outsetLoops = [
             euclidean.getLoopConvex(
                 euclidean.getConcatenatedList(outsetLoops))
         ]
     return outsetLoops
示例#10
0
 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))]
示例#11
0
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)
示例#12
0
文件: lathe.py 项目: folksjos/RepG
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))
示例#14
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}
示例#15
0
文件: lathe.py 项目: Ademan/Cura
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)
示例#16
0
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))
示例#17
0
	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
示例#18
0
文件: skirt.py 项目: CNCBASHER/Cura
	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)
示例#19
0
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)
示例#20
0
	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
示例#21
0
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
示例#22
0
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)
示例#23
0
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
示例#24
0
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)
示例#25
0
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
示例#26
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 )
示例#27
0
    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
示例#28
0
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)
示例#29
0
    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)
示例#31
0
文件: skirt.py 项目: jedahan/Cura
 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)
示例#32
0
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)
示例#33
0
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)
示例#34
0
def getVerticesByKey(key, xmlElement):
    "Get the vertices by key."
    return euclidean.getConcatenatedList(
        evaluate.getPathsByKey(key, xmlElement))
示例#35
0
def getVerticesByKey( key, xmlElement ):
	"Get the vertices by key."
	return euclidean.getConcatenatedList( evaluate.getPathsByKey( key, xmlElement ) )
示例#36
0
def getVertexesByKey(key, xmlElement):
	"Get the vertexes by key."
	return euclidean.getConcatenatedList(evaluate.getTransformedPathsByKey([], key, xmlElement))
示例#37
0
def getVertexesByKey(key, xmlElement):
    "Get the vertexes by key."
    return euclidean.getConcatenatedList(
        evaluate.getTransformedPathsByKey([], key, xmlElement))