3DCoat Python API
The 3DCoat Python API documentation.
Loading...
Searching...
No Matches
coat.io Class Reference

Static Public Member Functions

str installPath ()
 the 3DCoat installation path
 
str dataPath ()
 the 3DCoat data path
 
str documents (str path)
 convert the relative path to the path in documents, if the path is absolute, just return the original path
 
bool fileExists (str path)
 check if file exists
 
 copyFile (str src, str dest)
 copy the file from src to dest.
 
 copyFolder (str src, str dest)
 copy the whole folder from src to dest.
 
 removeFile (str filename)
 remove the file.
 
 removeFolder (str folder)
 remove the folder.
 
str toFullPathInDataFolder (str path)
 convert the relative path to full path in documents folder.
 
 toFullPathInDataFolder (any path)
 
str toFullPathInInstallFolder (str path)
 convert the relative path to the full path in the install folder.
 
 toFullPathInInstallFolder (any path)
 
str convertToWritablePath (str path)
 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 (any path)
 
str convertToWritablePathIfFileExists (str path)
 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 (any path)
 
str getExtension (str filepath)
 get the file extension (without .)
 
str getFileName (str filepath)
 get the file name from the path
 
str getFilePath (str filepath)
 get the file path without the filename
 
str getFileNameWithoutExtension (str filepath)
 remove the file extension from the filename
 
str strFromFile (str filename)
 read string from file.
 
 strToFile (str text, str filename)
 write the string to file
 
int getFileSize (str filename)
 get the file size
 
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 (float stage, float max_stage, str message)
 Show the progress bar.
 
 progressBarInWindowHeader (float stage, float max_stage, str message)
 Show the progress bar only in the 3DCoat's window header.
 
 setWindowTitle (str text, float seconds)
 Override the 3DCoat's window title for some amount of time.
 
 step (int count=1)
 perform rendering cycles
 
 exec (str command, str arguments=None)
 execute command.
 
str execAndWait (str command, str arguments=None)
 execute and wait till finished, the console output will be returned as string
 
 updateCoatPyi (str folderOrFile)
 update the .pyi file for the given folder or py file
 
list ListFiles (str folder, str mask, bool recursive=True)
 list files in the folder
 
list ListFolders (str startFolder)
 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 (str extensions, any fileName)
 show the file dialog
 
str openFileDialog (str extensions)
 
list openFilesDialog (str extensions)
 open multiple files dialog
 
bool saveFileDialog (str extensions, any fileName)
 show the save file dialog
 
str saveFileDialog (str extensions)
 
str currentSceneFilepath ()
 returns the current scene filename, empty if the scene was not saved/opened
 
 pipInstall (str requirements)
 install one or multiple python packages
 
 pipUninstall (str requirements)
 
str pythonPath ()
 get the python libraries folder
 
 showPythonConsole ()
 Show the python console, clear it and pop up.
 
 executeScript (str path)
 execute python (.py file) or angelscript (c++ like), or CoreAPI (native C++) script
 
 installRequirements (str path_to_requirements_txt)
 Install all the requirements for the python script execution.
 
str toJson (any obj, str filename="")
 Store the object to the file or string as json.
 
 fromJsonFile (any obj, str filename)
 Restore the object from the json file.
 
 restoreObjectFormJsonString (any obj, str data)
 Restore the object from the json string.
 
 createRedistributablePackageFromFolder (str folder, str package_name, str excluded_folders_names="", str excluded_extensions="")
 Create the 3dcpack file from the folder placed in Documents.
 
int getDownloadProgress ()
 returns the overall download progress
 
list listBlenderInstallFolders ()
 list the blender install folders
 
 saveScreenshot (str filename, int x=0, int y=0, int width=0, int height=0)
 save the screenshot to the file
 
 removeBackground (str image1, str image2, str result)
 

Member Function Documentation

◆ convertToWritablePath() [1/2]

coat.io.convertToWritablePath ( any path)
static

◆ convertToWritablePath() [2/2]

str coat.io.convertToWritablePath ( str path)
static

If the path is relative or points into some file in the install folder, it will be converted to the path in documents folder.

Parameters
paththe path (full or relative)
Returns
the write-able path

◆ convertToWritablePathIfFileExists() [1/2]

coat.io.convertToWritablePathIfFileExists ( any path)
static

◆ convertToWritablePathIfFileExists() [2/2]

str coat.io.convertToWritablePathIfFileExists ( str path)
static

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.

Parameters
paththe path (full or relative)
Returns
the path

◆ copyFile()

coat.io.copyFile ( str src,
str dest )
static

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.

Parameters
srcthe source filename
destthe destination filename

◆ copyFolder()

coat.io.copyFolder ( str src,
str dest )
static

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.

Parameters
srcthe source folder
destthe destination folder

