How do I get User Files Directory of a WB project using SpaceClaim Scripting API?

Ayush Kumar
Ayush Kumar Member, Moderator, Employee Posts: 389
First Anniversary Ansys Employee Solution Developer Community of Practice Member First Answer
edited June 2023 in 3D Design

How do I get User Files Directory of a WB project using SpaceClaim Scripting API?

Tagged:

Answers

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 389
    First Anniversary Ansys Employee Solution Developer Community of Practice Member First Answer
    Answer ✓

    Not sure if there is a native function, but the workaround is this:

    import os
    import re
    
    reg_exp = r"(.*)\dp"
    doc_path = GetActiveWindow().Document.Path
    results = re.search(reg_exp, doc_path)
    
    # Get Project Path
    project_path = results.group(1)
    
    # Create User Files Directory Path
    user_files_dir = os.path.join(project_path, "user_files")