示例#1
0
文件: group.py 项目: folksjos/RepG
	def getLoops(self, importRadius, z):
		"Get loops sliced through shape."
		visibleObjects = evaluate.getVisibleObjects(self.archivableObjects)
		loops = []
		for visibleObject in visibleObjects:
			loops += visibleObject.getLoops(importRadius, z)
		return loops
示例#2
0
	def getLoops(self, importRadius, z):
		"Get loops sliced through shape."
		visibleObjects = evaluate.getVisibleObjects(self.archivableObjects)
		loops = []
		for visibleObject in visibleObjects:
			loops += visibleObject.getLoops(importRadius, z)
		return loops
示例#3
0
	def getCarveRotatedBoundaryLayers(self):
		"Get the rotated boundary layers."
		vertexes = []
		for visibleObject in evaluate.getVisibleObjects(self.archivableObjects):
			vertexes += visibleObject.getTransformedVertexes()
		if len(vertexes) < 1:
			return []
		self.cornerMaximum = Vector3(-999999999.0, - 999999999.0, - 9999999999.9)
		self.cornerMinimum = Vector3(999999999.0, 999999999.0, 9999999999.9)
		for vertex in vertexes:
			self.cornerMaximum.z = max(self.cornerMaximum.z, vertex.z)
			self.cornerMinimum.z = min(self.cornerMinimum.z, vertex.z)
		trianglemesh.initializeZoneIntervalTable(self, vertexes)
		halfHeight = 0.5 * self.layerThickness
		self.setActualMinimumZ(halfHeight)
		z = self.cornerMinimum.z + halfHeight
		while z < self.cornerMaximum.z:
			z = self.getZAddExtruderPaths(z)
		for rotatedBoundaryLayer in self.rotatedBoundaryLayers:
			for loop in rotatedBoundaryLayer.loops:
				for point in loop:
					pointVector3 = Vector3(point.real, point.imag, rotatedBoundaryLayer.z)
					self.cornerMaximum = euclidean.getPointMaximum(self.cornerMaximum, pointVector3)
					self.cornerMinimum = euclidean.getPointMinimum(self.cornerMinimum, pointVector3)
		for rotatedBoundaryLayerIndex in xrange(len(self.rotatedBoundaryLayers) -1, -1, -1):
			rotatedBoundaryLayer = self.rotatedBoundaryLayers[rotatedBoundaryLayerIndex]
			if len(rotatedBoundaryLayer.loops) > 0:
				return self.rotatedBoundaryLayers[: rotatedBoundaryLayerIndex + 1]
		return []
示例#4
0
	def getCarveRotatedBoundaryLayers(self):
		'Get the rotated boundary layers.'
		vertexes = []
		for visibleObject in evaluate.getVisibleObjects(self.archivableObjects):
			vertexes += visibleObject.getTransformedVertexes()
		if len(vertexes) < 1:
			return []
		self.maximumZ = -912345678.0
		self.minimumZ = 912345678.0
		for vertex in vertexes:
			self.maximumZ = max(self.maximumZ, vertex.z)
			self.minimumZ = min(self.minimumZ, vertex.z)
		triangle_mesh.initializeZoneIntervalTable(self, vertexes)
		halfHeight = 0.5 * self.layerThickness
		self.setActualMinimumZ(halfHeight)
		z = self.minimumZ + halfHeight
		while z < self.maximumZ:
			z = self.getZAddExtruderPaths(z)
		self.cornerMaximum = Vector3(-912345678.0, -912345678.0, -912345678.0)
		self.cornerMinimum = Vector3(912345678.0, 912345678.0, 912345678.0)
		for rotatedLoopLayer in self.rotatedLoopLayers:
			for loop in rotatedLoopLayer.loops:
				for point in loop:
					pointVector3 = Vector3(point.real, point.imag, rotatedLoopLayer.z)
					self.cornerMaximum.maximize(pointVector3)
					self.cornerMinimum.minimize(pointVector3)
		self.cornerMaximum.z += halfHeight
		self.cornerMinimum.z -= halfHeight
		for rotatedLoopLayerIndex in xrange(len(self.rotatedLoopLayers) -1, -1, -1):
			rotatedLoopLayer = self.rotatedLoopLayers[rotatedLoopLayerIndex]
			if len(rotatedLoopLayer.loops) > 0:
				return self.rotatedLoopLayers[: rotatedLoopLayerIndex + 1]
		return []
