convert module#
- generate_python_file_description(component_code)[source]#
Generate a description for the generated Python code written to the file, including instructions on how to import the component.
- Return type:
- Parameters:
component_code (ComponentCode)
- insert_model3d_dir(component, model3d_dir)[source]#
Modify ComponentCode to place the Model3D files under the model3d_dir folder.
Example
This function would change the filename in a Model3D statement “jitx-01234.stp” to “model3d_dir/jitx-01234.stp”.
- Return type:
ComponentCode- Parameters:
component (ComponentCode)
model3d_dir (str)
- convert_component_core(component_code, component_name=None, output_path=None, local_model3d_file=False, use_jitxstd_symbol=None)[source]#
- convert_component(component_code, component_name=None, output_path=None, use_jitxstd_symbol=None)[source]#
- write_marker_file(root_path, rel_path_to_init)[source]#
Write a marker file in root_path that declares the import target folder.
- read_import_target_from_marker_file(root_path)[source]#
Read the import_target folder from the marker file if exists.
- determine_import_target_folder(start_path='.')[source]#
Determine the path to the source package, containing the __init__.py file, to use as the import_target folder.
Perform a breadth-first search from start_path to find the top-most directory that contains an __init__.py file. Use a marker file to cache the result to avoid repeated searches.
- Returns:
relative path to the found package directory
- Return type: