3DCoat Python API
The 3DCoat Python API documentation.
Loading...
Searching...
No Matches
Public Member Functions | List of all members
coat.io Class Reference

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.
 

Member Function Documentation

◆ convertToWritablePath() [1/2]

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.

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

◆ convertToWritablePath() [2/2]

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.

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

◆ convertToWritablePathIfFileExists() [1/2]

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.

Parameters
paththe path (full or relative)
Returns
the path

◆ convertToWritablePathIfFileExists() [2/2]

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.

Parameters
paththe path (full or relative)
Returns
the path

◆ copyFile()

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.

Parameters
srcthe source filename
destthe destination filename

◆ copyFolder()

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.

Parameters
srcthe source folder
destthe destination folder

◆ createRedistributablePackageFromFolder()

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.

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 ( )

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

◆ cursorPos()

vec2 coat.io.cursorPos ( )

returns the current cursor position

Returns
the 2d vector

◆ dataPath()

str coat.io.dataPath ( )

the 3DCoat data path

Returns
the path

◆ documents()

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

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

◆ exec()

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

execete command.

It may be exe file, URL, batch command

Parameters
command
arguments

◆ execAndWait()

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

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 (   path = str)

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 (   path = str)

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 (   obj = Any,
  filename = str 
)

Restore the object from the json file.

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

◆ getExtension()

str coat.io.getExtension (   filepath = str)

get the file extension (without .)

Parameters
filepaththe file path - full or relative
Returns
the extension

◆ getFileName()

str coat.io.getFileName (   filepath = str)

get the file name from the path

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

◆ getFileNameWithoutExtension()

str coat.io.getFileNameWithoutExtension (   filepath = str)

remove the file extension from the filename

Parameters
filepaththe file name
Returns
the filename without extension

◆ getFilePath()

str coat.io.getFilePath (   filepath = str)

get the file path without the filename

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

◆ installPath()

str coat.io.installPath ( )

the 3DCoat installation path

Returns
the path

◆ installRequirements()

coat.io.installRequirements (   path_to_requirements_txt = str)

Install all the requirements for the python script execution.

Parameters
path_to_requirements_txtte full or relative path to the requirements.txt

◆ ListFiles()

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

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 (   startFolder = str)

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 (   extensions = str)

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

◆ openFileDialog() [2/2]

bool coat.io.openFileDialog (   extensions = str,
  fileName = Any 
)

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 (   extensions = str)

open multiple files dialog

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

◆ pipInstall()

coat.io.pipInstall (   requirements = str)

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 (   requirements = str)

install one or multiple python packages

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

◆ progressBar()

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

Show the progress bar.

Parameters
stagethe current stage
max_stagethe maximal stage
messagethe text to display

◆ progressBarInWindowHeader()

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

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

Parameters
stage
max_stage
message

◆ pythonPath()

str coat.io.pythonPath ( )

get the python libraries folder

Returns
the path

◆ removeFile()

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.

Parameters
filenamethe file path

◆ removeFolder()

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.

Parameters
folderthe path to the folder

◆ restoreObjectFormJsonString()

coat.io.restoreObjectFormJsonString (   obj = Any,
  data = str 
)

Restore the object from the json string.

Parameters
objthe object to restore
datathe json string

◆ saveFileDialog() [1/2]

str coat.io.saveFileDialog (   extensions = str)

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

◆ saveFileDialog() [2/2]

bool coat.io.saveFileDialog (   extensions = str,
  fileName = Any 
)

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

◆ setWindowTitle()

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

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 ( )

Show the python console.

◆ snappedCursorPos()

vec2 coat.io.snappedCursorPos ( )

returns the snapped cursor position

Returns
the 2d vector

◆ step()

coat.io.step (   count = int)

perform rendering cycles

Parameters
countamount of cycles

◆ strFromFile()

str coat.io.strFromFile (   filename = str)

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 (   text = str,
  filename = str 
)

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 ( )

returns the currently supported mesh export formats

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

◆ supportedMeshesFormats()

str coat.io.supportedMeshesFormats ( )

returns the list of supported images formats

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

◆ toFullPathInDataFolder() [1/2]

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.

Parameters
paththe path
Returns
the fill path in documents

◆ toFullPathInDataFolder() [2/2]

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.

Parameters
paththe path
Returns
the fill path in documents

◆ toFullPathInInstallFolder() [1/2]

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.

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

◆ toFullPathInInstallFolder() [2/2]

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.

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

◆ toJson()

str coat.io.toJson (   obj = Any,
  filename = str 
)

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

◆ wholeScreen()

rect coat.io.wholeScreen ( )

get the whole screen rectangle

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

◆ workArea()

rect coat.io.workArea ( )

get the work area rectangle

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

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