示例#5
0
	def getLoops(self, importRadius, z):
		"Get loops sliced through shape."
		visibleObjects = evaluate.getVisibleObjects(self.archivableObjects)
		if len( visibleObjects ) < 1:
			return []
		visibleObjectLoopsList = getVisibleObjectLoopsList( importRadius, visibleObjects, z )
		loops = self.getLoopsFromObjectLoopsList( importRadius, visibleObjectLoopsList )
		return euclidean.getSimplifiedLoops( loops, importRadius )
示例#6
0
	def getLoops(self, importRadius, z):
		'Get loops sliced through shape.'
		visibleObjects = evaluate.getVisibleObjects(self.archivableObjects)
		if len( visibleObjects ) < 1:
			return []
		visibleObjectLoopsList = getVisibleObjectLoopsList( importRadius, visibleObjects, z )
		loops = self.getLoopsFromObjectLoopsList(importRadius, visibleObjectLoopsList)
		return euclidean.getSimplifiedLoops( loops, importRadius )
示例#7
0
 def getGeometryOutput(self):
     'Get geometry output dictionary.'
     visibleObjects = evaluate.getVisibleObjects(self.archivableObjects)
     shapeOutput = []
     for visibleObject in visibleObjects:
         visibleObjectOutput = visibleObject.getGeometryOutput()
         if visibleObjectOutput != None:
             shapeOutput.append(visibleObjectOutput)
     if len(shapeOutput) < 1:
         return None
     return {self.getXMLLocalName() : {'shapes' : shapeOutput}}
示例#8
0
	def getGeometryOutput(self):
		'Get geometry output dictionary.'
		visibleObjects = evaluate.getVisibleObjects(self.archivableObjects)
		shapeOutput = []
		for visibleObject in visibleObjects:
			visibleObjectOutput = visibleObject.getGeometryOutput()
			if visibleObjectOutput != None:
				shapeOutput.append(visibleObjectOutput)
		if len(shapeOutput) < 1:
			return None
		return {self.getXMLClassName() : {'shapes' : shapeOutput}}
示例#9
0
 def getGeometryOutput(self):
     'Get geometry output dictionary.'
     shapeOutput = []
     for visibleObject in evaluate.getVisibleObjects(
             self.archivableObjects):
         geometryOutput = visibleObject.getGeometryOutput()
         if geometryOutput != None:
             visibleObject.transformGeometryOutput(geometryOutput)
             shapeOutput.append(geometryOutput)
     if len(shapeOutput) < 1:
         return None
     return {self.getXMLLocalName(): {'shapes': shapeOutput}}
示例#10
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
示例#11
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
示例#12
0
	def getMinimumZ(self):
		'Get the minimum z.'
		vertexes = []
		for visibleObject in evaluate.getVisibleObjects(self.archivableObjects):
			vertexes += visibleObject.getTransformedVertexes()
		if len(vertexes) < 1:
			return None
		self.maximumZ = -912345678.0
		self.minimumZ = 912345678.0
		for vertex in vertexes:
			self.maximumZ = max(self.maximumZ, vertex.z)
			self.minimumZ = min(self.minimumZ, vertex.z)
		self.zoneArrangement = triangle_mesh.ZoneArrangement(self.layerHeight, vertexes)
		self.halfHeight = 0.5 * self.layerHeight
		self.setActualMinimumZ()
		return self.minimumZ
示例#13
0
	def getMinimumZ(self):
		'Get the minimum z.'
		vertexes = []
		for visibleObject in evaluate.getVisibleObjects(self.archivableObjects):
			vertexes += visibleObject.getTransformedVertexes()
		if len(vertexes) < 1:
			return None
		self.maximumZ = -912345678.0
		self.minimumZ = 912345678.0
		for vertex in vertexes:
			self.maximumZ = max(self.maximumZ, vertex.z)
			self.minimumZ = min(self.minimumZ, vertex.z)
		self.zoneArrangement = triangle_mesh.ZoneArrangement(self.layerHeight, vertexes)
		self.halfHeight = 0.5 * self.layerHeight
		self.setActualMinimumZ()
		return self.minimumZ
 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
示例#15
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