Ejemplo n.º 1
0
    def __init__(self, z, index, runtimeParameters):
        self.z = z
        self.index = index
        self.runtimeParameters = runtimeParameters
        self.bridgeRotation = None
        self.nestedRings = []
        self.preLayerGcodeCommands = []
        self.postLayerGcodeCommands = []
        self.feedAndFlowRateMultiplier = [1.0, 1.0]

        self.preSupportGcodeCommands = []
        self.postSupportGcodeCommands = []
        self.supportPaths = []

        if runtimeParameters.profileMemory:
            memory_tracker.track_object(self)

        if self.runtimeParameters.dimensionActive:
            if self.runtimeParameters.extrusionUnitsRelative:
                self.preLayerGcodeCommands.append(
                    GcodeCommand(gcodes.RELATIVE_EXTRUSION_DISTANCE))
            else:
                self.preLayerGcodeCommands.append(
                    GcodeCommand(gcodes.ABSOLUTE_EXTRUSION_DISTANCE))

        self.combSkein = None
Ejemplo n.º 2
0
def performAction(slicedModel):
    "Export a slicedModel linear move text."
    e = ExportSkein(slicedModel)
    if slicedModel.runtimeParameters.profileMemory:
        memory_tracker.track_object(e)
    e.export()
    if slicedModel.runtimeParameters.profileMemory:
        memory_tracker.create_snapshot("After export")
Ejemplo n.º 3
0
def performAction(slicedModel):
    'Export a slicedModel linear move text.'
    e = ExportSkein(slicedModel)
    if slicedModel.runtimeParameters.profileMemory:
        memory_tracker.track_object(e)
    e.export()
    if slicedModel.runtimeParameters.profileMemory:
        memory_tracker.create_snapshot("After export")
Ejemplo n.º 4
0
def performAction(slicedModel):
    "Inset the slicedModel."

    i = InsetSkein(slicedModel)
    if slicedModel.runtimeParameters.profileMemory:
        memory_tracker.track_object(i)
    i.inset()

    if slicedModel.runtimeParameters.profileMemory:
        memory_tracker.create_snapshot("After inset")
Ejemplo n.º 5
0
def performAction(slicedModel):
    "Inset the slicedModel."

    i = InsetSkein(slicedModel)
    if slicedModel.runtimeParameters.profileMemory:
        memory_tracker.track_object(i)
    i.inset()

    if slicedModel.runtimeParameters.profileMemory:
        memory_tracker.create_snapshot("After inset")
Ejemplo n.º 6
0
def performAction(slicedModel):
    'Fills the perimeters.'
    if not config.getboolean(name, 'active'):
        logger.info("%s plugin is inactive", name.capitalize())
        return

    f = FillSkein(slicedModel)
    if slicedModel.runtimeParameters.profileMemory:
        memory_tracker.track_object(f)
    f.fill()
    if slicedModel.runtimeParameters.profileMemory:
        memory_tracker.create_snapshot("After fill")
Ejemplo n.º 7
0
def performAction(slicedModel):
    'Fills the perimeters.'
    if not config.getboolean(name, 'active'):
        logger.info("%s plugin is inactive", name.capitalize())
        return

    f = FillSkein(slicedModel)
    if slicedModel.runtimeParameters.profileMemory:
        memory_tracker.track_object(f)
    f.fill()
    if slicedModel.runtimeParameters.profileMemory:
        memory_tracker.create_snapshot("After fill")
Ejemplo n.º 8
0
    def __init__(self, z, runtimeParameters):

        if runtimeParameters.profileMemory:
            memory_tracker.track_object(self)

        self.runtimeParameters = runtimeParameters
        self.decimalPlaces = self.runtimeParameters.decimalPlaces
        self.z = z

        self.perimeter = None
        self.loops = []
        self.infillPaths = []

        self.innerNestedRings = []

        # can the following be removed? only used whilst generating the infill?
        self.infillPathsHolder = []
        self.extraLoops = []
        self.penultimateFillLoops = []
        self.lastFillLoops = None
        ###

        self.bridgeFeedRateMinute = self.runtimeParameters.bridgeFeedRateMinute
        self.perimeterFeedRateMinute = self.runtimeParameters.perimeterFeedRateMinute
        self.extrusionFeedRateMinute = self.runtimeParameters.extrusionFeedRateMinute
        self.travelFeedRateMinute = self.runtimeParameters.travelFeedRateMinute
        self.extrusionUnitsRelative = self.runtimeParameters.extrusionUnitsRelative

        self.oozeRate = self.runtimeParameters.oozeRate
        self.zDistanceRatio = 5.0
        self.extruderRetractionSpeedMinute = round(
            60.0 * self.runtimeParameters.extruderRetractionSpeed, self.decimalPlaces
        )

        self.layerThickness = self.runtimeParameters.layerThickness
        self.perimeterWidth = self.runtimeParameters.perimeterWidth
        self.filamentDiameter = self.runtimeParameters.filamentDiameter
        self.filamentPackingDensity = self.runtimeParameters.filamentPackingDensity
        self.absolutePositioning = config.getboolean("preface", "positioning.absolute")
        self.flowRate = self.runtimeParameters.flowRate
        self.perimeterFlowRate = self.runtimeParameters.perimeterFlowRate
        self.bridgeFlowRate = self.runtimeParameters.bridgeFlowRate
        self.previousPoint = None
        filamentRadius = 0.5 * self.filamentDiameter
        filamentPackingArea = pi * filamentRadius * filamentRadius * self.filamentPackingDensity
        extrusionArea = pi * self.layerThickness ** 2 / 4 + self.layerThickness * (
            self.perimeterWidth - self.layerThickness
        )
        # http://hydraraptor.blogspot.sk/2011/03/spot-on-flow-rate.html
        self.flowScaleSixty = 60.0 * extrusionArea / filamentPackingArea
Ejemplo n.º 9
0
    def __init__(self, runtimeParameters, z = 0):

        if runtimeParameters.profileMemory:
            memory_tracker.track_object(self)

        self.runtimeParameters = runtimeParameters
        self.decimalPlaces = self.runtimeParameters.decimalPlaces
        self.z = z

        self.perimeter = None
        self.loops = []
        self.infillPaths = []

        self.innerNestedRings = []

        # can the following be removed? only used whilst generating the infill?
        self.infillPathsHolder = []
        self.extraLoops = []
        self.penultimateFillLoops = []
        self.lastFillLoops = None
        ###

        self.bridgeFeedRateMinute = self.runtimeParameters.bridgeFeedRateMinute
        self.perimeterFeedRateMinute = self.runtimeParameters.perimeterFeedRateMinute
        self.extrusionFeedRateMinute = self.runtimeParameters.extrusionFeedRateMinute
        self.travelFeedRateMinute = self.runtimeParameters.travelFeedRateMinute

        self.zDistanceRatio = 5.0

        self.layerThickness = self.runtimeParameters.layerThickness
        self.perimeterWidth = self.runtimeParameters.perimeterWidth
        self.absolutePositioning = config.getboolean('preface', 'positioning.absolute')
        self.flowRate = self.runtimeParameters.flowRate
        self.perimeterFlowRate = self.runtimeParameters.perimeterFlowRate
        self.bridgeFlowRate = self.runtimeParameters.bridgeFlowRate
        self.previousPoint = None
Ejemplo n.º 10
0
 def __init__(self, z, index, runtimeParameters):
     self.z = z
     self.index = index
     self.runtimeParameters = runtimeParameters
     self.bridgeRotation = None
     self.nestedRings = []
     self.preLayerGcodeCommands = []
     self.postLayerGcodeCommands = []
     self.feedAndFlowRateMultiplier = [1.0, 1.0]
     
     self.preSupportGcodeCommands = []
     self.postSupportGcodeCommands = []
     self.supportPaths = []
     
     if runtimeParameters.profileMemory:
         memory_tracker.track_object(self)
     
     if self.runtimeParameters.dimensionActive:
         if self.runtimeParameters.extrusionUnitsRelative:
             self.preLayerGcodeCommands.append(GcodeCommand(gcodes.RELATIVE_EXTRUSION_DISTANCE))
         else:
             self.preLayerGcodeCommands.append(GcodeCommand(gcodes.ABSOLUTE_EXTRUSION_DISTANCE))
     
     self.combSkein = None
def main(argv=None):
    "Starting point for skeinforge engine."
    parser = argparse.ArgumentParser(description='Skeins a 3D model into slicedModel.')
    parser.add_argument('file', help='The file to skein. Files accepted: stl, obj, gts, and svg. Or sliced model files produced by SkeinforgeEngine.')
    parser.add_argument('-c', metavar='config', help='Configuration for skeinforge engine.', default='skeinforge_engine.cfg')
    parser.add_argument('-p', metavar='profile', help='Profile for the skeining.')
    parser.add_argument('-o', metavar='output', help='Output filename. Overrides other export filename settings.')
    parser.add_argument('-r', metavar='reprocess', help='Comma seperated list of plugins to reprocess a sliced model file. The export plugin is automatically appended.')

    
    if argv is None: 
    	argv = sys.argv[1:]
    args = parser.parse_args(argv)
    
    if args.c == None:
    	logger.error('Invalid or missing configuration file.')
    	return
    config.read(args.c)
    
    logLevel = config.get('general', 'log.level')
    logging.basicConfig(level=logLevel, format='%(asctime)s %(levelname)s (%(name)s) %(message)s')
    	
    defaultProfile = config.get('general', 'default.profile')
    if defaultProfile != None:
    	config.read(defaultProfile)
    profileName = config.get('profile', 'name')
    
    if args.p != None:
    	config.read(args.p)
        if profileName == 'default':
            profileName = os.path.splitext(os.path.basename(args.p))[0]
    
    logger.info("Profile: %s", profileName)
        
    inputFilename = args.file
    
    if not os.path.isfile(inputFilename):
    	logger.error('File not found: %s', inputFilename)
    	return
 
    logger.info("Processing file: %s", os.path.basename(inputFilename))
    
    exportedSlicedModelExtension = config.get('export', 'export.slicedmodel.extension')
    if inputFilename.endswith(exportedSlicedModelExtension):
        slicedModel = pickle.load(open(inputFilename))
        slicedModel.runtimeParameters = RuntimeParameters()
        inputFilename = inputFilename.replace('.'+exportedSlicedModelExtension, '')
    else:
    	slicedModel = SlicedModel()
    
    if args.o != None:
        slicedModel.runtimeParameters.outputFilename = args.o
    
    if args.r != None:
    	pluginSequence = args.r.split(',')
    	if 'export' not in pluginSequence:
    		pluginSequence.append('export')
    else:
    	pluginSequence = config.get('general', 'plugin.sequence').split(',')
    
    if inputFilename.endswith(exportedSlicedModelExtension) and 'carve' in pluginSequence:
        logger.error('Reprocessing a sliced model file with carve is not possible. Please process the original file or choose a different reprocessing sequence.')
        return
    
    logger.debug("Plugin Sequence: %s", pluginSequence)
    
    if slicedModel.runtimeParameters.profileMemory:
    	memory_tracker.track_object(slicedModel)
    	memory_tracker.create_snapshot('Start')
    
    slicedModel.runtimeParameters.profileName = profileName
    slicedModel.runtimeParameters.inputFilename = inputFilename
    
    getCraftedTextFromPlugins(pluginSequence[:], slicedModel)
    
    slicedModel.runtimeParameters.endTime = time.time()
    
    logger.info('It took %s seconds to complete.', timedelta(seconds=slicedModel.runtimeParameters.endTime - slicedModel.runtimeParameters.startTime).total_seconds())
    
    if slicedModel.runtimeParameters.profileMemory:
    	memory_tracker.create_snapshot('End')
    	if config.getboolean('general', 'profile.memory.print.summary'):
    		memory_tracker.tracker.stats.print_summary()
    	if config.getboolean('general', 'profile.memory.export.data'):
    		memory_tracker.tracker.stats.dump_stats('%s.memory_tracker.dat' % inputFilename)
    	if config.getboolean('general', 'profile.memory.export.html'):
    		from pympler.classtracker_stats import HtmlStats
    		HtmlStats(tracker=memory_tracker.tracker).create_html('%s.memory_tracker.html' % inputFilename)
            
    return slicedModel