3DCoat Python API
The 3DCoat Python API documentation.
|
Public Member Functions | |
str | installPath () |
the 3DCoat installation path | |
str | dataPath () |
the 3DCoat data path | |
str | documents (path=str) |
convert the relative path to the path in documents, if the path is absolute, just return the original path | |
bool | fileExists (path=str) |
check if file exists | |
copyFile (src=str, dest=str) | |
copy the file from src to dest. | |
copyFolder (src=str, dest=str) | |
copy the whole folder from src to dest. | |
removeFile (filename=str) | |
remove the file. | |
removeFolder (folder=str) | |
remove the folder. | |
str | toFullPathInDataFolder (path=str) |
convert the relative path to full path in documents folder. | |
toFullPathInDataFolder (path=Any) | |
convert the relative path to full path in documents folder. | |
str | toFullPathInInstallFolder (path=str) |
convert the relative path to the full path in the install folder. | |
toFullPathInInstallFolder (path=Any) | |
convert the relative path to the full path in the install folder. | |
str | convertToWritablePath (path=str) |
If the path is relative or points into some file in the install folder, it will be converted to the path in documents folder. | |
convertToWritablePath (path=Any) | |
If the path is relative or points into some file in the install folder, it will be converted to the path in documents folder. | |
str | convertToWritablePathIfFileExists (path=str) |
If the path is relative or points into some file in the install folder, it will be converted to the path in documents folder. | |
convertToWritablePathIfFileExists (path=Any) | |
If the path is relative or points into some file in the install folder, it will be converted to the path in documents folder. | |
str | getExtension (filepath=str) |
get the file extension (without .) | |
str | getFileName (filepath=str) |
get the file name from the path | |
str | getFilePath (filepath=str) |
get the file path without the filename | |
str | getFileNameWithoutExtension (filepath=str) |
remove the file extension from the filename | |
str | strFromFile (filename=str) |
read string from file. | |
strToFile (text=str, filename=str) | |
write the string to file | |
vec2 | cursorPos () |
returns the current cursor position | |
vec2 | snappedCursorPos () |
returns the snapped cursor position | |
rect | wholeScreen () |
get the whole screen rectangle | |
rect | workArea () |
get the work area rectangle | |
progressBar (stage=float, max_stage=float, message=str) | |
Show the progress bar. | |
progressBarInWindowHeader (stage=float, max_stage=float, message=str) | |
Show the progress bar only in the 3DCoat's window header. | |
setWindowTitle (text=str, seconds=float) | |
Override the 3DCoat's window title for some amount of time. | |
step (count=int) | |
perform rendering cycles | |
exec (command=str, arguments=str) | |
execete command. | |
str | execAndWait (command=str, arguments=str) |
execute and wait till finished, the console output will be returned as string | |
list | ListFiles (folder=str, mask=str, recursive=bool) |
list files in the folder | |
list | ListFolders (startFolder=str) |
list folders within the folder, non-recursive, just plain list | |
str | supportedImagesFormats () |
returns the currently supported mesh export formats | |
str | supportedMeshesFormats () |
returns the list of supported images formats | |
bool | openFileDialog (extensions=str, fileName=Any) |
show the file dialog | |
str | openFileDialog (extensions=str) |
show the file dialog | |
list | openFilesDialog (extensions=str) |
open multiple files dialog | |
bool | saveFileDialog (extensions=str, fileName=Any) |
show the save file dialog | |
str | saveFileDialog (extensions=str) |
show the save file dialog | |
str | currentSceneFilepath () |
returns the current scene filename, empty if the scene was not saved/opened | |
pipInstall (requirements=str) | |
install one or multiple python packages | |
pipUninstall (requirements=str) | |
install one or multiple python packages | |
str | pythonPath () |
get the python libraries folder | |
showPythonConsole () | |
Show the python console. | |
executeScript (path=str) | |
execute python (.py file) or angelscript (c++ like), or CoreAPI (native C++) script | |
installRequirements (path_to_requirements_txt=str) | |
Install all the requirements for the python script execution. | |
str | toJson (obj=Any, filename=str) |
Store the object to the file or string as json. | |
fromJsonFile (obj=Any, filename=str) | |
Restore the object from the json file. | |
restoreObjectFormJsonString (obj=Any, data=str) | |
Restore the object from the json string. | |
createRedistributablePackageFromFolder (folder=str, package_name=str, excluded_folders_names=str, excluded_extensions=str) | |
Create the 3dcpack file from the folder placed in Documents. | |
coat.io.convertToWritablePath | ( | path = Any | ) |
If the path is relative or points into some file in the install folder, it will be converted to the path in documents folder.
path | the path (full or relative) |
str coat.io.convertToWritablePath | ( | path = str | ) |
If the path is relative or points into some file in the install folder, it will be converted to the path in documents folder.
path | the path (full or relative) |
coat.io.convertToWritablePathIfFileExists | ( | path = Any | ) |
If the path is relative or points into some file in the install folder, it will be converted to the path in documents folder.
If the does not exist in the documents folder, but exists in the install folder, the resulting path will be in the install folder.
path | the path (full or relative) |
str coat.io.convertToWritablePathIfFileExists | ( | path = str | ) |
If the path is relative or points into some file in the install folder, it will be converted to the path in documents folder.
If the does not exist in the documents folder, but exists in the install folder, the resulting path will be in the install folder.
path | the path (full or relative) |
coat.io.copyFile | ( | src = str , |
|
dest = str |
|||
) |
copy the file from src to dest.
If the src or dest is relative, it is relative to the documents folder. This function works correctly with relative paths, so it is recommended over the standard copy files routine.
src | the source filename |
dest | the destination filename |
coat.io.copyFolder | ( | src = str , |
|
dest = str |
|||
) |
copy the whole folder from src to dest.
If the src or dest is relative, it is relative to the documents folder. This function works correctly with relative paths, so it is recommended over the standard copy folder routine.
src | the source folder |
dest | the destination folder |
coat.io.createRedistributablePackageFromFolder | ( | folder = str , |
|
package_name = str , |
|||
excluded_folders_names = str , |
|||
excluded_extensions = str |
|||
) |
Create the 3dcpack file from the folder placed in Documents.
folder | the folder to pack, it should be relative to the 3DCoat's Documents folder |
package_name | the package name, the extension is .3dcpack |
excluded_folders_names | the folders names to be excluded from the package, separated by semicolon |
excluded_extensions | the file extensions to be excluded from the package, separated by semicolon |
str coat.io.currentSceneFilepath | ( | ) |
returns the current scene filename, empty if the scene was not saved/opened
vec2 coat.io.cursorPos | ( | ) |
returns the current cursor position
str coat.io.dataPath | ( | ) |
the 3DCoat data path
str coat.io.documents | ( | path = str | ) |
convert the relative path to the path in documents, if the path is absolute, just return the original path
path | the relative or absolute path |
coat.io.exec | ( | command = str , |
|
arguments = str |
|||
) |
execete command.
It may be exe file, URL, batch command
command | |
arguments |
str coat.io.execAndWait | ( | command = str , |
|
arguments = str |
|||
) |
execute and wait till finished, the console output will be returned as string
command | the command to execute |
arguments | optional arguments |
coat.io.executeScript | ( | path = str | ) |
execute python (.py file) or angelscript (c++ like), or CoreAPI (native C++) script
path | the full or relative path to the script file |
bool coat.io.fileExists | ( | path = str | ) |
check if file exists
path | the path may be full or relative. If it is relative, the documents will be checked first, the the install folder will be checked for file. |
coat.io.fromJsonFile | ( | obj = Any , |
|
filename = str |
|||
) |
Restore the object from the json file.
obj | the object to restore |
filename | the path to the json file, full or relative |
str coat.io.getExtension | ( | filepath = str | ) |
get the file extension (without .)
filepath | the file path - full or relative |
str coat.io.getFileName | ( | filepath = str | ) |
get the file name from the path
filepath | the full or relative path |
str coat.io.getFileNameWithoutExtension | ( | filepath = str | ) |
remove the file extension from the filename
filepath | the file name |
str coat.io.getFilePath | ( | filepath = str | ) |
get the file path without the filename
filepath | the filepath |
str coat.io.installPath | ( | ) |
the 3DCoat installation path
coat.io.installRequirements | ( | path_to_requirements_txt = str | ) |
Install all the requirements for the python script execution.
path_to_requirements_txt | te full or relative path to the requirements.txt |
list coat.io.ListFiles | ( | folder = str , |
|
mask = str , |
|||
recursive = bool |
|||
) |
list files in the folder
folder | the start folder. It may be absolute or relative to 3DCoat documents/install folder. |
mask | the seek mask (wildcards) |
recursive | set true if recursive |
list coat.io.ListFolders | ( | startFolder = str | ) |
list folders within the folder, non-recursive, just plain list
startFolder | the start folder |
str coat.io.openFileDialog | ( | extensions = str | ) |
show the file dialog
extensions | the list of supported extensions like #.txt; #.dat; etc... |
fileName | the resulting filename |
bool coat.io.openFileDialog | ( | extensions = str , |
|
fileName = Any |
|||
) |
show the file dialog
extensions | the list of supported extensions like #.txt; #.dat; etc... |
fileName | the resulting filename |
list coat.io.openFilesDialog | ( | extensions = str | ) |
open multiple files dialog
extensions | the list of supported extensions like #.txt; #.dat; etc... |
coat.io.pipInstall | ( | requirements = str | ) |
install one or multiple python packages
requirements | the list of packages to install, this is all what you write after "pip install" |
coat.io.pipUninstall | ( | requirements = str | ) |
install one or multiple python packages
requirements | the list of packages to install, this is all what you write after "pip install" |
coat.io.progressBar | ( | stage = float , |
|
max_stage = float , |
|||
message = str |
|||
) |
Show the progress bar.
stage | the current stage |
max_stage | the maximal stage |
message | the text to display |
coat.io.progressBarInWindowHeader | ( | stage = float , |
|
max_stage = float , |
|||
message = str |
|||
) |
Show the progress bar only in the 3DCoat's window header.
stage | |
max_stage | |
message |
str coat.io.pythonPath | ( | ) |
get the python libraries folder
coat.io.removeFile | ( | filename = str | ) |
remove the file.
If the filename is relative, it is relative to the documents folder. If the path is in install folder, the corresponding file in documents will be removed. Files in the install folder can't be removed.
filename | the file path |
coat.io.removeFolder | ( | folder = str | ) |
remove the folder.
If the folder is relative, it is relative to the documents folder. If the path is in install folder, the corresponding folder in documents will be removed.
folder | the path to the folder |
coat.io.restoreObjectFormJsonString | ( | obj = Any , |
|
data = str |
|||
) |
Restore the object from the json string.
obj | the object to restore |
data | the json string |
str coat.io.saveFileDialog | ( | extensions = str | ) |
show the save file dialog
extensions | extensions the list of supported extensions like #.txt; #.dat; etc... |
fileName | the resulting filename |
bool coat.io.saveFileDialog | ( | extensions = str , |
|
fileName = Any |
|||
) |
show the save file dialog
extensions | extensions the list of supported extensions like #.txt; #.dat; etc... |
fileName | the resulting filename |
coat.io.setWindowTitle | ( | text = str , |
|
seconds = float |
|||
) |
Override the 3DCoat's window title for some amount of time.
text | the text to show |
seconds | the seconds to stay in title |
coat.io.showPythonConsole | ( | ) |
Show the python console.
vec2 coat.io.snappedCursorPos | ( | ) |
returns the snapped cursor position
coat.io.step | ( | count = int | ) |
perform rendering cycles
count | amount of cycles |
str coat.io.strFromFile | ( | filename = str | ) |
read string from file.
filename | The path. If it is relative, it is relative to the documents folder. If there is no file, it will be taken from the install folder. |
coat.io.strToFile | ( | text = str , |
|
filename = str |
|||
) |
write the string to file
text | the text to save |
filename | The path. If it is relative, it is relative to the documents folder. |
str coat.io.supportedImagesFormats | ( | ) |
returns the currently supported mesh export formats
str coat.io.supportedMeshesFormats | ( | ) |
returns the list of supported images formats
coat.io.toFullPathInDataFolder | ( | path = Any | ) |
convert the relative path to full path in documents folder.
If the path is full and placed in the install folder, it will be converted to path in documents.
path | the path |
str coat.io.toFullPathInDataFolder | ( | path = str | ) |
convert the relative path to full path in documents folder.
If the path is full and placed in the install folder, it will be converted to path in documents.
path | the path |
coat.io.toFullPathInInstallFolder | ( | path = Any | ) |
convert the relative path to the full path in the install folder.
If the path is full, it remains untouched.
path | the relative path |
str coat.io.toFullPathInInstallFolder | ( | path = str | ) |
convert the relative path to the full path in the install folder.
If the path is full, it remains untouched.
path | the relative path |
str coat.io.toJson | ( | obj = Any , |
|
filename = str |
|||
) |
Store the object to the file or string as json.
obj | the python object reference |
filename | the filename to save, if empty, the string will be returned |
rect coat.io.wholeScreen | ( | ) |
get the whole screen rectangle
rect coat.io.workArea | ( | ) |
get the work area rectangle