◆ createRedistributablePackageFromFolder()

coat.io.createRedistributablePackageFromFolder ( str folder,
str package_name,
str excluded_folders_names = "",
str excluded_extensions = "" )
static

Create the 3dcpack file from the folder placed in Documents.

Parameters
folderthe folder to pack, it should be relative to the 3DCoat's Documents folder
package_namethe package name, the extension is .3dcpack
excluded_folders_namesthe folders names to be excluded from the package, separated by semicolon
excluded_extensionsthe file extensions to be excluded from the package, separated by semicolon

◆ currentSceneFilepath()

str coat.io.currentSceneFilepath ( )
static

returns the current scene filename, empty if the scene was not saved/opened

◆ cursorPos()

vec2 coat.io.cursorPos ( )
static

returns the current cursor position

Returns
the 2d vector

◆ dataPath()

str coat.io.dataPath ( )
static

the 3DCoat data path

Returns
the path

◆ documents()

str coat.io.documents ( str path)
static

convert the relative path to the path in documents, if the path is absolute, just return the original path

Parameters
paththe relative or absolute path
Returns
the absolute path in user documents

◆ exec()

coat.io.exec ( str command,
str arguments = None )
static

execute command.

It may be exe file, URL, batch command

Parameters
commandthe command to execute
argumentsoptional command line arguments

◆ execAndWait()

str coat.io.execAndWait ( str command,
str arguments = None )
static

execute and wait till finished, the console output will be returned as string

Parameters
commandthe command to execute
argumentsoptional arguments
Returns
the console output of the executed program

◆ executeScript()

coat.io.executeScript ( str path)
static

execute python (.py file) or angelscript (c++ like), or CoreAPI (native C++) script

Parameters
paththe full or relative path to the script file

◆ fileExists()

bool coat.io.fileExists ( str path)
static

check if file exists

Parameters
paththe 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.
Returns
true if the file exists

◆ fromJsonFile()

coat.io.fromJsonFile ( any obj,
str filename )
static

Restore the object from the json file.

Parameters
objthe object to restore
filenamethe path to the json file, full or relative

◆ getDownloadProgress()

int coat.io.getDownloadProgress ( )
static

returns the overall download progress

Returns
the progress in percents

◆ getExtension()

str coat.io.getExtension ( str filepath)
static

get the file extension (without .)

Parameters
filepaththe file path - full or relative
Returns
the extension

◆ getFileName()

str coat.io.getFileName ( str filepath)
static

get the file name from the path

Parameters
filepaththe full or relative path
Returns
the filename without the path

◆ getFileNameWithoutExtension()

str coat.io.getFileNameWithoutExtension ( str filepath)
static

remove the file extension from the filename

Parameters
filepaththe file name
Returns
the filename without extension

◆ getFilePath()

str coat.io.getFilePath ( str filepath)
static

get the file path without the filename

Parameters
filepaththe filepath
Returns
the path that always ends with '/'

◆ getFileSize()

int coat.io.getFileSize ( str filename)
static

get the file size

Parameters
filenamethe filename, relative or full
Returns
the file size

◆ installPath()

str coat.io.installPath ( )
static

the 3DCoat installation path

Returns
the path

◆ installRequirements()

coat.io.installRequirements ( str path_to_requirements_txt)
static

Install all the requirements for the python script execution.

Parameters
path_to_requirements_txtte full or relative path to the requirements.txt

◆ listBlenderInstallFolders()

list coat.io.listBlenderInstallFolders ( )
static

list the blender install folders

Returns
the list of the blender install folders

◆ ListFiles()

list coat.io.ListFiles ( str folder,
str mask,
bool recursive = True )
static

list files in the folder

Parameters
folderthe start folder. It may be absolute or relative to 3DCoat documents/install folder.
maskthe seek mask (wildcards)
recursiveset true if recursive
Returns
result the files list

◆ ListFolders()

list coat.io.ListFolders ( str startFolder)
static

list folders within the folder, non-recursive, just plain list

Parameters
startFolderthe start folder
Returns
the resulting list

◆ openFileDialog() [1/2]

str coat.io.openFileDialog ( str extensions)
static

◆ openFileDialog() [2/2]

bool coat.io.openFileDialog ( str extensions,
any fileName )
static

show the file dialog

Parameters
extensionsthe list of supported extensions like *.txt;*.dat; etc...
fileNamethe resulting filename
Returns
true if user chosen the file successfully

◆ openFilesDialog()

list coat.io.openFilesDialog ( str extensions)
static

open multiple files dialog

Parameters
extensionsthe list of supported extensions like *.txt;*.dat; etc...
Returns
the resulting filenames list

◆ pipInstall()

coat.io.pipInstall ( str requirements)
static

install one or multiple python packages

