예제 #1
0
def composer(temp_file_name):
    """
    :param temp_file_name: path of a  :class:`.tempfile` **.arb** that contains the information to generate a :class:`.Product` relative to the arborescense of a **.stp** file


    For every node of the :class:`.Product`  the attribute **doc_file_path** indicates where is store the file **.stp** that represents the node

    """
    output = open(temp_file_name.encode(),"r")
    product = Product.from_list(json.loads(output.read()))
    output.close()
    output = open(temp_file_name.encode(),"w+")# erase old data
    output.close()

    WS = XSControl_WorkSession()
    my_step_importer = StepImporter(product.doc_path)

    st = my_step_importer.shape_tool
    lr = TDF_LabelSequence()
    st.GetFreeShapes(lr)

    add_labels(product, lr.Value(1), st)
    writer = STEPCAFControl_Writer(WS.GetHandle(), False)
    for i in range(lr.Length()):
        writer.Transfer(lr.Value(i+1), STEPControl_AsIs)

    writer.Write(temp_file_name)
예제 #2
0
def composer(temp_file_name):
    """
    :param temp_file_name: path of a  :class:`.tempfile` **.arb** that contains the information to generate a :class:`.Product` relative to the arborescense of a **.stp** file


    For every node of the :class:`.Product`  the attribute **doc_file_path** indicates where is store the file **.stp** that represents the node

    """
    output = open(temp_file_name.encode(), "r")
    product = Product.from_list(json.loads(output.read()))
    output.close()
    output = open(temp_file_name.encode(), "w+")  # erase old data
    output.close()

    WS = XSControl_WorkSession()
    my_step_importer = StepImporter(product.doc_path)

    st = my_step_importer.shape_tool
    lr = TDF_LabelSequence()
    st.GetFreeShapes(lr)

    add_labels(product, lr.Value(1), st)
    writer = STEPCAFControl_Writer(WS.GetHandle(), False)
    for i in range(lr.Length()):
        writer.Transfer(lr.Value(i + 1), STEPControl_AsIs)

    writer.Write(temp_file_name)
예제 #3
0
def dummy_compose(temp_file_name):

    output = open(temp_file_name.encode(),"r")
    product = Product.from_list(json.loads(output.read()))
    output.close()
    output = open(temp_file_name.encode(),"w+")# erase old data
    output.close()
    with open(temp_file_name, "w") as output:
        c = Composer(product, output)
        c.compose()
예제 #4
0
def dummy_compose(temp_file_name):

    output = open(temp_file_name.encode(), "r")
    product = Product.from_list(json.loads(output.read()))
    output.close()
    output = open(temp_file_name.encode(), "w+")  # erase old data
    output.close()
    with open(temp_file_name, "w") as output:
        c = Composer(product, output)
        c.compose()
예제 #5
0
def decompose(path, temp_file_name):
    """
    Decomposes a STEP file into several STEP files (one per unique assembly/part)

    :param path: Path of a file **.stp**
    :param temp_file_name: path of a  :class:`.tempfile` **.arb** that contains the data required
          to generate a :class:`.Product` relative to the arborescense of a **.stp** file
    """
    output = open(temp_file_name.encode(), "r")
    old_product = Product.from_list(json.loads(output.read()))
    step_importer = StepImporter(path)
    shape_tool = step_importer.shape_tool
    product = step_importer.generate_product_arbre()
    decompose_children(product, old_product, shape_tool)
    write_step(product, old_product, shape_tool)
예제 #6
0
def decompose(path, temp_file_name):
    """
    Decomposes a STEP file into several STEP files (one per unique assembly/part)

    :param path: Path of a file **.stp**
    :param temp_file_name: path of a  :class:`.tempfile` **.arb** that contains the data required
          to generate a :class:`.Product` relative to the arborescense of a **.stp** file
    """
    output = open(temp_file_name.encode(),"r")
    old_product = Product.from_list(json.loads(output.read()))
    step_importer = StepImporter(path)
    shape_tool = step_importer.shape_tool
    product = step_importer.generate_product_arbre()
    decompose_children(product, old_product, shape_tool)
    write_step(product, old_product, shape_tool)