Пример #1
0
def convert_step_file(doc_file_path, doc_file_id, location, thumb_path):
    """


    :param doc_file_path: Path of a file **.stp**
    :param doc_file_id: id that is applied for the generation of the tree **.arb** and the geometries **.geo**
    :param location: Path where to store the files **.geo** and **.arb** generated


    For a file STEP determined by its path (**doc_file_path**),  it generates its file **.arb** and its files **.geo** having count an **id** determined by **doc_file_id**
    and returns in stdout the list of paths of files generated

    """
    logging.getLogger("GarbageCollector").setLevel(logging.ERROR)
    step_importer = StepImporter(doc_file_path, doc_file_id)
    product = step_importer.generate_product_arbre()
    pov_dir = tempfile.mkdtemp(suffix="openplm_pov")
    geo = step_importer.compute_geometries(location, pov_dir)
    print geo
    print write_arbrefile(product, step_importer.fileName, location)
    if step_importer.thumbnail_valid and product:
        create_thumbnail(product, step_importer, pov_dir, thumb_path)
    shutil.rmtree(pov_dir, True)
Пример #2
0
def convert_step_file(doc_file_path, doc_file_id, location, thumb_path):
    """


    :param doc_file_path: Path of a file **.stp**
    :param doc_file_id: id that is applied for the generation of the tree **.arb** and the geometries **.geo**
    :param location: Path where to store the files **.geo** and **.arb** generated


    For a file STEP determined by its path (**doc_file_path**),  it generates its file **.arb** and its files **.geo** having count an **id** determined by **doc_file_id**
    and returns in stdout the list of paths of files generated

    """
    logging.getLogger("GarbageCollector").setLevel(logging.ERROR)
    step_importer = StepImporter(doc_file_path, doc_file_id)
    product = step_importer.generate_product_arbre()
    pov_dir = tempfile.mkdtemp(suffix="openplm_pov")
    geo = step_importer.compute_geometries(location, pov_dir)
    print geo
    print write_arbrefile(product, step_importer.fileName, location)
    if step_importer.thumbnail_valid and product:
        create_thumbnail(product, step_importer, pov_dir, thumb_path)
    shutil.rmtree(pov_dir, True)