Parameters
requirementsthe list of packages to install, this is all what you write after "pip install"

◆ pipUninstall()

coat.io.pipUninstall ( str requirements)
static

◆ progressBar()

coat.io.progressBar ( float stage,
float max_stage,
str message )
static

Show the progress bar.

Parameters
stagethe current stage
max_stagethe maximal stage
messagethe text to display

◆ progressBarInWindowHeader()

coat.io.progressBarInWindowHeader ( float stage,
float max_stage,
str message )
static

Show the progress bar only in the 3DCoat's window header.

Parameters
stagethe current stage
max_stagethe maximal stage
messagethe text to display

◆ pythonPath()

str coat.io.pythonPath ( )
static

get the python libraries folder

Returns
the path

◆ removeBackground()

coat.io.removeBackground ( str image1,
str image2,
str result )
static

◆ removeFile()

coat.io.removeFile ( str filename)
static

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.

Parameters
filenamethe file path

◆ removeFolder()

coat.io.removeFolder ( str folder)
static

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.

Parameters
folderthe path to the folder

◆ restoreObjectFormJsonString()

coat.io.restoreObjectFormJsonString ( any obj,
str data )
static

Restore the object from the json string.

Parameters
objthe object to restore
datathe json string

◆ saveFileDialog() [1/2]

str coat.io.saveFileDialog ( str extensions)
static

◆ saveFileDialog() [2/2]

bool coat.io.saveFileDialog ( str extensions,
any fileName )
static

show the save file dialog

Parameters
extensionsextensions the list of supported extensions like *.txt;*.dat; etc...
fileNamethe resulting filename
Returns
true if user chosen the file successfully

◆ saveScreenshot()

coat.io.saveScreenshot ( str filename,
int x = 0,
int y = 0,
int width = 0,
int height = 0 )
static

save the screenshot to the file

Parameters
filenamethe filename
xthe x coordinate of the screenshot
ythe y coordinate of the screenshot
widththe width of the screenshot, if 0 all to the right will be captured
heightthe height of the screenshot, if 0 all to the bottom will be captured

◆ setWindowTitle()

coat.io.setWindowTitle ( str text,
float seconds )
static

Override the 3DCoat's window title for some amount of time.

Parameters
textthe text to show
secondsthe seconds to stay in title

◆ showPythonConsole()

coat.io.showPythonConsole ( )
static

Show the python console, clear it and pop up.

◆ snappedCursorPos()

vec2 coat.io.snappedCursorPos ( )
static

returns the snapped cursor position

Returns
the 2d vector

◆ step()

coat.io.step ( int count = 1)
static

perform rendering cycles

Parameters
countamount of cycles

◆ strFromFile()

str coat.io.strFromFile ( str filename)
static

read string from file.

Parameters
filenameThe 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.
Returns
true if file read succesful

◆ strToFile()

coat.io.strToFile ( str text,
str filename )
static

write the string to file

Parameters
textthe text to save
filenameThe path. If it is relative, it is relative to the documents folder.

◆ supportedImagesFormats()

str coat.io.supportedImagesFormats ( )
static

returns the currently supported mesh export formats

Returns
the list like "*.obj;*.fbx;..."

◆ supportedMeshesFormats()

str coat.io.supportedMeshesFormats ( )
static

returns the list of supported images formats

Returns
the list like "*.png;*.jpg;..."

◆ toFullPathInDataFolder() [1/2]

coat.io.toFullPathInDataFolder ( any path)
static

◆ toFullPathInDataFolder() [2/2]

str coat.io.toFullPathInDataFolder ( str path)
static

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.

Parameters
paththe path
Returns
the fill path in documents

◆ toFullPathInInstallFolder() [1/2]

coat.io.toFullPathInInstallFolder ( any path)
static

◆ toFullPathInInstallFolder() [2/2]

str coat.io.toFullPathInInstallFolder ( str path)
static

convert the relative path to the full path in the install folder.

If the path is full, it remains untouched.

Parameters
paththe relative path
Returns
the full path in the install folder

◆ toJson()

str coat.io.toJson ( any obj,
str filename = "" )
static

Store the object to the file or string as json.

Parameters
objthe python object reference
filenamethe filename to save, if empty, the string will be returned
Returns
the string that contains json data

◆ updateCoatPyi()

coat.io.updateCoatPyi ( str folderOrFile)
static

update the .pyi file for the given folder or py file

Parameters
folderOrFilethe full or relative path to the folder or py file

◆ wholeScreen()

rect coat.io.wholeScreen ( )
static

get the whole screen rectangle

Returns
the rectangle, top-left is (0,0)

◆ workArea()

rect coat.io.workArea ( )
static

get the work area rectangle

Returns
the rectangle, top-left is (0,0)

The documentation for this class was generated from the following file: