def convert(filepath=None):
    args = sys.argv
    usage = ('USAGE: %s [123D FILE PATH OR DIRECTORY]' % args[0])
    directory = os.path.dirname(os.path.realpath(__file__))
    succeeded = False
    if filepath:
        directory = os.path.dirname(filepath)
    elif (len(args) == 2):
        directory = os.path.dirname(args[1])
        filepath = args[1]
    else:
        print(usage)
        print('Using current directory..')
    extractDirectory = os.path.join(directory, '3DFiles')
    if (os.path.isdir(directory) or (filepath and filepath.endswith('.123dx'))):
        if (not os.path.exists(extractDirectory)):
            os.makedirs(extractDirectory)
    else:
        print(usage)
        return False
    if (filepath and filepath.endswith('.123dx')):
        if os.path.exists(filepath):
            _execute(directory, extractDirectory, filepath)
            succeeded = True
        else:
            print(('Failed, %s does not exist' % filepath))
    elif os.path.isdir(directory):
        for filename in os.listdir(directory):
            if filename.endswith('.123dx'):
                _execute(directory, extractDirectory, filename)
                succeeded = True
        if (not succeeded):
            print(('Failed, could not found *.123dx file in %s' % directory))
    if succeeded:
        print('Succeeded, you can find you model files inside the 3DFiles folder')
    return succeeded
def convert(filepath=None):
    args = sys.argv
    usage = ('USAGE: %s [123D FILE PATH OR DIRECTORY]' % args[0])
    directory = os.path.dirname(os.path.realpath(__file__))
    succeeded = False
    if filepath:
        directory = os.path.dirname(filepath)
    elif (len(args) == 2):
        directory = os.path.dirname(args[1])
        filepath = args[1]
    else:
        print(usage)
        print('Using current directory..')
    extractDirectory = os.path.join(directory, '3DFiles')
    if (os.path.isdir(directory) or (filepath and filepath.endswith('.123dx'))):
        if (not os.path.exists(extractDirectory)):
            os.makedirs(extractDirectory)
    else:
        print(usage)
        return False
    if (filepath and filepath.endswith('.123dx')):
        if os.path.exists(filepath):
            _execute(directory, extractDirectory, filepath)
            succeeded = True
        else:
            print(('Failed, %s does not exist' % filepath))
    elif os.path.isdir(directory):
        for filename in os.listdir(directory):
            if filename.endswith('.123dx'):
                _execute(directory, extractDirectory, filename)
                succeeded = True
        if (not succeeded):
            print(('Failed, could not found *.123dx file in %s' % directory))
    if succeeded:
        print('Succeeded, you can find you model files inside the 3DFiles folder')
    return succeeded