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

Ayush Kumar
Ayush Kumar Member, Moderator, Employee Posts: 472
100 Answers 250 Likes 100 Comments Second Anniversary
✭✭✭✭
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: 472
    100 Answers 250 Likes 100 Comments Second Anniversary
    ✭✭✭✭
    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")