Esempio n. 1
0
    def build_from_port(self, portname, leaveOpen=True):
        """
        Returns a tuple of an (s3gObj, ProfileObj)
        for a machine at port portname
        """
        machineInquisitor = self.create_inquisitor(portname)
        s3gBot, machine_setup_dict = machineInquisitor.query(leaveOpen)

        profile_regex = self.get_profile_regex(machine_setup_dict)
        matches = makerbot_driver.search_profiles_with_regex(profile_regex, self.profile_dir)
        matches = list(matches)
        return_object = ReturnObject
        attrs = ["s3g", "profile", "gcodeparser"]
        for a in attrs:
            setattr(return_object, a, None)
        if len(matches) > 0:
            bestProfile = matches[0]
            setattr(return_object, "s3g", s3gBot)
            profile = makerbot_driver.Profile(bestProfile, self.profile_dir)
            profile.values["print_to_file_type"] = [machine_setup_dict["print_to_file_type"]]
            setattr(return_object, "profile", profile)
            parser = makerbot_driver.Gcode.GcodeParser()
            parser.s3g = s3gBot
            parser.state.profile = getattr(return_object, "profile")
            setattr(return_object, "gcodeparser", parser)
        return return_object
Esempio n. 2
0
    def build_from_port(self, portname, leaveOpen=True, condition=None):
        """
        Returns a tuple of an (s3gObj, ProfileObj)
        for a machine at port portname
        """
        machineInquisitor = self.create_inquisitor(portname)
        if None is condition:
            condition = threading.Condition()
        s3gBot, machine_setup_dict = machineInquisitor.query(condition, leaveOpen)

        profile_regex = self.get_profile_regex(machine_setup_dict)
        matches = makerbot_driver.search_profiles_with_regex(
            profile_regex, self.profile_dir)
        matches = list(matches)
        return_object = ReturnObject()
        attrs = ['s3g', 'profile', 'gcodeparser']
        for a in attrs:
            setattr(return_object, a, None)
        if len(matches) > 0:
            bestProfile = matches[0]
            setattr(return_object, 's3g', s3gBot)
            profile = makerbot_driver.Profile(bestProfile, self.profile_dir)
            profile.values['print_to_file_type']=[machine_setup_dict['print_to_file_type']]
            profile.values['software_variant'] = machine_setup_dict['software_variant']
            setattr(return_object, 'profile', profile)
            parser = makerbot_driver.Gcode.GcodeParser()
            parser.s3g = s3gBot
            parser.state.profile = getattr(return_object, 'profile')
            setattr(return_object, 'gcodeparser', parser)
        return return_object
Esempio n. 3
0
    def build_from_port(self, portname, leaveOpen=True):
        """
        Returns a tuple of an (s3gObj, ProfileObj)
        for a bot at port portname
        """
        machineInquisitor = self.create_inquisitor(portname)
        s3gBot, bot_setup_dict = machineInquisitor.query(leaveOpen)

        profile_regex = self.get_profile_regex(bot_setup_dict)
        matches = makerbot_driver.search_profiles_with_regex(
            profile_regex, self.profile_dir)
        matches = list(matches)
        return_object = ReturnObject
        attrs = ['s3g', 'profile', 'gcodeparser']
        for a in attrs:
            setattr(return_object, a, None)
        if len(matches) > 0:
            bestProfile = matches[0]
            setattr(return_object, 's3g', s3gBot)
            setattr(return_object, 'profile',
                    makerbot_driver.Profile(bestProfile, self.profile_dir))
            parser = makerbot_driver.Gcode.GcodeParser()
            parser.s3g = s3gBot
            parser.state.profile = getattr(return_object, 'profile')
            setattr(return_object, 'gcodeparser', parser)
        return return_object
Esempio n. 4
0
    def build_from_port(self, portname, leaveOpen=True):
        """
        Returns a tuple of an (s3gObj, ProfileObj)
        for a bot at port portname
        """
        machineInquisitor = self.create_inquisitor(portname)
        s3gBot, bot_setup_dict = machineInquisitor.query(leaveOpen)

        profile_regex = self.get_profile_regex(bot_setup_dict)
        matches = makerbot_driver.search_profiles_with_regex(
            profile_regex, self.profile_dir)
        matches = list(matches)
        return_object = ReturnObject
        attrs = ['s3g', 'profile', 'gcodeparser']
        for a in attrs:
            setattr(return_object, a, None)
        if len(matches) > 0:
            bestProfile = matches[0]
            setattr(return_object, 's3g', s3gBot)
            setattr(return_object, 'profile',
                    makerbot_driver.Profile(bestProfile, self.profile_dir))
            parser = makerbot_driver.Gcode.GcodeParser()
            parser.s3g = s3gBot
            parser.state.profile = getattr(return_object, 'profile')
            setattr(return_object, 'gcodeparser', parser)
        return return_object
