Skip to content

Source Code (Pure Python)

Below you find an example script how to use it with pure python.

main()

This is the main function that is used to test the MPCForceExtractor class Its there because of a entry point in the toml file

Source code in mpcforces_extractor\main.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
def main():
    """
    This is the main function that is used to test the MPCForceExtractor class
    Its there because of a entry point in the toml file
    """

    input_folder = "data/input"
    output_folder = "data/output"
    model_name = "m"
    # model_name = "Flange"
    blocksize = 8

    mpc_force_extractor = MPCForceExtractor(
        input_folder + f"/{model_name}.fem",
        input_folder + f"/{model_name}.mpcf",
        output_folder + f"/{model_name}",
    )

    # Write Summary
    mpc_force_extractor.build_fem_and_subcase_data(blocksize)
    summary_writer = SummaryWriter(
        mpc_force_extractor, mpc_force_extractor.output_folder
    )
    summary_writer.add_header()
    summary_writer.add_mpc_lines()
    summary_writer.write_lines()

    # Visualize the connected parts
    start_time = time.time()
    output_vis = os.path.join(output_folder, model_name, "tcl_visualization")
    visualizer = VisualizerConnectedParts(output_vis)
    visualizer.output_tcl_lines_for_part_vis()

    print("TCL visualization lines written to", output_vis)
    print("..took ", round(time.time() - start_time, 2), "seconds")