Exemple #1
0
 filename = sys.argv[1]
 resultfile = None
 if filename in autopack.RECIPES:
     n = filename
     v = sys.argv[2]
     filename = autopack.RECIPES[n][v]["setupfile"]
     resultfile = autopack.RECIPES[n][v]["resultfile"]
 else:
     resultfile = sys.argv[2]
 setupfile = autopack.retrieveFile(filename, cache="recipes")
 print("ok use ", setupfile, filename, resultfile)
 fileName, fileExtension = os.path.splitext(setupfile)
 n = os.path.basename(fileName)
 h = Environment(name=n)
 h.loadRecipe(setupfile)
 h.setupfile = filename
 if resultfile is not None:
     h.resultfile = resultfile
 fileName, fileExtension = os.path.splitext(setupfile)
 if export_json:
     print("expot json recipe ", fileName)
     h.saveRecipe(fileName + ".json", useXref=useXref, indent=True)
 if check_result:
     rfile = h.resultfile
     resultfilename = autopack.retrieveFile(rfile, cache="results")
     if resultfilename is None:
         print("no result for " + n + " " + h.version + " " + rfile)
         sys.exit()
     print("get the result file from ", resultfilename)
     result, orgaresult, freePoint = h.loadResult(
         resultfilename=resultfilename, restore_grid=False,
doit=True
if len(sys.argv) > 1 :#and doit :
    filename = sys.argv[1]
    resultfile=None
    if filename in autopack.RECIPES :
        n=filename
        v=sys.argv[2]
        filename = autopack.RECIPES[n][v]["setupfile"]
        resultfile= autopack.RECIPES[n][v]["resultfile"]
    setupfile = autopack.retrieveFile(filename,cache="recipes")
    print ("ok use ",setupfile,filename)
    fileName, fileExtension = os.path.splitext(setupfile)
    n=os.path.basename(fileName)
    h = Environment(name=n)     
    h.loadRecipe(setupfile)
    h.setupfile=filename
    if resultfile is not None :
        h.resultfile=resultfile
    fileName, fileExtension = os.path.splitext(setupfile)
    rfile = h.resultfile
    resultfilename = autopack.retrieveFile(rfile,cache="results")
    if resultfilename is None :
        print ("no result for "+n+" "+h.version+" "+rfile)
        sys.exit()
    print ("get the result file from ",resultfilename)
    result,orgaresult,freePoint=h.loadResult(resultfilename=resultfilename)
#                                             restore_grid=False,backward=True)#load text ?#this will restore the grid  
    ingredients = h.restore(result,orgaresult,freePoint)
    #export the complete recipe as collada. each ingredient -> meshnode. Each instance->node instance
    env=h
    if doit :
        cxml=build_scene(env)