Esempio n. 5
0
    def build_from_port(self, portname, leaveOpen=True, condition=None):
        """
        Returns a tuple of an (s3gObj, ProfileObj)
        for a machine at port portname
        """
        machineInquisitor = self.create_inquisitor(portname)
        if None is condition:
            condition = threading.Condition()
        s3gBot, machine_setup_dict = machineInquisitor.query(condition, leaveOpen)

        profile_regex = self.get_profile_regex(machine_setup_dict)
        matches = makerbot_driver.search_profiles_with_regex(
            profile_regex, self.profile_dir)
        matches = list(matches)
        return_object = ReturnObject()
        attrs = ['s3g', 'profile', 'gcodeparser']
        for a in attrs:
            setattr(return_object, a, None)
        if len(matches) > 0:
            bestProfile = matches[0]
            setattr(return_object, 's3g', s3gBot)
            profile = makerbot_driver.Profile(bestProfile, self.profile_dir)
            profile.values['print_to_file_type']=[machine_setup_dict['print_to_file_type']]
            profile.values['software_variant'] = machine_setup_dict['software_variant']
            profile.values['tool_count_error'] = machine_setup_dict['tool_count_error']
            setattr(return_object, 'profile', profile)
            parser = makerbot_driver.Gcode.GcodeParser()
            parser.s3g = s3gBot
            parser.state.profile = getattr(return_object, 'profile')
            setattr(return_object, 'gcodeparser', parser)
        return return_object
Esempio n. 6
0
 def test_search_profiles_with_regex(self):
     cases = [
         [".*Dual.*", ["ReplicatorDual.json"]],
         [".*Single.*", ["ReplicatorSingle.json"]],
         [".*Replicator.*", ["Replicator2.json", "ReplicatorDual.json", "ReplicatorSingle.json"]],
         [".*FAIL*", []],
     ]
     for case in cases:
         self.assertEqual(case[1], makerbot_driver.search_profiles_with_regex(case[0]))
Esempio n. 7
0
 def test_search_profiles_with_regex(self):
     cases = [
         ['.*Dual.*', ['ReplicatorDual.json', 'TOMStepstruderDual.json']],
         ['.*Single.*', ['ReplicatorSingle.json', 'TOMStepstruderSingle.json']],
         ['.*Replicator.*', ['Replicator2.json',
                             'ReplicatorDual.json',
                             'ReplicatorSingle.json',
                             'Replicator2X.json',
                             ]],
         ['.*FAIL*', []],
     ]
     for case in cases:
         self.assertEqual(
             sorted(case[1]), sorted(makerbot_driver.search_profiles_with_regex(case[0])))
Esempio n. 8
0
  def build_from_port(self, portname, leaveOpen=True):
    """
    Returns a tuple of an (s3gObj, ProfileObj) 
    for a bot at port portname
    """
    botInquisitor = self.create_inquisitor(portname)
    s3gBot, bot_setup_dict = botInquisitor.query(leaveOpen)

 
    profile_regex = self.get_profile_regex(bot_setup_dict)
    matches = makerbot_driver.search_profiles_with_regex(profile_regex, self.profile_dir)
    matches = list(matches)
    if len(matches) > 0:
      bestProfile = matches[0]
      machine_info = ( s3gBot, makerbot_driver.Profile(bestProfile, self.profile_dir))
    else:
      machine_info= ( None, None)
    return machine_info
Esempio n. 9
0
    def build_from_port(self, portname, leaveOpen=True):
        """
    Returns a tuple of an (s3gObj, ProfileObj) 
    for a bot at port portname
    """
        botInquisitor = self.create_inquisitor(portname)
        s3gBot, bot_setup_dict = botInquisitor.query(leaveOpen)

        profile_regex = self.get_profile_regex(bot_setup_dict)
        matches = makerbot_driver.search_profiles_with_regex(
            profile_regex, self.profile_dir)
        matches = list(matches)
        if len(matches) > 0:
            bestProfile = matches[0]
            machine_info = (s3gBot,
                            makerbot_driver.Profile(bestProfile,
                                                    self.profile_dir))
        else:
            machine_info = (None, None)
        return machine_info