Isotropix Forums

How to get the complete file path of the current scene file

Clarisse Scripting related topics

How to get the complete file path of the current scene file

Unread postby raghunandang » Wed Jan 23, 2019 5:02 am

Hi,

I am new to clarrise. I am trying to read the file path of the current project from python. I couldn't find the right function. Can someone point me to the right function?

Thank you
raghunandang
 
Posts: 1
Joined: Wed Jan 23, 2019 4:57 am

Re: How to get the complete file path of the current scene f

Unread postby desmond » Wed Jan 23, 2019 9:16 am

Check this version-up.py from forums (its on top threads in scripting area) created by mr. Arvid.
https://forum.isotropix.com/viewtopic.php?f=21&t=345

snippet from py file:
Code: Select all
def getProjectPath():
    path = ix.application.get_factory().get_vars().get("PDIR").get_string() + "/"
    project_file = ix.application.get_factory().get_vars().get("PNAME").get_string()
    if project_file.find(".project") == -1: project_file += ".project"
    project = path + project_file
    return path, project, project_file
User avatar
desmond
 
Posts: 47
Joined: Mon Feb 05, 2018 8:46 am

Re: How to get the complete file path of the current scene f

Unread postby bvaldes » Wed Jan 23, 2019 9:59 am

Hi,

Desmond's answer can do the job but you have a built-in function to do that:

python code

openedProjectFilename = ix.application.get_current_project_filename()
print openedProjectFilename

If the content of openedProjectFilename is empty that's because your project isn't saved.

Regards
Benoit VALDES
Isotropix
Clarisse QA
User avatar
bvaldes
 
Posts: 384
Joined: Mon Sep 26, 2016 10:44 am


Return to Scripting