コード例 #1
0
ファイル: CreateAdamsModel.py プロジェクト: dyao-vu/meta-core
def main():
    global args
    parser = argparse.ArgumentParser(description='Creates an Adams .cmd file to build up the kinematic model.')
    parser.add_argument('-terrain');
    parser.add_argument('-firstpass');
    args = parser.parse_args()

    missing = False
    if not os.path.isfile(os.getcwd() + os.sep + globalParams["Analysis_File"]):
        print 'File ' + os.getcwd() + os.sep + globalParams["Analysis_File"] + ' is missing'
        missing = True
    if not os.path.isfile(os.getcwd() + os.sep + globalParams["CADMetrics_File"]):
        print 'File ' + os.getcwd() + os.sep + globalParams["CADMetrics_File"] + ' is missing'
        missing = True
    if not os.path.isfile(os.getcwd() + os.sep + globalParams["CADPostProc_File"]):
        print 'File ' + os.getcwd() + os.sep + globalParams["CADPostProc_File"] + ' is missing'
        missing = True

    if missing:
        exit(-1)

    try:
        analysis = MA.parse(os.getcwd() + os.sep + globalParams["Analysis_File"], True)
    except MA.GDSParseError as e:
        print "Unable to parse " + globalParams["Analysis_File"] + ", exiting. Error message: " + e.message
        exit(-1)

    try:
        cadmetrics = CM.parse(os.getcwd() + os.sep + globalParams["CADMetrics_File"], True)
    except CM.GDSParseError as e:
        print "Unable to parse " + globalParams["CADMetrics_File"] + ", exiting. Error message: " + e.message
        exit(-1)

    try:
        cadpostproc = CP.parse(os.getcwd() + os.sep + globalParams["CADPostProc_File"], True)
    except CM.GDSParseError as e:
        print "Unable to parse " + globalParams["CADPostProc_File"] + ", exiting. Error message: " + e.message
        exit(-1)

    firstpass = False

    if args.firstpass:
        firstpass = True

    model = setup_model(analysis, cadmetrics, cadpostproc, firstpass)

    try:
        if model is None:
            print "Unable to setup model, exiting."
            exit(-1)

        AdamsExport(model, firstpass, True)
    except ProcessingError as e:
        print "Processing error: " + e.message
        exit(-1)
コード例 #2
0
def main():
    global args
    parser = argparse.ArgumentParser(
        description=
        'Creates an Adams .cmd file to build up the kinematic model.')
    parser.add_argument('-terrain')
    parser.add_argument('-firstpass')
    args = parser.parse_args()

    missing = False
    if not os.path.isfile(os.getcwd() + os.sep +
                          globalParams["Analysis_File"]):
        print 'File ' + os.getcwd(
        ) + os.sep + globalParams["Analysis_File"] + ' is missing'
        missing = True
    if not os.path.isfile(os.getcwd() + os.sep +
                          globalParams["CADMetrics_File"]):
        print 'File ' + os.getcwd(
        ) + os.sep + globalParams["CADMetrics_File"] + ' is missing'
        missing = True
    if not os.path.isfile(os.getcwd() + os.sep +
                          globalParams["CADPostProc_File"]):
        print 'File ' + os.getcwd(
        ) + os.sep + globalParams["CADPostProc_File"] + ' is missing'
        missing = True

    if missing:
        exit(-1)

    asminfo = cad_library.AssemblyInfo()

    try:
        analysis = MA.parse(
            os.getcwd() + os.sep + globalParams["Analysis_File"], True)
    except MA.GDSParseError as exc:
        print "Unable to parse " + globalParams[
            "Analysis_File"] + ", exiting. Error message: " + exc.message
        exit(-1)

    try:
        asminfo.read_metrics_file(os.getcwd() + os.sep +
                                  globalParams["CADMetrics_File"])
    except Exception as exc:
        print "Unable to parse " + globalParams[
            "CADMetrics_File"] + ", exiting. Error message: " + exc.message
        exit(-1)

    #cad_library.ComponentData.dump_hierarchy(asminfo.root)

    try:
        cadpostproc = CP.parse(
            os.getcwd() + os.sep + globalParams["CADPostProc_File"], True)
    except CP.GDSParseError as exc:
        print "Unable to parse " + globalParams[
            "CADPostProc_File"] + ", exiting. Error message: " + exc.message
        exit(-1)

    firstpass = False

    if args.firstpass:
        firstpass = True

    model = setup_model(analysis, asminfo, cadpostproc, firstpass)

    try:
        if model is None:
            print "Unable to setup model, exiting."
            exit(-1)

        AdamsExport(model, firstpass, True)
    except ProcessingError as e:
        print "Processing error: " + e.message
        exit(-1)

    print "adams_output" + '.' + globalParams[
        'AdamsExtension'] + " has been succesfully generated."
コード例 #3
0
ファイル: CreateAdamsModel.py プロジェクト: dyao-vu/meta-core
def main():
    global args
    parser = argparse.ArgumentParser(description='Creates an Adams .cmd file to build up the kinematic model.')
    parser.add_argument('-terrain')
    parser.add_argument('-firstpass')
    args = parser.parse_args()

    missing = False
    if not os.path.isfile(os.getcwd() + os.sep + globalParams["Analysis_File"]):
        print 'File ' + os.getcwd() + os.sep + globalParams["Analysis_File"] + ' is missing'
        missing = True
    if not os.path.isfile(os.getcwd() + os.sep + globalParams["CADMetrics_File"]):
        print 'File ' + os.getcwd() + os.sep + globalParams["CADMetrics_File"] + ' is missing'
        missing = True
    if not os.path.isfile(os.getcwd() + os.sep + globalParams["CADPostProc_File"]):
        print 'File ' + os.getcwd() + os.sep + globalParams["CADPostProc_File"] + ' is missing'
        missing = True

    if missing:
        exit(-1)

    asminfo = cad_library.AssemblyInfo()

    try:
        analysis = MA.parse(os.getcwd() + os.sep + globalParams["Analysis_File"], True)
    except MA.GDSParseError as exc:
        print "Unable to parse " + globalParams["Analysis_File"] + ", exiting. Error message: " + exc.message
        exit(-1)

    try:
        asminfo.read_metrics_file(os.getcwd() + os.sep + globalParams["CADMetrics_File"])
    except Exception as exc:
        print "Unable to parse " + globalParams["CADMetrics_File"] + ", exiting. Error message: " + exc.message
        exit(-1)

    #cad_library.ComponentData.dump_hierarchy(asminfo.root)

    try:
        cadpostproc = CP.parse(os.getcwd() + os.sep + globalParams["CADPostProc_File"], True)
    except CP.GDSParseError as exc:
        print "Unable to parse " + globalParams["CADPostProc_File"] + ", exiting. Error message: " + exc.message
        exit(-1)

    firstpass = False

    if args.firstpass:
        firstpass = True

    model = setup_model(analysis, asminfo, cadpostproc, firstpass)

    try:
        if model is None:
            print "Unable to setup model, exiting."
            exit(-1)

        AdamsExport(model, firstpass, True)
    except ProcessingError as e:
        print "Processing error: " + e.message
        exit(-1)

    print "adams_output" + '.' + globalParams['AdamsExtension'] + " has been succesfully generated."