コード例 #1
0
 def blocks_count(self, ):
     # This method connects the gui to the relevant function in the app's core
     savingPath = self.dir_button.get_current_folder()
     filename = "AAC_blocks_" + self.directory_settings()
     beaverAutoCAD_core.count_blocks_excel(
         filename, savingPath)  # calls the function from the core
     print "Done."
コード例 #2
0
    def user_interactions(self):
        print 'Hello and welcome to beaverAutoCAD textual interface!'
        print 'Files will be saved at: {}'.format(self.dir_name)
        print '(1) Sum Lines Lengths in a DWG to MS-Excel'
        print '(2) Sum Areas in a DWG to MS-Excel'
        print '(3) Count Blocks in a DWG to MS-Excel'
        print '(4) Count Blocks per layer in a DWG'
        user_chose = raw_input('Please choose what to do [1,2,3,4]: ')
        if user_chose == '1':
            user_string = raw_input('Enter a string to search in layer names: ')
            user_units = raw_input('Drawing units (m / [cm] / mm):')
            if not user_units:
                user_units = 'cm'
            beaverAutoCAD_core.line_lengths_excel(filename='AAC_lines_{}'.format(self.filename),
                                                  savingPath=self.dir_name,
                                                  draw_units=user_units,
                                                  layers_contain=user_string)
            print 'Done.'
        elif user_chose == '2':
                    user_string = raw_input('Enter a string to search in layer names: ')
                    user_units = raw_input('Drawing units (m / [cm] / mm):')
                    if not user_units:
                        user_units = 'cm'
                    beaverAutoCAD_core.sum_areas_excel(filename='AAC_areas_{}'.format(self.filename),
                                                          savingPath=self.dir_name,
                                                          draw_units=user_units,
                                                          layers_contain=user_string)
                    print 'Done.'

        elif user_chose == '3':
            user_string_layers = raw_input('Enter a string to search in layer names: ')
            user_string_blocks = raw_input('Enter a string to search in block names: ')
            user_layer0 = raw_input('Use layer 0? y/[n]')
            if not user_layer0 or user_layer0.lower() == 'n':
                user_layer0 = 'no'
            else:
                user_layer0 = 'yes'
            beaverAutoCAD_core.count_blocks_excel(filename="AAC_blocks_{}".format(self.filename),
                                                  savingPath=self.dir_name,
                                                  uselayer0=user_layer0,
                                                  layers_contain=user_string_layers,
                                                  blocks_contain=user_string_blocks)
            print 'Done.'
        elif user_chose == '4':
            user_string_layers = raw_input('Enter a string to search in layer names: ')
            user_string_blocks = raw_input('Enter a string to search in block names: ')
            user_layer0 = raw_input('Use layer 0? y/[n]')
            if not user_layer0 or user_layer0.lower() == 'n':
                user_layer0 = 'no'
            else:
                user_layer0 = 'yes'
            beaverAutoCAD_core.count_blocks_per_layer(filename="AAC_blocks_per_layer_{}".format(self.filename),
                                                      savingPath=self.dir_name,
                                                      uselayer0=user_layer0,
                                                      layers_contain=user_string_layers,
                                                      blocks_contain=user_string_blocks)
            print 'Done.'
        else:
            print 'No option was chosen. Goodbye!'
        print """
コード例 #3
0
 def callback_blocks_count(self, widget, callback_data=None):
     '''
     This method connects the gui to the relevant function in the app's core
     '''
     # calls the function from the core:
     # beaverAutoCAD_core.count_blocks_excel(filename, savingPath, uselayer0, self.layers_contain)
     self.layers_contain = self.layers_contain_box.get_text()
     self.blocks_contain = self.blocks_contain_box.get_text()
     if self.layers_contain != '':
         print 'Counts blocks in layers contain: {}'.format(self.layers_contain)
     beaverAutoCAD_core.count_blocks_excel(filename="AAC_blocks_{}".format(self.entry.get_text()),
                                           savingPath=self.directory_settings(),
                                           uselayer0=self.use0.get_active_text(),
                                           layers_contain=self.layers_contain,
                                           blocks_contain=self.blocks_contain)
     print "Done."
コード例 #4
0
    def user_interactions(self):
        print 'Hello and welcome to beaverAutoCAD textual interface!'
        print 'Files will be saved at: {}'.format(self.dir_name)
        print '(1) Sum Lines Lengths in a DWG to MS-Excel'
        print '(2) Sum Areas in a DWG to MS-Excel'
        print '(3) Count Blocks in a DWG to MS-Excel'
        print '(4) Count Blocks per layer in a DWG'
        user_chose = raw_input('Please choose what to do [1,2,3,4]: ')
        if user_chose == '1':
            user_string = raw_input(
                'Enter a string to search in layer names: ')
            user_units = raw_input('Drawing units (m / [cm] / mm):')
            if not user_units:
                user_units = 'cm'
            beaverAutoCAD_core.line_lengths_excel(
                filename='AAC_lines_{}'.format(self.filename),
                savingPath=self.dir_name,
                draw_units=user_units,
                layers_contain=user_string)
            print 'Done.'
        elif user_chose == '2':
            user_string = raw_input(
                'Enter a string to search in layer names: ')
            user_units = raw_input('Drawing units (m / [cm] / mm):')
            if not user_units:
                user_units = 'cm'
            beaverAutoCAD_core.sum_areas_excel(filename='AAC_areas_{}'.format(
                self.filename),
                                               savingPath=self.dir_name,
                                               draw_units=user_units,
                                               layers_contain=user_string)
            print 'Done.'

        elif user_chose == '3':
            user_string_layers = raw_input(
                'Enter a string to search in layer names: ')
            user_string_blocks = raw_input(
                'Enter a string to search in block names: ')
            user_layer0 = raw_input('Use layer 0? y/[n]')
            if not user_layer0 or user_layer0.lower() == 'n':
                user_layer0 = 'no'
            else:
                user_layer0 = 'yes'
            beaverAutoCAD_core.count_blocks_excel(
                filename="AAC_blocks_{}".format(self.filename),
                savingPath=self.dir_name,
                uselayer0=user_layer0,
                layers_contain=user_string_layers,
                blocks_contain=user_string_blocks)
            print 'Done.'
        elif user_chose == '4':
            user_string_layers = raw_input(
                'Enter a string to search in layer names: ')
            user_string_blocks = raw_input(
                'Enter a string to search in block names: ')
            user_layer0 = raw_input('Use layer 0? y/[n]')
            if not user_layer0 or user_layer0.lower() == 'n':
                user_layer0 = 'no'
            else:
                user_layer0 = 'yes'
            beaverAutoCAD_core.count_blocks_per_layer(
                filename="AAC_blocks_per_layer_{}".format(self.filename),
                savingPath=self.dir_name,
                uselayer0=user_layer0,
                layers_contain=user_string_layers,
                blocks_contain=user_string_blocks)
            print 'Done.'
        else:
            print 'No option was chosen. Goodbye!'
        print """
コード例 #5
0
 def blocks_count(self, ):
     # This method connects the gui to the relevant function in the app's core
     savingPath = self.dir_button.get_current_folder()
     filename = "AAC_blocks_" + self.directory_settings()
     beaverAutoCAD_core.count_blocks_excel(filename, savingPath)  # calls the function from the core
     print "Done."