cPy.CoreAPI module

Contents

cPy.CoreAPI module#

class BoolOpType(value)[source]#

Bases: Enum

Boolean operations type
BOOL_MERGE = -1#
BOOL_ADD = 0#
BOOL_SUBTRACT = 1#
BOOL_INTERSECT = 2#
start_main_menu(id: str)[source]#
strat the main menu root items, this command may be called only from the menu making script
Parameters:

id (str) – the menu id, see examples in the UserPrefs/Rooms/menu.py or cpp

menu_item(id: str)[source]#
add the item to the menu, this command may be called only from the menu making script
Parameters:

id (str) – the item id, see examples in the UserPrefs/Rooms/menu.py or cpp. If you want to trigger some script by this menu item

you may use ‘$execute:path/to/your/script.py’ as the id.

Expand for references to cPy.CoreAPI.menu_item

menu_info(id: str)[source]#
add the information item to the menu (without any action, just message), this command may be called only from the menu making script
Parameters:

id (str) – the item text identifier

menu_submenu(id: str)[source]#
add the submenu to the current menu, this command may be called only from the menu making script
Parameters:

id (str) – the submenu id/text

Returns:

always True, just for structuring the script

menu_exit()[source]#
finish the current submenu, this command may be called only from the menu making script
menu_separator()[source]#
add the separator to the current menu, this command may be called only from the menu making script
menu_hotkey(id: str, Shift: int, Ctrl: int, Alt: int)[source]#
set the hotkey for the menu item, this command may be called only from the menu making script
Parameters:
  • id (str) – the item id, see examples in the UserPrefs/Rooms/menu.py or cpp

  • Shift (int) – set true if Shift should be pressed

  • Ctrl (int) – set true if Ctrl should be pressed

  • Alt (int) – set true if Alt should be pressed

Expand for references to cPy.CoreAPI.menu_hotkey

menu_no_hotkey(id: str, Shift: int, Ctrl: int, Alt: int)[source]#
Don’t allow this hotkey for this action
iconic_submenu(id: str, size: int)[source]#
start the menu that will be shown on the icon click, like the navigation menu
Parameters:
  • id (str) – the text identifier

  • size (int) – the size of the icon

Returns:

always True to structure the script

is_new_scene()[source]#
is the scene new/empty?
Returns:

True if empty

is_steam_app()[source]#
is it steam app?
Returns:

True if it is

is_medical()[source]#
check if the app is medical
Returns:

True if it is

is_ppp()[source]#
chack if there are any ppp objects in scene
Returns:

True if there are

is_proxy()[source]#
check if current sculpt object is in proxy mode
Returns:

True if it is

is_multires()[source]#
check if the current sculpt object is on some multiresolution level
Returns:

True if it is

is_surface()[source]#
check if the current sculpt object is in surface mode
Returns:

True if it is

IsInRoom(name: str)[source]#
check if you are in some room
Parameters:

name (str) – the room name

Returns:

True if you are in that room

RoomExists(name: str)[source]#
check if the room exists
Parameters:

name (str) – the room name/identifier

Returns:

True if the room exists

CheckIfExists(path: str)[source]#
check if the file exists
Parameters:

path (str) – the file path, full or relative to Coat’s documents

Returns:

True if exists

UseRecordScript()[source]#
check is scripts recording available
Returns:

True if available

is_mv()[source]#
check if mv objects available in scene
Returns:

True if available

is_ptex()[source]#
check if ptex is used in the current scene
Returns:

True if used

show_rmb_panel()[source]#
show the rmb panel
show_space_panel(Subset: str, NumColumns: int)[source]#
show the space panel (with limitations if need)
Parameters:
  • Subset (str) – the subset, if need

  • NumColumns (int) – amount of columns

gltf_support()[source]#
gltf export supported
Returns:

True if supported

tex_approach()[source]#
returns the texturing approach index (from the Textures menu)
Returns:

the index

menu_insert_extensions(id: str)[source]#
insert extension into the main menu (may be called only from the menu making script)
Parameters:

id (str) – the extension id

extensions_main_menu()[source]#
insert extension menu into the main menu
insert_extensions()[source]#
insert extensions into the toolset (may be used only from the toolset.py)
set_space_panel_columns_count(num: int)[source]#
set the space panel columns count (only for the toolset.py)
Parameters:

num (int) – amount of columns

SetAutoSnapDefaults(value: bool)[source]#
set the default value for auto-snapping, usually for the retopo/modeling rooms (in toolset.py)
Parameters:

value (bool) – the default value

menu_property(id: str)[source]#
returns boolean property value
Parameters:

id (str) – the property id, available values: RMBObjectInCache, RMBObjectIsSurface, ObjectHasNodes, IsCurvePrimitive, IsCurveClosed, OverSculptObject

Returns:

the property value

tools_section(id: str)[source]#
start the tools section in the toolset.py
Parameters:

id (str) – the section id

tools_item(id: str)[source]#
add the item to the tools section (toolset.py)
Parameters:

id (str) – the tool identifier

Expand for references to cPy.CoreAPI.tools_item

page_suffix(suffix: str)[source]#
set the additional suffix for the page in the toolset.py
Parameters:

suffix (str) – usually “S” or “V”

default_tool(tool: str)[source]#
set the default tool for the toolset.py
Parameters:

tool (str) – the tool identifier

IsDebug()[source]#
is Debug mode (for developers only)
Returns:

True if debug

start_rmb_panel()[source]#
start the RNB panel. This command may be called only from the RMB response making script (curves.py, rmb.py)
menu_sort()[source]#
sort items in the current menu
IsRecordScript()[source]#
is the script recording enabled?
Returns:

True if enabled

IsInTool(ToolID: str)[source]#
check if we are in some tool
Parameters:

ToolID (str) – the tool identifier

Returns:

True if in that tool

voxtree_item_picked()[source]#
check if the VoxTree item is picked
Returns:

true if picked

retopo_object_picked()[source]#
the retopo object is picked
Returns:

True if picked

empty_space_picked()[source]#
check if no object is picked
Returns:

True if no object is picked

voxtree_object_picked()[source]#
check if the sculpt object is picked in the viewport
Returns:

True if picked

GetCurrentToolSubmode(id: str)[source]#
get the current tool submode (usually for the uv/retopo tools)
Parameters:

id (str) – the submode identifier

Returns:

the value

tools_comment(id: str)[source]#
comment in toolset.py for auto-documentation (legacy)
Parameters:

id (str) – the text of the comment

doc_mode()[source]#
check if script is in auto-documenting mode (legacy)
Returns:

the state

PureIconic()[source]#
enable the radial menu mode for the space panel
lock_ui_changes()[source]#
check if UI changes locked (for specialized applications, like printing)
Returns:

the lock state

ue5_support()[source]#
returns if ue5 support enabled
Returns:

True if enabled

run_extension(extension_name: str, auto_start: bool = False)[source]#
run extension
class ClusterScale(value)[source]#

Bases: Enum

the parameters to be used for cluster scaling in Model, scaleSelectedFacesClusters
Uniform_Scaling = 0#
Axial_Normal = 1#
Axial_X = 2#
Axial_Y = 3#
Axial_Z = 4#
Radial_Normal = 5#
Radial_X = 6#
Radial_Y = 7#
Radial_Z = 8#
class Mesh(m: any)[source]#

Bases: object

The mesh reference
MakeCopy() Mesh[source]#
Read(name: str) bool[source]#
Load the mesh from the file.
Parameters:

name (str) – the filename. May contain full path or relative to the coat’s install or documents folder.

Returns:

true if successful.

Return type:

bool

Write(name: str) bool[source]#
Save the mesh to file
Parameters:

name (str) – Full or relative path

Returns:

true if successful

Return type:

bool

valid() bool[source]#
Check if mesh is valid
Returns:

true if mesh is valid

Return type:

bool

clear()[source]#
clear the mesh
addTransformed(m: Mesh, t: any)[source]#
concatenate the transformed mesh with the current one
Parameters:
  • m (Mesh) – the mesh

  • t – the transform

boolean(m: Mesh, op: BoolOpType)[source]#
boolean operation
Parameters:

m (Mesh) – the mesh to operate

transform(transform: any)[source]#
transform the mesh
Parameters:

transform – the transformation matrix

rotateToXYAxis(axisX: any, axisY: any)[source]#
rotate the mesh so that X axis will be aligned with axisX, Y axis will be aligned with axisY
Parameters:
  • axisX – the new X axis

  • axisY – the new Y axis

rotateToYZAxis(axisY: any, axisZ: any)[source]#
rotate the mesh so that Y axis will be aligned with axisY, Z axis will be aligned with axisZ
Parameters:
  • axisY – the new Y axis

  • axisZ – the new Z axis

rotateToZXAxis(axisZ: any, axisX: any)[source]#
rotate the mesh so that Z axis will be aligned with axisZ, X axis will be aligned with axisX
Parameters:
  • axisZ – the new Z axis

  • axisX – the new X axis

vertsCount() int[source]#
returns the amount of verts in the mesh
Returns:

the amount

Return type:

int

vertsUvCount() int[source]#
returns the amount of UV - verts in the mesh
Returns:

the amount

Return type:

int

vertsNormalCount() int[source]#
returns the amount of normal - verts in the mesh
Returns:

teh amount

Return type:

int

facesCount() int[source]#
returns the faces amount
Returns:

the amount

Return type:

int

getVertex(idx: int) any[source]#
get the vertex coordinate
Parameters:

idx (int) – the vertex index

Returns:

the coordinate

Return type:

any

setVertex(idx: int, v: any)[source]#
set the vertex coordinate
Parameters:
  • idx (int) – the vertex index

  • v – the coordinate

createNewVertex(position: any) int[source]#
create the positional vertex
Parameters:

position – the position

Returns:

the positional vertex index

Return type:

int

getVertexUV(idx: int) any[source]#
get the UV coordinate of the vertex, pay attention position verts and UV verts are different, they have different indices
Parameters:

idx (int) – the UV vertex index, [0..vertsUvCount() - 1]

Returns:

the UV coordinate

Return type:

any

setVertexUV(idx: int, v: any)[source]#
set the UV coordinate of the vertex, pay attention position verts and UV verts are different, they have different indices
Parameters:
  • idx (int) – the UV vrertex index, [0..vertsUvCount() - 1]

  • v – the UV coordinate

createNewUvVertex(uv: any) int[source]#
create new UV vertex to be used for faces
Parameters:

uv – the texture coordinates

Returns:

the index

Return type:

int

getVertexNormal(idx: int) any[source]#
get the normal of the vertex, pay attention position verts and normal verts are different, they have different indices
Parameters:

idx (int) – the normal vertex index, [0..vertsNormalCount() - 1]

Returns:

the normal

Return type:

any

setVertexNormal(idx: int, v: any)[source]#
set the normal of the vertex, pay attention position verts and normal verts are different, they have different indices
Parameters:
  • idx (int) – the normal vertex index, [0..vertsNormalCount() - 1]

  • v – the normal

calcNormals()[source]#
re-calculate normals over the mesh
calcNormalsIgnoreSharpEdges()[source]#
re-calculate normals over the mesh, ignore the sharp edges
getFaceVertsCount(face: int) int[source]#
get the amount of vertices over the face
Parameters:

face (int) – the face index, should be in [0..facesCount() - 1]

Returns:

the verts amount

Return type:

int

getFaceUvVertsCount(face: int) int[source]#
get the amount of UV vertices over the face
Parameters:

face (int) – the face index

Returns:

amount of vertices over the face, 0 if UV-s not assigned

Return type:

int

getFaceVertex(faceIndex: int, faceVertexIndex: int) int[source]#
get the positional vertex index over the face
Parameters:
  • faceIndex (int) – the face index, should be in [0..facesCount() - 1]

  • faceVertexIndex (int) – the index of the vertex within the face, should be in [0..getFaceVertsCount(faceIndex) - 1]

Returns:

the positional vertex index

Return type:

int

getFaceVerts(face: int) list[int][source]#
get the list of UV vertex indices over the face, pay attention UV vertices are not same as position vertices
Parameters:

face (int) – the face index

Returns:

the list of vertex indices

Return type:

list[int]

setFaceVerts(face: int, vertices: list[int])[source]#
set the list of positional vertex indices over the face
Parameters:
  • face (int) – the face index

  • vertices (list[int]) – the list of vertex indices

getFaceUvVertex(faceIndex: int, faceVertexIndex: int) int[source]#
get the UV vertex index over the face
Parameters:
  • faceIndex (int) – the face index, should be in [0..facesCount() - 1]

  • faceVertexIndex (int) – the index of the vertex within the face, should be in [0..getFaceVertsCount(faceIndex) - 1]

Returns:

the UV vertex index, -1 if no UVs over the face

Return type:

int

setFaceUvVertex(faceIndex: int, faceVertexIndex: int, uvVertexIndex: int)[source]#
set the UV vertex index over the face
Parameters:
  • faceIndex (int) – the face index, should be in [0..facesCount() - 1]

  • faceVertexIndex (int) – the index of the vertex within the face, should be in [0..getFaceVertsCount(faceIndex) - 1]

  • uvVertexIndex (int) – the UV vertex index, should be in [0..vertsUvCount() - 1]

getFaceNormalVertex(faceIndex: int, faceVertexIndex: int) int[source]#
get the normal vertex index over the face
Parameters:
  • faceIndex (int) – the face index, should be in [0..facesCount() - 1]

  • faceVertexIndex (int) – the index of the vertex within the face, should be in [0..getFaceVertsCount(faceIndex) - 1]

Returns:

the normal vertex index, -1 if no normals over the face

Return type:

int

setFaceNormalVertex(faceIndex: int, faceVertexIndex: int, normalVertexIndex: int)[source]#
set the normal vertex index over the face
Parameters:
  • faceIndex (int) – the face index, should be in [0..facesCount() - 1]

  • faceVertexIndex (int) – the index of the vertex within the face, should be in [0..getFaceVertsCount(faceIndex) - 1]

  • normalVertexIndex (int) – the normal vertex index, should be in [0..vertsNormalCount() - 1]

getFaceUvVerts(face: int) list[int][source]#
get the list of UV vertices indices over the face
Parameters:

face (int) – the face index

Returns:

the list of UV vertices indices

Return type:

list[int]

getFaceObject(faceIndex: int) int[source]#
get the object index over the face, see the getObjectsCount(), getObjectName()
Parameters:

faceIndex (int) – the face index, should be in [0..facesCount() - 1]

Returns:

the object index

Return type:

int

setFaceObject(faceIndex: int, objectIndex: int)[source]#
set the object index for the face, see the getObjectsCount(), getObjectName()
Parameters:
  • faceIndex (int) – the face index, should be in [0..facesCount() - 1]

  • objectIndex (int) – the object index to set for the face

getFaceMaterial(faceIndex: int) int[source]#
get the material index over the face, see the getMaterialsCount(), getMaterialName()
Parameters:

faceIndex (int) – the face index, should be in [0..facesCount() - 1]

Returns:

the material index

Return type:

int

setFaceMaterial(faceIndex: int, materialIndex: int)[source]#
set the material index over the face, see the getMaterialsCount(), getMaterialName()
Parameters:
  • faceIndex (int) – the face index, should be in [0..facesCount() - 1]

  • materialIndex (int) – the material index to set for the face

getObjectsCount() int[source]#
returns the objects count in the mesh
Returns:

the count

Return type:

int

getObjectName(idx: int) str[source]#
get the name of the object
Parameters:

idx (int) – the object index

Returns:

the name

Return type:

str

setObjectName(idx: int, name: str)[source]#
set object name
Parameters:
  • idx (int) – the object index

  • name (str) – the new name

removeObject(idx: int)[source]#
remove object from the mesh
Parameters:

idx (int) – the object index

unifyAllObjects(name: str = '')[source]#
unify all objects in the mesh, i.e. make one object
Parameters:

name (str) – the name of the new object, if empty, the name of the first object will be used

getMaterialsCount() int[source]#
get the materials count in the mesh
Returns:

the count

Return type:

int

removeMaterial(idx: int)[source]#
remove the material (and corresponding faces) from the mesh
Parameters:

idx (int) – the material index

getMaterialName(idx: int) str[source]#
get the name of the material
Parameters:

idx (int) – the material index

Returns:

the name

Return type:

str

setMaterialName(idx: int, name: str)[source]#
set material name
Parameters:
  • idx (int) – the material index

  • name (str) – the new name

getMaterialTexture(idx: int, texture_layer: int) str[source]#
get the texture name of the material
Parameters:
  • idx (int) – the material index

  • texture_layer (int) – the texture layer, 0 - color, 1 - gloss, 2 - bump/displacement, 3 - normalmap, 4 - specular color, 5 - emossive (color), 6 - emissive power

Returns:

the texture path (full or relative to 3DCoat documents folder)

Return type:

str

setMaterialTexture(idx: int, texture_layer: int, texture_path: str)[source]#
set the texture layer filename of the material
Parameters:
  • idx (int) – the material index

  • texture_layer (int) – the texture layer, 0 - color, 1 - gloss, 2 - bump/displacement, 3 - normalmap, 4 - specular color, 5 - emossive (color), 6 - emissive power

  • texture_path (str) – the texture path (full or relative to 3DCoat documents folder)

fromVolume(v: any, with_subtree: bool = False, all_selected: bool = False)[source]#
extract the mesh from the volume
Parameters:
  • v – the source volume

  • with_subtree (bool) – if true, the subtree will be extracted, otherwise the single volume taken

  • all_selected (bool) – if true, all selected volumes will be extracted, otherwise only the current volume

fromReducedVolume(v: any, reduction_percent: float, with_subtree: bool = False, all_selected: bool = False)[source]#
extract the mesh from the volume and reduce it by the given percent
Parameters:
  • v – the source volume

  • reduction_percent (float) – 0 means no reduction, 100 means 100% reduction, i.e. the mesh will be reduced to a single triangle

  • with_subtree (bool) – if true, the subtree will be extracted, otherwise the single volume taken

  • all_selected (bool) – if true, all selected volumes will be extracted, otherwise only the current volume

fromVolumeWithMaxPolycount(v: any, max_polycount: int, with_subtree: bool = False, all_selected: bool = False)[source]#
extract the mesh from the volume and reduce to the given polycount
Parameters:
  • v – the source volume

  • max_polycount (int) – the required polycount

  • with_subtree (bool) – if true, the subtree will be extracted, otherwise the single volume taken

  • all_selected (bool) – if true, all selected volumes will be extracted, otherwise only the current volume

toVolume(v: any, transform: any = 4, op: BoolOpType = BoolOpType.BOOL_MERGE)[source]#
merge this mesh to the volume object
Parameters:
  • v – the destination volume

  • transform – the applied transformation

  • op (BoolOpType) – the boolean operation to be performed, -1 means no operation, raw merge, 0 - 1, 1 - subtract, 2 - intersect

insertInVolume(v: any, transform: any = 4)[source]#
insert without boolean operation, if the volume is not in surface mode (volumetric) the boolean ADD will be performed anyway
Parameters:
  • v – the destination volume

  • transform – the transform

addToVolume(v: any, transform: any = 4)[source]#
boolean add to volume
Parameters:
  • v – the destination volume

  • transform – the transform

subtractFromVolume(v: any, transform: any = 4)[source]#
boolean subtraction of the mesh from the volume
Parameters:
  • v – the destination volume

  • transform – the transform

intersectWithVolume(v: any, transform: any = 4)[source]#
boolean intersection of the mesh with the volume
Parameters:
  • v – the destination volume

  • transform – the transform

fromRetopo()[source]#
take the whole mesh from the retopo room
fromPaintRoom()[source]#
get the mesh from the paint room
reduceToPolycount(destination_triangles_count: int)[source]#
reduce the mesh to the given polycount, mesh will be triangulated
Parameters:

destination_triangles_count (int) – the required triangles count, if it is above the existing, nothing happens

triangulate()[source]#
triangulate the mesh
booleanOp(With: Mesh, op: BoolOpType)[source]#
Perform the boolean operation with the given mesh
Parameters:
  • With (Mesh) – the mesh to perform the operation with over the current mesh

  • op (BoolOpType) – the operation, see BoolOpType (-1 means no operation, 0 - add, 1 - subtract, 2 - intersect)

getMeshVertices() list[vec3][source]#
get the list of all positional vertices of the mesh
Returns:

the list of vec3

Return type:

list[vec3]

getMeshNormals() list[vec3][source]#
get the list of all normal vertices of the mesh
Returns:

the list of vec3

Return type:

list[vec3]

getMeshUVs() list[vec2][source]#
get the list of all UV vertices of the mesh
Returns:

the list of vec2

Return type:

list[vec2]

setMeshVertices(positions: list[vec3])[source]#
set the list of all positional vertices for the mesh
Parameters:

positions (list[vec3]) – the list of positions

setMeshNormals(normals: list[vec3])[source]#
set the list of all normal vertices for the mesh
Parameters:

normals (list[vec3]) – the list of normals (vec3)

setMeshUVs(uvs: list[vec2])[source]#
set the list of all UV vertices for the mesh
Parameters:

uvs (list[vec2]) – the list of UVs (vec2)

setMeshFaces(faces: list[int])[source]#
set the complete list of faces for the mesh
Parameters:

faces (list[int]) – the format of faces is:

amount_ot_vets_in_face1, vertex1_face1, vertex2_face1…vertexN-1_face1,
amount_ot_vets_in_face2, vertex1_face2, vertex2_face2…

addMeshVertices(positions: list[vec3])[source]#
add the list of all positional vertices for the mesh
Parameters:

positions (list[vec3]) – the list of positions

addMeshNormals(normals: list[vec3])[source]#
add the list of all normal vertices for the mesh
Parameters:

normals (list[vec3]) – the list of normals (vec3)

addMeshUVs(uvs: list[vec2])[source]#
add the list of all UV vertices for the mesh
Parameters:

uvs (list[vec2]) – the list of UVs (vec2)

addMeshFaces(faces: list[int])[source]#
add the list of faces for the mesh, pay attention, all vertex indices are global over the whole mesh!
Parameters:

faces (list[int]) – the format of faces is:

amount_ot_vets_in_face1, vertex1_face1, vertex2_face1…vertexN-1_face1,
amount_ot_vets_in_face2, vertex1_face2, vertex2_face2…

clearVerts()[source]#
clear all positional vertices of the mesh
clearUvVerts()[source]#
clear all uv vertices of the mesh
clearNormals()[source]#
clear all normal vertices of the mesh
clearFaces()[source]#
clear all faces of the mesh
removeFaces(faces: list[int])[source]#
remove the set of vertices from the mesh
Parameters:

faces (list[int]) – the list of faces indices to remove

clearObject()[source]#
clear all objects
clearMaterials()[source]#
clear all materials
ensureMaterialsAndObjectsExist()[source]#
ensure that at least one material and one object exist in the mesh
addObject(name: str) int[source]#
add the named object
Parameters:

name (str) – the name for the object

Returns:

the index of new object in the objects list

Return type:

int

addMaterial(name: str) int[source]#
add the named material
Parameters:

name (str) – the name for the material

Returns:

the index of new material in the materials list

Return type:

int

removeUnusedObjectsAndMaterials()[source]#
remove all unused objects and materials
removeUnusedVerts()[source]#
remove all unused vertices
removeUnusedFaces()[source]#
remove all faces that contain zero vertices
cutByPlane(start: any, NormalDirection: any)[source]#
Cut off the mesh by the plane, the result is stored in the current mesh, the part of the mesh that is on the side of the negative normal direction is removed
Parameters:
  • start – the start point of the plane

  • NormalDirection – the normal direction of the plane

cutByDistortedPlane(start: any, NormalDirection: any, noise_degree: float, noise_scale: float, seed: int = 0)[source]#
Cut off the mesh by the distorted plane (using the Perlin noise), the result is stored in the current mesh, the part of the mesh that is on the side of the negative normal direction is removed
Parameters:
  • start – the start point of the plane

  • NormalDirection – the normal direction of the plane

  • noise_degree (float) – the degree of the noise

  • noise_scale (float) – the scale of the noise

  • seed (int) – the seed for the noise

distortByPerlinNoise(noise_degree: float, noise_scale: float, anisotropic: bool = False, seed: int = 0)[source]#
distort the mesh by the Perlin noise
Parameters:
  • noise_degree (float) – the degree of the noise

  • noise_scale (float) – the scale of the noise

  • anisotropic (bool) – if false, the noise will be applied in the direction of the normals, othervice the noise directed in random direction regardless the normals

  • seed (int) – the seed for the noise

splitDisconnectedParts() list[Mesh][source]#
split the mesh into disconnected parts
Returns:

the list of meshes

Return type:

list[Mesh]

symmetry(start: any, NormalDirection: any, resultInQuads: bool)[source]#
apply symmetry to the mesh
Parameters:
  • start – the start point of the plane

  • NormalDirection – the negative part (regarding the plane normal) of the mesh is removed, replaced with positive part

  • resultInQuads (bool) – the cut faces will produce quads instead of triangles

autodetectSymmetryPlanes() list[cPlane][source]#
Detect the symmetry planes of the mesh
Returns:

the list of planes

Return type:

list[cPy.cTypes.cPlane]

weld(minimal_relative_distance: float = 0.0001)[source]#
weld the mesh, remove all vertices that are closer than minimal_relative_distance*mesh_bound_box_diagonal to each other
Parameters:

minimal_relative_distance (float) – the minimal distance between vertices, relative to the mesh bound box diagonal

getBounds() any[source]#
get the mesh bound box
Returns:

the bound box

Return type:

any

getVolume() float[source]#
get the volume of the mesh
Returns:

the volume

Return type:

float

getOpenSurfaceVolume(start: any, dir: any) float[source]#
calculate the volume even if the mesh is not closed, in this case we define plane that limits the integration
Parameters:
  • start – the point on that plane

  • dir – the normalized vector, normal to the plane

Returns:

the volume

Return type:

float

getSquare() float[source]#
get square of the mesh
Returns:

the square (area)

Return type:

float

getFaceSquare(face: int) float[source]#
get the squareof the face
Parameters:

face (int) – the face index

Returns:

the square

Return type:

float

getFaceUVSquare(face: int) float[source]#
get the face square in UV space
Parameters:

face (int) – the face index

Returns:

the square

Return type:

float

getFaceNormal(face: int) any[source]#
get the face normal
Parameters:

face (int) – the face index

Returns:

the face normal

Return type:

any

relax(degree: float, tangent: bool, crease_angle: float = 180)[source]#
relax the mesh, keep the vertices count
Parameters:
  • degree (float) – the degree of relax, may be > 1

  • tangent (bool) – should be tangent relax

  • crease_angle (float) – the crease angle between faces (degrees), if the angle between faces is less than crease_angle, the edge relaxed

static box(center: any = 3, size: any = 3, xAxis: any = 3, yAxis: any = 3, zAxis: any = 3, detail_size: float = 1, fillet: float = 0.0, nx: int = 0, ny: int = 0, nz: int = 0) Mesh[source]#
create the box mesh
Parameters:
  • center – the box center

  • size – the box size

  • xAxis – the x-axis direction, if zero, the x-axis is default - (1,0,0)

  • yAxis – the y-axis direction, if zero, the y-axis is default - (0,1,0)

  • zAxis – the z-axis direction, if zero, the z-axis is default - (0,0,1)

  • detail_size (float) – the average length of the edge over the figure. The figure will be divided so that edges length will be approximately the detail_size

  • fillet (float) – the fillet radius

  • nx (int) – the number of segments along the x-axis (if all of nx, ny, nz are above zero, it overrides the detail_size)

  • ny (int) – the number of segments along the y-axis (if all of nx, ny, nz are above zero, it overrides the detail_size)

  • nz (int) – the number of segments along the z-axis (if all of nx, ny, nz are above zero, it overrides the detail_size)

Returns:

the box mesh

Return type:

Mesh

static sphere(center: any = 3, radius: float = 1.0, detail_size: float = 1) Mesh[source]#
create the sphere mesh
Parameters:
  • center – the sphere center

  • radius (float) – the sphere radius

  • detail_size (float) – the average length of the edge over the figure. The figure will be divided so that edges length will be approximately the detail_size

Returns:

the sphere mesh

Return type:

Mesh

static cylinder(center: any = 3, radius: float = 1, height: float = 2, detail_size: float = 1, slices: int = 0, caps: int = 0, rings: int = 0, fillet: float = 0) Mesh[source]#
create the cylinder mesh
Parameters:
  • center – the center of the cylinder

  • radius (float) – the radius of the cylinder

  • height (float) – the height of the cylinder

  • detail_size (float) – the average length of the edge over the figure. The figure will be divided so that edges length will be approximately the detail_size

  • slices (int) – the number of slices, it overrides the detail_size if all of slices, caps, rings are above zero

  • caps (int) – the number of caps, it overrides the detail_size if all of slices, caps, rings are above zero

  • rings (int) – the number of rings, it overrides the detail_size if all of slices, caps, rings are above zero

  • fillet (float) – the fillet radius

Returns:

the cylinder mesh

Return type:

Mesh

static cone(center: any = 3, radius: float = 1, height: float = 2, detail_size: float = 1, topAxis: any = 3) Mesh[source]#
create the cone mesh
Parameters:
  • center – the center of the cone (the cone base center)

  • radius (float) – the cone radius

  • height (float) – the cone height

  • detail_size (float) – the average length of the edge over the figure. The figure will be divided so that edges length will be approximately the detail_size

  • topAxis – the top axis direction, if zero, the top axis is default - (0,1,0)

Returns:

the cone mesh

Return type:

Mesh

static gear(center: any = 3, topR: float = 1, bottomR: float = 1, height: float = 2, detail_size: float = 1, depth: float = 0.1, sharpness: float = 0.5, teeth: int = 16) Mesh[source]#
create the gear mesh
Parameters:
  • center – the center of the gear (the gear base center)

  • topR (float) – the gear top radius

  • bottomR (float) – the gear bottom radius

  • height (float) – the gear height

  • detail_size (float) – the average length of the edge over the figure. The figure will be divided so that edges length will be approximately the detail_size

  • depth (float) – the gear depth

  • sharpness (float) – the gear sharpness

  • teeth (int) – the gear teeth

Returns:

the cone mesh

Return type:

Mesh

static plane(center: any = 3, sizeX: float = 2, sizeY: float = 2, divisionsX: int = 2, divisionsY: int = 2, xAxis: any = 3, yAxis: any = 3) Mesh[source]#
create the single-side plane mesh, the faces normals are put toward the vec3.Cross(xAxis, yAxis)
Parameters:
  • center – the center of the plane

  • sizeX (float) – the plane size along the X-axis

  • sizeY (float) – the plane size along the Y-axis

  • divisionsX (int) – amount of divisions along the X-axis

  • divisionsY (int) – amount of divisions along the Y-axis

  • xAxis – the vector of the X-axis

  • yAxis – the vector of the Y-axis

Returns:

the plane mesh

Return type:

Mesh

static hexagonal_plane(center: any = 3, sizeX: float = 2, sizeY: float = 2, divisionsX: int = 2, divisionsY: int = 2, xAxis: any = 3, yAxis: any = 3) Mesh[source]#
create the single-side triangular plane mesh that consists mostly of quasi equally-sided triangles
Parameters:
  • center – the center of the plane

  • sizeX (float) – the plane size along the X-axis

  • sizeY (float) – the plane size along the Y-axis

  • divisionsX (int) – amount of divisions along the X-axis

  • divisionsY (int) – amount of divisions along the Y-axis

  • xAxis – the vector of the X-axis

  • yAxis – the vector of the Y-axis

Returns:

the hexagonal plane mesh

Return type:

Mesh

static text(string: str, font: str = 'tahoma', height: float = 10.0, center: any = 3, text_direction: any = 3, text_normal: any = 3, thickness: float = 1, align: int = 1) Mesh[source]#
Create the text mesh
Parameters:
  • string (str) – the text string

  • font (str) – the font name

  • height (float) – the text height

  • center – the text center

  • text_direction – the text direction left to right

  • text_normal – the normal direction of the text

  • thickness (float) – the thickness of the text

  • align (int) – the text align, 0 - left, 1 - center, 2 - right

Returns:

the text mesh

Return type:

Mesh

createVDM(side: int, path_to_exr: str, center: any = 3, radius: float = 1, up: any = 3, x: any = 3, y: any = 3)[source]#
Create the vector displacement map from the mesh and save it as EXR file. The mesh is put on plane at center and clamped by that plane.
Parameters:
  • side (int) – the EXR file side size

  • path_to_exr (str) – the path to the EXR file

  • center – the center of the plane

  • radius (float) – the radius that should include the mesh

  • up – the up vector of the plane

  • x – the x vector of the plane

  • y – the y vector of the plane

shell(thickness_out: float, thickness_in: float, divisions: int = 1)[source]#
add some thickness to the mesh (intrude a bit)
Parameters:
  • thickness_out (float) – the thickness in the outer direction (extrusion)

  • thickness_in (float) – the thickness in the inner direction (intrusion)

  • divisions (int) – the amount of divisions of the edge

extrudeOpenEdges(distance: float, direction: any = 3) list[int][source]#
extrude open edges of the mesh
Parameters:
  • distance (float) – the distance to extrude

  • direction – the extrude direction, if zero , the direction is the local vertex normal

Returns:

s the list of extruded edges, even is the start vertex, odd is the end vertex

Return type:

list[int]

expandOpenEdges(distance: float) list[int][source]#
extrude open edges of the mesh
Parameters:

distance (float) – the distance to extrude

Returns:

s the list of extruded edges, even is the start vertex, odd is the end vertex

Return type:

list[int]

getOpenEdges() list[int][source]#
get the list of open edges
Returns:

the list of open edges, the even is the start vertex, the odd is the end vertex

Return type:

list[int]

getLengthAlongDirection(dir: any) float[source]#
get the mesh size along some axis
Parameters:

dir – the axis direction

Returns:

the size along the axis

Return type:

float

getCenterMass() any[source]#
calculate the center mass of the mesh
Returns:

the center mass of the surface

Return type:

any

class Image(im: Image)[source]#

Bases: object

The image references. Look the cImage for the list of allowed operations
Read(name: str) bool[source]#
Read the image from the file
Parameters:

name (str) – the image name

Returns:

true if loaded successfully

Return type:

bool

Write(name: str) bool[source]#
Write the image to file
Parameters:

name (str) – the filename

Returns:

true if succeed

Return type:

bool

FromTexture(texture_id: int) bool[source]#
Get image from texture
Returns:

true if succeed

Return type:

bool

ToTexture() int[source]#
Create texture from image
Returns:

true if succeed

Return type:

int

Paste(src_data: any, pasteLeft: int = 0, pasteTop: int = 0, cropLeft: int = 0, cropTop: int = 0, cropRight: int = 0, cropBottom: int = 0, flipY: bool = False) int[source]#
paste image to image
Returns:

true if succeed

Return type:

int

Pointer() int[source]#
Pointer to the data
Returns:

true if succeed

Return type:

int

FromArray(src_data: any) bool[source]#
static cImageFromArray(src_data: any, image: any) bool[source]#
class symm[source]#

Bases: object

static enable(_0: bool = True) symm[source]#
Enable the symmetry
Parameters:

_enable (bool) – true to enable, false to disable

Returns:

reference for the chain-like operations

Return type:

symm

static enabled() bool[source]#
static disable() symm[source]#
disable the symmetry
Returns:

reference

Return type:

symm

static xyz(x: bool, y: bool, z: bool) symm[source]#
Enable the XYZ-mirror symmetry
Parameters:
  • x (bool) – true to enable x-symmetry, false to disable

  • y (bool) – true to enable y-symmetry, false to disable

  • z (bool) – true to enable z-symmetry, false to disable

Returns:

reference

Return type:

symm

static is_xyz() bool[source]#
check if the XYZ symmetry enabled
Returns:

true if this type of the symmetry active

Return type:

bool

static x() bool[source]#
check x symmetry state
Returns:

reference to the x symmetry state

Return type:

bool

static y() bool[source]#
check y symmetry state
Returns:

reference to the y symmetry state

Return type:

bool

static z() bool[source]#
check z symmetry state
Returns:

reference to the z symmetry state

Return type:

bool

static axial(n: int, extraMirror: bool = False, stepSymmetry: bool = False) symm[source]#
Enable the axial symmetry
Parameters:
  • n (int) – the order of the axial symmetry

  • extraMirror (bool) – add the extra mirror orthogonal to the axis

  • stepSymmetry (bool) – enable the step symmetry

Returns:

reference

Return type:

symm

static is_axial() bool[source]#
Check if the axial symmetry enabled
Returns:

true if the axial symmetry enabled

Return type:

bool

static axialOrder() int[source]#
returns the axial symmetry order if axial or axial mirror symmetry enabled
Returns:

the reference to the order of the axial symmetry

Return type:

int

static extraMirror() bool[source]#
returns the state of extra mirror, this is valid only tor the axial symmetry
Returns:

the reference to the extra mirror state

Return type:

bool

static stepSymmetry() bool[source]#
returns the state of step symmetry
Returns:

the reference to the step symmetry state

Return type:

bool

static axialMirror(n: int, extraMirror: bool = False, stepSymmetry: bool = False) symm[source]#
Enable the axial mirror symmetry
Parameters:
  • n (int) – the order of the symmetry

  • extraMirror (bool) – dd the extra mirror orthogonal to the axis

  • stepSymmetry (bool) – enable the step symmetry

Returns:

the reference

Return type:

symm

static isAxialMirror() bool[source]#
Check if the axial mirror symmetry enabled
Returns:

true if the axial mirror symmetry enabled

Return type:

bool

static translation(numX: int, stepX: float, numY: int, stepY: float, numZ: int, stepZ: float) symm[source]#
Enable the translation symmetry
Parameters:
  • numX (int) – number of x-repeats

  • stepX (float) – the step of the x-repeat

  • numY (int) – number of y-repeats

  • stepY (float) – the step of the y-repeat

  • numZ (int) – number of z-repeats

  • stepZ (float) – the step of the z-repeat

Returns:

the reference

Return type:

symm

static is_translation() bool[source]#
Check if the translation symmetry enabled
Returns:

the state

Return type:

bool

static numX() int[source]#
returns the reference to the number of the x repeats if the translational symmetry used
Returns:

the bool reference

Return type:

int

static stepX() float[source]#
returns the reference to the x-step if the translational symmetry used
Returns:

the value reference

Return type:

float

static numY() int[source]#
returns the reference to the number of the y repeats if the translational symmetry used
Returns:

the bool reference

Return type:

int

static stepY() float[source]#
returns the reference to the y-step if the translational symmetry used
Returns:

the value reference

Return type:

float

static numZ() int[source]#
returns the reference to the number of the z repeats if the translational symmetry used
Returns:

the bool reference

Return type:

int

static stepZ() float[source]#
returns the reference to the z-step if the translational symmetry used
Returns:

the value reference

Return type:

float

static toGlobalSpace() symm[source]#
set the symmetry to be in global space
Returns:

the reference

Return type:

symm

static toLocalSpace() symm[source]#
set the symmetry to be in local space
Returns:

the reference

Return type:

symm

static toGeneral() symm[source]#
set the symmetry to general case
Returns:

the reference

Return type:

symm

static set_start(pos: any) symm[source]#
set the central point for the symmetry
Parameters:

pos – the position (in local or global space, see the localSpace() or globalSpace())

Returns:

the reference

Return type:

symm

static start() any[source]#
get the start point reference
Returns:

the point reference

Return type:

any

static set_end(pos: any) symm[source]#
set the end point for the symmetry axis, calling this function enables the general case of the symmetry
Parameters:

pos – the position

Returns:

the reference

Return type:

symm

static end() any[source]#
the end point reference
Returns:

the point reference

Return type:

any

static showSymmetryPlane(show: bool = True) symm[source]#
Show or hide the symmetry planes
Parameters:

show (bool) – set true to show

Returns:

the reference

Return type:

symm

static setCustomSymetryTransforms(symmetryTransforms: any) symm[source]#
enable the custom symmetry, provide the symmetry transfoms
Parameters:

symmetryTransforms – the list of additional transforms (list of coat.mat4) that will be applied to the any user action

Returns:

the reference

Return type:

symm

static isCustomSymmetry() bool[source]#
Check if the custom symmetry used
Returns:

true if the custom symmetry enabled

Return type:

bool

static getCurrentTransforms() list[mat4][source]#
Returns all transforms using the current symmetry state
Returns:

the resulting list of coat.mat4

Return type:

list[mat4]

static getCurrentPlanes() list[cPlane][source]#
Returns all symmetry planes using the current symmetry state
Returns:

the resulting list of planes (coat.plane)

Return type:

list[cPy.cTypes.cPlane]

static disableGlobally()[source]#
Totally disable symmetry, don’t forget to enable after all operations!
static enableGlobally()[source]#
Enable symmetry (preliminary disabled by disableGlobally)
class SceneElement[source]#

Bases: object

The scene element, like sculpt object or curve
parent() SceneElement[source]#
get the parent scene graph element
Returns:

the parent reference

Return type:

SceneElement

childCount() int[source]#
returns the child elements count
Returns:

child count

Return type:

int

child(index: int) SceneElement[source]#
returns child element by index
Parameters:

index (int) – the index of the element in subtree

Returns:

the child reference

Return type:

SceneElement

isSculptObject() bool[source]#
Check if it is the sculpt object
Returns:

true if this is the sculpt object

Return type:

bool

isCurve() bool[source]#
Check if the element is curve
Returns:

true if this is curve

Return type:

bool

setTransform(Transform: any) SceneElement[source]#
Set the transform matrix
Parameters:

Transform – the transform matrix

Returns:

this element reference

Return type:

SceneElement

transform(Transform: any) SceneElement[source]#
Additional transform over the object
Parameters:

Transform – the matrix

Returns:

this element reference

Return type:

SceneElement

density(density_value: float) SceneElement[source]#
this command useful if you use voxels, it sets the scale for the volume so that there will be density_value of voxels per mm
Parameters:

density_value (float) – the voxels per mm

transform_single(Transform: any) SceneElement[source]#
Additional transform over the object, not applied to child objects
Parameters:

Transform – the matrix

Returns:

this element reference

Return type:

SceneElement

getTransform() any[source]#
get the scene element transform
Returns:

the transform matrix

Return type:

any

clear() SceneElement[source]#
Clear the element content
Returns:

this element reference

Return type:

SceneElement

name() str[source]#
get the element name
Returns:

the name

Return type:

str

getLinkedPath(id: int) str[source]#
get the linked file path
Returns:

the name

Return type:

str

linkedObjectCount() int[source]#
get the linked file path
Returns:

the name

Return type:

int

addLinkedPath(path: str)[source]#
set the linked file path
Returns:

the name

rename(name: str) SceneElement[source]#
rename the element
Parameters:

name (str) – the new name

Returns:

this element reference

Return type:

SceneElement

addChild(name: str) SceneElement[source]#
add the child element of the same nature
Parameters:

name (str) – the name

Returns:

the new element reference

Return type:

SceneElement

findInSubtree(name: str) SceneElement[source]#
find the element in subtree by name
Parameters:

name (str) – the name t seek

Returns:

the element reference

Return type:

SceneElement

iterateSubtree(fn: any) bool[source]#
iterate over the subtree
Parameters:

fn – the function to call, return true if need to stop the iterations,

function looks like
|         def fn(el):

…code…

return False or True
el is coat.SceneElement
Returns:

true if the callback interrupted the iterations

Return type:

bool

iterateVisibleSubtree(fn: any) bool[source]#
iterate over the visible subtree
Parameters:

fn – the function to call, return true if need to stop the iterations,

function looks like
|         def fn(el):

…code…

return False or True
el is coat.SceneElement
Returns:

True if the callback interrupted the iterations

Return type:

bool

mergeSubtree(booleanMerge: bool = False)[source]#
merge all subtree volumes into this
Parameters:

booleanMerge (bool) – use boolean summ to merge. Othervice merge meshes without booleans.

This option works only for surfave, in voxels it will always do boolean summ
mergeTo(dest: SceneElement, op: BoolOpType)[source]#
merge the volume to another one, delete this volume
Parameters:
copyMergeTo(dest: SceneElement, op: BoolOpType)[source]#
copy and merge the volume to another one, delete this volume
Parameters:
removeSubtree()[source]#
remove the whole subtree
removeSubtreeItem(index: int)[source]#
remove one child from the subtree
Parameters:

index (int) – index of the child

remove()[source]#
remove this item and all child objects from the scene
duplicate() SceneElement[source]#
diplicate the item
Returns:

the new item reference

Return type:

SceneElement

duplicateAsInstance() SceneElement[source]#
create the instance of the object if instancing supported
Returns:

the instance reference

Return type:

SceneElement

changeParent(newParent: SceneElement)[source]#
change the parent element for the current one
Parameters:

newParent (SceneElement) – the new parent reference. Pay attention, changing paren is not always possible!

moveTo(newParent: SceneElement, indexInParent: int)[source]#
move the element to another parent
Parameters:
  • newParent (SceneElement) – the new parent reference

  • indexInParent (int) – the index in the parent

isParentOf(child: SceneElement) bool[source]#
check if the element is parent of another one
Parameters:

child (SceneElement) – the child element

Returns:

true if this element is parent of the child

Return type:

bool

visible() bool[source]#
returns own visibility state reference. It does not take into account that parent may be invisible.
Returns:

item local visibility reference, you may get and set the visibility with the reference.

Return type:

bool

setVisibility(visible: bool)[source]#
set the visibility of the element
Parameters:

visible (bool) – true if need to be visible

ghost() bool[source]#
returs the state of ghosting (if available)
Returns:

true if ghosted

Return type:

bool

setGhost(ghost: bool)[source]#
sets the ghosting state (if available)
Parameters:

ghost (bool) – set true to ghost

getReferenceColor() any[source]#
get the reference color for the element
Returns:

the color (r,g,b,a), each channel is 0..1

Return type:

any

setReferenceColor(color: any)[source]#
set the reference color for the element
Parameters:

color – the (r, g, b, a) color, each channel is 0..1

Volume() any[source]#
returns the volume object to operate over voxels or surface
select()[source]#
add the object to selected
selectOne()[source]#
unselect all similar elements and select this one
unselectAll()[source]#
unselect all similar objects
selected() bool[source]#
Check if the scene element is selected
collectSelected() list[SceneElement][source]#
Collect the selected elements in the subtree (including this element if selected)
class Volume(vol: Volume)[source]#

Bases: object

The class allows to operate over voxels/surface on the relatively low-level
valid() bool[source]#
checks if object is valid
Returns:

true if the volume exists

Return type:

bool

isSurface() bool[source]#
Check if in surface mode
Returns:

true if in surface mode

Return type:

bool

isVoxelized() bool[source]#
Check if in voxel mode
Returns:

true if in voxel mode

Return type:

bool

toSurface()[source]#
turn to surface mode, the triangles will be tangentially relaxed
toVoxels()[source]#
turn to voxels, auto-voxelize
static enableVoxelsColoring(enable: bool = True)[source]#
enable or disable the voxel-based coloring. It is applied wherever possible - merging models, brushing, creating parametric voxel figures, etc
Parameters:

enable (bool) – true to enable

static color(colorid: str)[source]#
assign the color for the voxel operations
Parameters:

colorid (str) – the color in any suitable form: “RGB”, “ARGB”, “RRGGBB”, “AARRGGBB”, “#RGB”, “#ARGB”, “#RRGGBB”, “#AARRGGBB”,

any web-color common name as “red”, “green”, “purple”, google “webcolors”
static gloss(value: float)[source]#
assign the gloss for the voxel operations, it will work only if the color already assigned
Parameters:

value (float) – the [0..1] value of the gloss

static roughness(value: float)[source]#
assign the roughness for the voxel operations, it will work only if the color already assigned
Parameters:

value (float) – the [0..1] value of the roughness

static metal(value: float)[source]#
the metalliclty value for the voxel operations, it will work only if the color already assigned
Parameters:

value (float) – the [0..1] metal value

mergeMesh(mesh: Mesh, transform: any = 4, op: BoolOpType = BoolOpType.BOOL_MERGE)[source]#
merge the mesh into scene
Parameters:
  • mesh (Mesh) – the Mesh reference

  • transform – the transform applied

  • op (BoolOpType) – the type of the merge

insertMesh(mesh: Mesh, transform: any = 4)[source]#
insert the mesh into the volume, in case of voxels this is identical to addMesh, in case of surface, mesh will be inserted without booleans
Parameters:
  • mesh (Mesh) – the mesh reference

  • transform – the transform applied

addMesh(mesh: Mesh, transform: any = 4)[source]#
add the mesh to volume (boolean)
Parameters:
  • mesh (Mesh) – the mesh reference

  • transform – the transform applied

subtractMesh(mesh: Mesh, transform: any = 4)[source]#
subtract the mesh from volume (boolean)
Parameters:
  • mesh (Mesh) – the mesh reference

  • transform – the transform applied

intersectWithMesh(mesh: Mesh, transform: any = 4)[source]#
intersect the volume with the mesh (boolean)
Parameters:
  • mesh (Mesh) – the mesh reference

  • transform – the transform applied

mergeMeshWithTexture(mesh: Mesh, transform: any = 4, op: BoolOpType = BoolOpType.BOOL_MERGE)[source]#
merge the mesh with facture, the volume polygons will be hidden, just the texture will be shown (like leafs in TreesGenerator)
Parameters:
  • mesh (Mesh) – the mesh that refers texture

  • transform – the transform applied

  • op (BoolOpType) – the boolean operation

getExactDencity(x: int, y: int, z: int, fromBackup: bool, cache_ref: any) float[source]#
returns the exact voxel density in local space at the exact integer location
Parameters:
  • x (int) – X-coordinate

  • y (int) – Y-coordinate (up)

  • z (int) – Z-coordinate

  • fromBackup (bool) – take the values from the backup (kept before the modifications started)

  • cache_ref – define the variable coat::VolumeCache and pass there (in same thread) to speed up access;

Returns:

the density 0..1

Return type:

float

getInterpolatedValue(pos: any, fromBackup: bool) float[source]#
returns interolated voxels density
Parameters:
  • pos – position in local space

  • fromBackup (bool) – take from the backup

Returns:

linearly interplated value of the density

Return type:

float

getPolycount() int[source]#
get the volume triangles count
Returns:

triangles count

Return type:

int

getVolume() float[source]#
get the volume of this object in world coordinates
Returns:

volume

Return type:

float

getSquare() float[source]#
reg the square of this object in world coordinates
Returns:

square

Return type:

float

calcLocalSpaceAABB() any[source]#
Calculate the Axis - Aligned Bound Box of the object in local space
Returns:

the boundary as cBounds

Return type:

any

calcWorldSpaceAABB() any[source]#
Calculate the Axis - Aligned Bound Box of the object in world space
Returns:

the boundary as cBounds

Return type:

any

tree() any[source]#
returns the low-level object (VoxTreeBranch) for all low-level operations
Returns:

the VoxTreeBranch* pointer

Return type:

any

vo() any[source]#
returns the low-level object (VolumeObject) for all low-level operations
Returns:

the VolumeObject* pointer

Return type:

any

cell(cx: int, cy: int, cz: int, create: bool, backup: bool) any[source]#
get the cell by cell coordinates, each cell is 8*8*8
Parameters:
  • cx (int) – cell x

  • cy (int) – cell y

  • cz (int) – cell z

  • create (bool) – pass true if you want to create the cell if it does not exist

  • backup (bool) – drop the cell to backup (if not already dropped)

Returns:

the pointer to the VolumeCell

Return type:

any

dirty(cx: int, cy: int, cz: int)[source]#
mark the cell as dirty. This is required if you
setOpacity(Opacity: float)[source]#
set the volume opacity
Parameters:

Opacity (float) – the 0..1 opacity value

relaxGpu(center: any, Radius: float, degree: float)[source]#
fast voxel-based relax within the sphere with the gradual falloff. It works only in voxel mode.
Parameters:
  • center – the center of

  • Radius (float) – the radius of the influence

  • degree (float) – the relax degree, < 1

relaxVoxels(count: int)[source]#
relax the whole volume, works only for voxels
Parameters:

count (int) – the count of relax steps

relaxSurface(degree: float, tangent: bool = False, keep_sharp_boolean_edges: bool = False)[source]#
relax the object in surface mode
Parameters:
  • degree (float) – the degree of smoothing, it may be >1 for the stronger relax

  • tangent (bool) – use tangent relax

  • keep_sharp_boolean_edges (bool) – keep the sharp edges appeared due to bolean operations

relaxOpenEdges(nTimes: int)[source]#
relax the open edges of the mesh, it is applicable only to the surface mode
Parameters:

nTimes (int) – amount of iterations

inScene() SceneElement[source]#
Get the Volume placement in the scene
Returns:

the SceneElement

Return type:

SceneElement

clear()[source]#
Clear and pass to the Undo queue
clearNoUndo()[source]#
Clear quickly, without affecting the Undo queue
assignShader(shaderName: str)[source]#
set the shader for the Volume
Parameters:

shaderName (str) – the shader name as it is shown in the shader’s hint

setBoolShaderProperty(property: str, value: bool)[source]#
setFloatShaderProperty(property: str, value: float)[source]#
setColorShaderProperty(property: str, value: int)[source]#
closeHoles(maxSize: int)[source]#
Close the holes
Parameters:

maxSize (int) – max hole size (edges over the primeter)

static checkIfMoldingLicenseAvailable() bool[source]#
check if molding allowed
Returns:

true if the molding license available

Return type:

bool

static setMoldingParams(direction: any, tapering_angle: float = 0, undercuts_density: float = 1.0, decimation_limit_millions: float = 10, perform_subtraction: bool = True)[source]#
set the parameters for the molding
Parameters:
  • direction – the molding direction

  • tapering_angle (float) – the tapering angle in degrees

  • undercuts_density (float) – the additional density for the undercuts

  • decimation_limit_millions (float) – decimate the final shape if it has triangles count more than this value

  • perform_subtraction (bool) – set false if no need to subtract the molding from the molding shapes

removeUndercuts()[source]#
remove undercuts for the current volume
basRelief(start_point: any = 3)[source]#
perform the bas-relief for the current volume
Parameters:

start_point – the cut point

static setAutomaticMoldingBox()[source]#
set the molding bound box to be automatic
static setMoldingBox(width: float, length: float, thickness: float)[source]#
set the molding bound box to be user-defined, not automatic
Parameters:
  • width (float) – the width of the box

  • length (float) – the length of the box

  • thickness (float) – the thickness of the box

static setMoldingBorder(width: float = 0)[source]#
set the molding border around the parting line to fade to the plane, if it is zero, the final shape will not fade to plane
Parameters:

width (float) – the width in mm or other default units

generateMoldingCurves()[source]#
generate the automatic molding curves
automaticMolding()[source]#
perform the automatic molding
curveBasedMolding()[source]#
perform the curve-based mold
subtractWithoutUndecuts()[source]#
subtract the current undercutted object from the preliminary generated molding shapes
generateMoldingTest() SceneElement[source]#
generate the figure that fills the gap between the molding shapes
Returns:

the generated scene element reference

Return type:

SceneElement

findMoldingTop() SceneElement[source]#
find the top molding shape (that was previously generated)
Returns:

the top shape reference

Return type:

SceneElement

findMoldingBottom() SceneElement[source]#
find the bottom molding shape (that was previously generated)
Returns:

the bottom shape reference

Return type:

SceneElement

findMoldingTest() SceneElement[source]#
find the test molding test shape (that was previously generated)
Returns:

the test shape reference

Return type:

SceneElement

removeMoldingShapes()[source]#
remove all molding intermediate shapes, tests, etc.
assignLiveBooleans(operation: int)[source]#
Apply the live booleans over the sculpt mesh, it is available for voxels only
Parameters:

operation (int) – 0 - stop live booleans, 1 - subtract from the parent, 2 - intersect, 3 - union

collapseBollTree()[source]#
collapse the boolean tree, it is available for this volume
class settings[source]#

Bases: object

static valueExists(ID: str) bool[source]#
returns true if the value in settings exists
Parameters:

ID (str) – the identifier or English text of the option, take identifier from the UI as usual (RMB + MMB)

Returns:

true if identifier exists

Return type:

bool

static getBool(ID: str) bool[source]#
get the boolen value from the settings
Parameters:

ID (str) – the identifier or English text of the option, take identifier from the UI as usual (RMB + MMB)

Returns:

the boolean value, false if not exists or casting impossible

Return type:

bool

static getString(ID: str) str[source]#
get the string value from the settings
Parameters:

ID (str) – the identifier or English text of the option, take identifier from the UI as usual (RMB + MMB)

Returns:

the string value, empty if not exists

Return type:

str

static getFloat(ID: str) float[source]#
get the float value from the settings
Parameters:

ID (str) – the identifier or English text of the option, take identifier from the UI as usual (RMB + MMB)

Returns:

the float value, 0 if not exists or casting impossible

Return type:

float

static getInt(ID: str) int[source]#
get the integer value from the settings
Parameters:

ID (str) – the identifier or English text of the option, take identifier from the UI as usual (RMB + MMB)

Returns:

the integer value, 0 if not exists or casting impossible

Return type:

int

static setBool(ID: str, value: bool) bool[source]#
set the boolean value to the settings
Parameters:
  • ID (str) – the identifier or English text of the option, take identifier from the UI as usual (RMB + MMB)

  • value (bool) – the value to set

Returns:

true if the value was set successfully

Return type:

bool

static setString(ID: str, value: str) bool[source]#
set the string value to the settings
Parameters:
  • ID (str) – the identifier or English text of the option, take identifier from the UI as usual (RMB + MMB)

  • value (str) – the value to set

Returns:

true if the value was set successfully

Return type:

bool

static setFloat(ID: str, value: float) bool[source]#
set the float value to the settings
Parameters:
  • ID (str) – the identifier or English text of the option, take identifier from the UI as usual (RMB + MMB)

  • value (float) – the value to set

Returns:

true if the value was set successfully

Return type:

bool

static setInt(ID: str, value: int) bool[source]#
set the integer value to the settings
Parameters:

value (int) – the value to set

Returns:

true if the value was set successfully

Return type:

bool

static saveSettings()[source]#
save all changed settings
static resetSettings(ResetGeneralSettings: bool = True, ResetHiddenSet: bool = True, ResetHotkeys: bool = True, RestNavigation: bool = True, ResetPresets: bool = True, ResetTheme: bool = True, ResetWindows: bool = True)[source]#
reset all settings to default values, application will restart
Parameters:
  • ResetGeneralSettings (bool) – reset general settings

  • ResetHiddenSet (bool) – reset the hidden UI elements list

  • ResetHotkeys (bool) – reset the hotkeys

  • RestNavigation (bool) – reset the navigation settings

  • ResetPresets (bool) – reset the presets

  • ResetTheme (bool) – reset the theme

  • ResetWindows (bool) – reset the floating windows placement

static listAllSettings() list[str][source]#
get the list of all available settings
Returns:

the pairs of strings, first - option identifier, second - the value, pay attention boolean values are “true” and “false” (like in c++)

Return type:

list[str]

static pressButton(button_name: str)[source]#
triger some action in settings
Parameters:

button_name (str) – the button name, look the identifier in the listAllSettings() output

class Scene[source]#

Bases: object

referes the roots of the scene graph
static clearScene(askUser: bool = False)[source]#
clear the whole scene
Parameters:

askUser (bool) – set true to ask user for unsaved changes

static current() SceneElement[source]#
returns the current sculpt object
Returns:

current object reference

Return type:

SceneElement

static sculptRoot() SceneElement[source]#
get the root of all sculpt objects
Returns:

the root reference

Return type:

SceneElement

static curvesRoot() SceneElement[source]#
get the root of all curves
Returns:

the root reference

Return type:

SceneElement

static getLayer(name: str, addIfNotExists: bool = True) int[source]#
get the Layer ID by name, add the layer if not exists
Parameters:
  • name (str) – layer name

  • addIfNotExists (bool) – set true to add layer if it does not exist

Returns:

layer identifier

Return type:

int

static getLayerName(LayerID: int) str[source]#
get the layer name
Parameters:

LayerID (int) – the layer identifier

Returns:

the layer name

Return type:

str

static setLayerName(LayerID: int, name: str)[source]#
set the layer name
Parameters:
  • LayerID (int) – the layer identifier

  • name (str) – the new name

static getLayerBlending(LayerID: int) int[source]#
get the layer blending mode
Parameters:

LayerID (int) – the layer identifier

Returns:

the index of blending mode as it is ordered in the Layers UI

Return type:

int

static setLayerBlending(LayerID: int, mode: int)[source]#
set the layer blending mode
Parameters:
  • LayerID (int) – the layer identifier

  • mode (int) – the index of blending mode as it is ordered in the Layers UI

static getCurrentLayer() int[source]#
get current layer identifier
Returns:

the current layer identifier

Return type:

int

static setCurrentLayer(LayerID: int)[source]#
set the current layer
Parameters:

LayerID (int) – the layer identifier

static mergeVisibleLayers()[source]#
merge all visible layers
static mergeLayerDown(LayerID: int)[source]#
merge the layer down
Parameters:

LayerID (int) – the layer identifier

static applyLayerBlending(LayerID: int)[source]#
apply layer blending
Parameters:

LayerID (int) – the layer identifier

static invalidateLayer(LayerID: int)[source]#
refresh the layer appearance in scene
Parameters:

LayerID (int) – the layer identifier

static setActiveLayer(LayerID: int)[source]#
activate the layer
Parameters:

LayerID (int) – the layer identifier

static removeLayer(LayerID: int)[source]#
remove the layer
Parameters:

LayerID (int) – the layer identifier

static layerIsEmpty(layerID: int) bool[source]#
Check if the layer is empty
Parameters:

layerID (int) – the layer identifier

Returns:

true if the layer is empty

Return type:

bool

static removeEmptyLayers()[source]#
remove all unused layers
static layerVisible(LayerID: int) bool[source]#
return the layer visibility
static setLayerVisibility(LayerID: int, Visible: bool)[source]#
set the layer visibility
Parameters:

Visible (bool) – the visibility

static setLayerColorOpacity(LayerID: int, Opacity: float)[source]#
set the layer opacity
Parameters:
  • LayerID (int) – the layer identifier

  • Opacity (float) – the color opacity

static setLayerDepthOpacity(LayerID: int, Opacity: float)[source]#
set the layer depth opacity
Parameters:
  • LayerID (int) – the layer identifier

  • Opacity (float) – the depth opacity

static setLayerMetalnessOpacity(LayerID: int, Opacity: float)[source]#
set the layer metalness opacity
Parameters:
  • LayerID (int) – the layer identifier

  • Opacity (float) – the metalness opacity

static setLayerGlossOpacity(LayerID: int, Opacity: float)[source]#
set the layer gloss/roughness opacity
Parameters:
  • LayerID (int) – the layer identifier

  • Opacity (float) – the gloss/roughness opacity

static assignLayerMask(LayerID: int) int[source]#
assign the mask to the layer if it is not assigned before
Parameters:

LayerID (int) – the layer identifier to assign the mask

Returns:

the mask identifier

Return type:

int

static removeLayerMask(LayerID: int)[source]#
remove the layer mask
Parameters:

LayerID (int) – the layer identifier

static extractMaskAsLayer(LayerID: int)[source]#
If the layer has the mask attached, the mask will be extracted as a new layer and the masking disabled
Parameters:

LayerID (int) – the layer identifier

static setMaskForTheLayer(LayerID: int, MaskLayerID: int)[source]#
set the MaskLayerID to be used as mask for the LayerID. The MaskLayerID will disappear among the layers list
Parameters:
  • LayerID (int) – the layer to be masked

  • MaskLayerID (int) – the mask layer

static isLayerMaskEnabled(LayerID: int) bool[source]#
check if the mask is enabled for the layer
Parameters:

LayerID (int) – the layer identifier

Returns:

true if masking is enabled and assigned, false if disabled or not assigned

Return type:

bool

static invertLayerMask(LayerID: int)[source]#
invert the layer mask (if assigned)
Parameters:

LayerID (int) – the layer identifier

static getLayerMaskLayer(LayerID: int) int[source]#
get the mask identifier assigned to the layer
Parameters:

LayerID (int) – the layer identifier

Returns:

the mask layer identifier

Return type:

int

static disableLayerMask(LayerID: int)[source]#
disable the mask for the layer
Parameters:

LayerID (int) – the layer identifier

static enableLayerMask(LayerID: int)[source]#
enable the mask for the layer
Parameters:

LayerID (int) – the layer identifier

static maskEnabled(LayerID: int) bool[source]#
check if the mask is enabled for the layer
Parameters:

LayerID (int) – the layer identifier

Returns:

true if enabled, false if disabled of not assigned

Return type:

bool

static setClippingLayer(LayerID: int)[source]#
set this layer as clipping layer
Parameters:

LayerID (int) – the layer identifier

static disableClippingLayer(LayerID: int)[source]#
disable the clipping layer
Parameters:

LayerID (int) – the layer identifier

static PaintObjectsCount() int[source]#
Get the count of paint objects in scene
Returns:

the amount

Return type:

int

static PaintMaterialCount() int[source]#
Get the count of paint materials
Returns:

the amount

Return type:

int

static PaintUVSetsCount() int[source]#
Get the paint UV-sets (textures) count
Returns:

the amount

Return type:

int

static RemovePaintObject(idx: int)[source]#
Remove the paint object
Parameters:

idx (int) – the index of the object

static RemovePaintMaterial(idx: int)[source]#
Remove the paint material
Parameters:

idx (int) – the index of the material

static RemoveUVSet(idx: int)[source]#
Remove the UV-set (texture)
Parameters:

idx (int) – the index of the UV-set (texture)

static PaintObjectName(idx: int) str[source]#
Get the reference to the object name
Parameters:

idx (int) – index of the object

Returns:

the reference

Return type:

str

static PaintMaterialName(idx: int) str[source]#
Get the reference to the material mane
Parameters:

idx (int) – the index of the material

Returns:

the reference

Return type:

str

static PaintUVSetName(idx: int) str[source]#
Get the reference to the UV set name
Parameters:

idx (int) – the index of the UV set

Returns:

the reference

Return type:

str

static importMesh(filename: str, transform: any = 4) SceneElement[source]#
import mesh into scene, it is the same as File->Import->Import mesh for vertex painting/reference … This is the optimal way to import mesh into the scene
Parameters:

filename (str) – the filename, if it is empty, the dialog appears

Returns:

the scene element reference

Return type:

SceneElement

static ScaleSceneVisually(scale: float)[source]#
Scale the whole scene visually but keep the export size
Parameters:

scale (float) – the scale, >1 means objects become bigger in scene

static ScaleSceneUnits(scale: float)[source]#
Keep the scene visial size in scene, but scale the export size
Parameters:

scale (float) – the scale, >1 means objects become bigger in export

static GetSceneScale() float[source]#
the length of 1 scene unit when you export the scene
Returns:

the 1 unit of scene length in the exported model

Return type:

float

static GetSceneUnits() str[source]#
get the name of the current scene units
Returns:

the name as string

Return type:

str

static setSceneUnits(units: str) bool[source]#
Set the scene units without actual scaling the scene to new units, just name change
Parameters:

units (str) – the name of new units

Returns:

false if units are not supported

Return type:

bool

static getSceneShift() any[source]#
get the scene shift value, look the Edit->Scale master->X,Y,Z
static setSceneShift(shift: any)[source]#
set the scene shift value, look the Edit->Scale master->X,Y,Z
Parameters:

shift – the new shift value

static getAvailableUnits() list[str][source]#
Get the list of all available units
Returns:

the list of strings

Return type:

list[str]

static convertSceneUnits(destination_unit_name: str) bool[source]#
Convert the scene units to the new units, the scene scale will be changed, visual size will be kept
Parameters:

destination_unit_name (str) – the name of new units

Returns:

false if units are not supported

Return type:

bool

static stackUndo(nStack: int)[source]#
Unify several previous undo operations into one
Parameters:

nStack (int) – the amount of operations to unify

static resetTexTransform(type: int)[source]#
reset the texture (stencil or material) transform
Parameters:

type (int) – 0 - stencil, 1 - material

static scaleTex(type: int, scale: float)[source]#
scale the texture (stencil or material)
Parameters:
  • type (int) – 0 - stencil, 1 - material

  • scale (float) – the additional scale value

static scaleTexNonUniform(type: int, scale: any)[source]#
scale the texture (stencil or material) non-uniformly
Parameters:
  • type (int) – 0 - stencil, 1 - material

  • scale – the 2d scale value

static rotateTex(type: int, angle: float)[source]#
rotate the texture (stencil or material)
Parameters:
  • type (int) – 0 - stencil, 1 - material

  • angle (float) – the angle in degrees

static moveTex(type: int, offset: any)[source]#
move the texture (stencil or material)
Parameters:
  • type (int) – 0 - stencil, 1 - material

  • offset – the offset in 2d (screen plane, pixels)

static flipTexX(type: int)[source]#
flip the texture (stencil or material) horizontally
Parameters:

type (int) – 0 - stencil, 1 - material

static flipTexY(type: int)[source]#
flip the texture (stencil or material) vertically
Parameters:

type (int) – 0 - stencil, 1 - material

static setTexTiled(type: int, tiled: bool)[source]#
make texture tiled or use single tile
Parameters:
  • type (int) – 0 - stencil, 1 - material

  • tiled (bool) – the tiled state

static setTexPivot(type: int, pivot: any)[source]#
sep the pivot for the texture (stencil or material)
Parameters:
  • type (int) – 0 - stencil, 1 - material

  • pivot – the screen coordinates of the pivot

static getViewportCenter() any[source]#
get the viewport center in screen coordinates
Returns:

the screen coordinates of the viewport center

Return type:

any

class RenderRoom[source]#

Bases: object

static toRenderRoom()[source]#
get to the render room to be able to render
static restartRendering()[source]#
if the realtime render enabled the command will restart the rendering from scratch
static setCustomRenderSize(width: int, height: int)[source]#
set the render output width
Parameters:
  • width (int) – the width

  • height (int) – the height

static setRenderResult(filename: str)[source]#
set the render output filename
Parameters:

filename (str) – the filename

static renderFrame()[source]#
render to the output file
static enableRealtimeRendering(enable: bool)[source]#
enable or disable the realtime rendering
Parameters:

enable (bool) – set true to enable

static isRealtimeRenderingEnabled() bool[source]#
get the realtime rendering state
Returns:

true if enabled

Return type:

bool

static setExposure(exposure: float)[source]#
set the exposure value for the rendering (in render room)
Parameters:

exposure (float) – the exposure value, usually 0..1, bigger values allowed as well

static getExposure() float[source]#
get the exposure value for the rendering (in render room)
Returns:

the exposure value, around (0..1)

Return type:

float

static setEnvironmentLight(envlight: float)[source]#
set the brightness of the environment light (spherical environment)
Parameters:

envlight (float) – the brightness, usually 1

static getEnvironmentLight() float[source]#
get the brightness of the environment light (spherical environment)
Returns:

the brightness, usually 1

Return type:

float

static setDOFDegree(degree: float)[source]#
set the depth of field (DOF) degree
Parameters:

degree (float) – the degree of DOF, 0 means no DOF, 1 means full DOF

static getDOFDegree() float[source]#
get the depth of field (DOF) degree
Returns:

the degree of DOF, 0 means no DOF, 1 means full DOF

Return type:

float

static getLightsCount() int[source]#
get the amount of additional directional lighte
Returns:

the amount

Return type:

int

static addLight() int[source]#
add the additional directional light
Returns:

the index of the light for all further operations

Return type:

int

static removeLight(idx: int)[source]#
remove the additional directional light
Parameters:

idx (int) – the index of the light

static removeAllLights()[source]#
remove all additional directional lights
static setLightDirection(idx: int, dir: any)[source]#
set the direction for the additional light
Parameters:
  • idx (int) – the index of the light

  • dir – the light direction

static getLightDirection(idx: int) any[source]#
get the direction for the additional light
Parameters:

idx (int) – the index of the light

Returns:

the light direction

Return type:

any

static setLightScattering(idx: int, scattering: float)[source]#
set the light scattering for the additional light
Parameters:
  • idx (int) – the index of the light

  • scattering (float) – the light scattering value

static getLightScattering(idx: int) float[source]#
get the light scattering for the additional light
Parameters:

idx (int) – the index of the light

Returns:

the light scattering value

Return type:

float

static setLightColor(idx: int, color: any = 3)[source]#
set the light color for the additional light
Parameters:
  • idx (int) – the index of the light

  • color – the light color (r,g,b) wintin [0..1] range, if need more intensity, increase the light intensity value

static getLightColor(idx: int) any[source]#
get the light color for the additional light
Parameters:

idx (int) – the index of the light

Returns:

the light color (r,g,b)

Return type:

any

static setLightIntensity(idx: int, intensity: float)[source]#
set the light intensity for the additional light
Parameters:
  • idx (int) – the index of the light

  • intensity (float) – the light intensity value

static getLightIntensity(idx: int) float[source]#
get the light intensity for the additional light
Parameters:

idx (int) – the index of the light

Returns:

the light intensity value

Return type:

float

static setRaysPerFrame(count: int)[source]#
set rays per frame for the rendering
Parameters:

count (int) – the rays per frame count

static getRaysPerFrame() int[source]#
get rays per frame for the rendering
Returns:

the rays per frame count

Return type:

int

static setAA(AA: bool)[source]#
set the anti-aliasing (AA) rendering state
Parameters:

AA (bool) – true to enable

static getAA() bool[source]#
get the anti-aliasing (AA) rendering state
Returns:

true if enabled

Return type:

bool

class Curve(el: SceneElement)[source]#

Bases: SceneElement

pointsCount() int[source]#
get the base points cout in the curve
Returns:

the points count

Return type:

int

point(idx: int) any[source]#
get the base point pointer
Parameters:

idx (int) – the index in the points array

Returns:

the pointer to the point if it is in range, nullptr othervice

Return type:

any

removePoints(index: int, count: int)[source]#
remove the points out of the curve base points list
Parameters:
  • index (int) – the start point index

  • count (int) – points count to remove

curve() any[source]#
get the low-level ObjeCurveObject pointer
Returns:

the OneCurveObject pointer

Return type:

any

renderPointsCount() int[source]#
returns the visual points count. Visual points used to render the curve in the viewport as set of straight lines.
Returns:

the count

Return type:

int

renderPoint(idx: int) any[source]#
returns the visual point reference
Parameters:

idx (int) – the point index

Returns:

the pointer to the point if it is in range, nullptr othervice

Return type:

any

updatePoints()[source]#
update the visual points if need. Use this function if you cahnge the curve. Change the multiple parameters and then call this function if you need visual points.
Othervice they will be updated automatically later.
closed() bool[source]#
returns the reference to the closed state of the curve to get or set the value
Returns:

the reference

Return type:

bool

add(p: cVec3, normal: cVec3, Radius: float)[source]#
add the point to the curve without the direct options the tangents
Parameters:
  • p (cVec3) – the point in space

  • normal (cVec3) – the normal to the point

  • Radius (float) – the point radius

addSharp(p: cVec3, normal: cVec3, Radius: float)[source]#
add the sharp point to the curve
Parameters:
  • p (cVec3) – the point in space

  • normal (cVec3) – the normal to the point

  • Radius (float) – the point radius

addSmooth(p: cVec3, normal: cVec3, Radius: float)[source]#
add the smooth B-spline-like point to the curve
Parameters:
  • p (cVec3) – the position

  • normal (cVec3) – the normal

  • Radius (float) – the radius

addBothTangents(p: cVec3, normal: cVec3, inTangent: cVec3, outTangent: cVec3, Radius: float)[source]#
add the point with two independent tangents.
Parameters:
  • p (cVec3) – the position

  • normal (cVec3) – the normal

  • inTangent (cVec3) – input tangent, it is usually approximately directed from the current to the previous point

  • outTangent (cVec3) – output tangent, it is usually approximately directed from the current to the next point

  • Radius (float) – the radius

addWithTangent(p: cVec3, normal: cVec3, inOutTangent: cVec3, Radius: float)[source]#
add the point with the opposite tangents
Parameters:
  • p (cVec3) – the position

  • normal (cVec3) – the normal

  • inOutTangent (cVec3) – the tangent, it is usually approximately directed from the current to the next point

  • Radius (float) – the radius

tubeToMesh(mesh: Mesh, hemisphere: bool)[source]#
create the solid tube around the curve using the points radius
Parameters:
  • mesh (Mesh) – this mesh will be created as the result of the operation

  • hemisphere (bool) – set true if need the ends of the rode to be hemispheres

getPoint(idx: int) list[source]#
get the point of the curve
Parameters:

idx (int) – the point index

Returns:

the point as tuple (position, normal, tangent1, tangent2, radius)

Return type:

list

setPointPosition(idx: int, p: any)[source]#
set the point position
Parameters:
  • idx (int) – the point index

  • p – the position

setPointNormal(idx: int, n: any)[source]#
set the point normal
Parameters:
  • idx (int) – the point index

  • n – the normal

setPointTangents(idx: int, t1: any, t2: any)[source]#
set the point tangents
Parameters:
  • idx (int) – the point index

  • t1 – the first tangent

  • t2 – the second tangent

setPointRadius(idx: int, r: float)[source]#
set the point radius
Parameters:
  • idx (int) – the point index

  • r (float) – the radius

isOpen() bool[source]#
check if the curve is open
setOpen()[source]#
set the curve to be open
setClosed()[source]#
set the curve to be closed
unselectPoints()[source]#
unselect all curve points
selectPoint(idx: int)[source]#
select the curve point
Parameters:

idx (int) – the point index

fill(mesh: Mesh, thickness: float, relax_count: float = 0, details_level: float = 1, extrusion: float = 0)[source]#
Create the curved surface around the curve
Parameters:
  • mesh (Mesh) – the resulting mesh

  • thickness (float) – the thickness of the object

  • relax_count (float) – the relaxation degree

  • details_level (float) – the details levels

  • extrusion (float) – the additional extrusion

class SphericalCollision[source]#

Bases: object

The class intended to place spheres in space and identify if there are spheres around. It is important for
random objects generating and avoiding self-intersection of objects
setUnit(u: float)[source]#
set the cell size, the cell space should be empty
Parameters:

u (float) – the cell size that should be approximately around the average sphere size

clear()[source]#
remove all spheres
addSphere(p: any, radius: float) int[source]#
add the sphere into the space
Parameters:
  • p – the position

  • radius (float) – the radius

Returns:

the sphere index, you may refer it later using the spher(index) function

Return type:

int

collides(p: any, radius: float) any[source]#
check if sphere intersects other spheres in the space
Parameters:
  • p – position

  • radius (float) – radius

Returns:

the repelling force, it is zero if no collision happened.

Return type:

any

sphere(idx: int) any[source]#
get the sphere parameters by index
Parameters:

idx (int) – the sphere index (previously returned by addSphere)

Returns:

the position (xyz) and radius (w) as vec4

Return type:

any

class ui[source]#

Bases: object

operate over the Coat’s ui
static cmd(id: str, fn: any = None) bool[source]#
execute some action in UI as if you pressed on some control
The ID may be taken from the UI by clicking RMB+MMB, then the ID will appear in the clipboard (look Edit->Prferences->General->Script info type).
If the element triggers modal dialog, the execution will be paused till the modal dialog will be closed, but the callback will be called each frame in modal dialog,
so you will be able to control what happens in the modal dialog.
Parameters:
  • id (str) – the identifier taken from the UI

  • fn – the callback/lambda that will be called each frame till you are within the modal dialog. It looks like

|         def _callback():
|             cmd("#id_to_press")

…code…

Returns:

True if the element found and the operation executed

Return type:

bool

static enableWindow(name: str, eflag: bool) bool[source]#
static wait(id: str, max_seconds: float) bool[source]#
wait till the element id will appear in the UI. The element will not be clicked. The max wait time is max_seconds.
Parameters:
  • id (str) – The ID we wait to appear

  • max_seconds (float) – the max wait time (seconds)

Returns:

true if the element appeared

Return type:

bool

static presentInUI(id: str) bool[source]#
Check if the elemnt present in the UI
Parameters:

id (str) – the identifier

Returns:

true if the element is present

Return type:

bool

static highlight(id: str, milliseconds: float)[source]#
highlight the UI element for a while
Parameters:
  • id (str) – the ID of the element

  • milliseconds (float) – the time to highlight, milliseconds

static enablePenChannel(i: int, enabled: bool)[source]#
enable or disable the pen channel
Parameters:
  • i (int) – the channel: 0 - depth, 1 - color, 3 - gloss, 2 - currently unused

  • enabled (bool) – true to enable

static isEnabledPenChannel(i: int) bool[source]#
check if the pen channel is enabled
Parameters:

i (int) – the cannel: 0 - depth, 1 - color, 3 - gloss, 2 - currently unused

Returns:

true if the channel is enabled

Return type:

bool

static setSliderValue(id: str, value: float) bool[source]#
Set the value for the the slider (if exists in UI)
Parameters:
  • id (str) – the ID of the element

  • value (float) – the value to set

Returns:

true if successful

Return type:

bool

static getSliderValue(id: str) float[source]#
get the value of the slider
Parameters:

id (str) – the ID of the element

Returns:

the value

Return type:

float

static setEditBoxValue(id: str, value: float) bool[source]#
set the edit box value
Parameters:
  • id (str) – the ID of the element

  • value (float) – the value to set

Returns:

true if the element exists

Return type:

bool

static getEditBoxValue(id: str) str[source]#
static apply()[source]#
pess ENTER, acts as Apply usually
static setFileForFileDialog(filename: str)[source]#
Set the file for the next file dialog that will be triggered by user.
If you will use coat::ui:cmd(…) to trigger some command that shows the file dialog
this command allows to substitute the filename for that dialog instead of showing the dialog.
This acts only for ONE next dialog.
Parameters:

filename (str) – the filename to substitute.

static getBoolField(id: str) bool[source]#
Get the bool field from the checkbox in UI
Parameters:

id (str) – the element identifier

Returns:

the checkbox value

Return type:

bool

static setBoolValue(id: str, value: bool) bool[source]#
Set the value for the checkbox in UI
Parameters:
  • id (str) – the element identifier

  • value (bool) – the value to set

Returns:

true if successful and the element exists

Return type:

bool

static currentRoom() str[source]#
get the current room name
Returns:

the name

Return type:

str

static isInRoom(name: str) bool[source]#
check if we are in the specified room
Parameters:

name (str) – the room name to check

Returns:

true if we are in that room

Return type:

bool

static toRoom(name: str, Force: bool = False)[source]#
switch to the room
Parameters:
  • name (str) – the room name. Pay attention, you may pass the name or identifier, but name has bigger priory.

  • Force (bool) – set true to switch even if we are in the tool that corresponds to the destination room

static roomsCount() int[source]#
returns the rooms count
Returns:

the number

Return type:

int

static roomName(index: int) str[source]#
get the room name by index
Parameters:

index (int) – the room index

Returns:

“” if index outside the range or the room name if the index is valid

Return type:

str

static roomID(index: int) str[source]#
get the text identifier of the room
Parameters:

index (int) – the room index

Returns:

“” if index outside the range or the room identifier if the index is valid

Return type:

str

static toolParam(B: BaseClass)[source]#
show the class B as the part of the tools params panel
Parameters:

B (BaseClass) – the class pointer

static removeToolParam(B: BaseClass = None)[source]#
remove the class from the tools params
Parameters:

B (BaseClass) – the class pointer

static getOption(id: str) str[source]#
get the option from preferences
Parameters:

id (str) – the identifier of english text of the option

Returns:

the value as string

Return type:

str

static setOption(id: str, value: float) bool[source]#
static hideDontShowAgainMessage(id: str)[source]#
Hides the “Don’t show again dialog” for the current session (not forever)
Parameters:

id (str) – the identifier, for example “AttachTextureHint”, look the currently hidden list as files names in Docs/3DCoat/data/Temp/*.dontshow

static showInfoMessage(infoID: str, milliseconds: int)[source]#
Show the floating information message for the some time period
Parameters:
  • infoID (str) – the message or message identifier (from language files)

  • milliseconds (int) – how ling to display the message

static insertInMenu(Menu: str, ID_in_menu: str, script_path: str)[source]#
Insert the scripted command into the main menu
Parameters:
  • Menu (str) – One of main menu items, look the list in Documents/3DCoat/UserPrefs/Scripts/ExtraMenuItems/menu_sections.txt

  • ID_in_menu (str) – the ID of the command in the menu, it is the english text or the identifier of the command

  • script_path (str) – the full or relative path to the script file, if relative, it is relative to the 3DCoat root folder

If it comes without path, it is assumed to be in same folder as the script that calls this function. If this parameter is empty,
this script will be called.
static insertInToolset(roomID: str, section: str, toolID: str, script_path: str = '')[source]#
Insert the script-based tool into the toolset
Parameters:
  • roomID (str) – the room identifier, same as folders names in Documents/3DCoat/UserPrefs/Rooms/CustomRooms/

  • section (str) – the section name. This string may be empty to add beyond sections (anyway, at the end) or in any existing section.

To get section name, pres RMB+MMB over the section name in the toolset. You will get something like “*Adjust” in the clipboard.
The “Adjust” in this case is the section name.
toolID (str): the tool identifier, how it will appear in UI. You may provide the text for the identifier using the addTranslation(…)
Also, if there is image in the data/Textures/icons64/ named as toolID.png, it will be used as the icon for the tool.
script_path (str): the full or relative path to the script file, if relative, it is relative to the 3DCoat root folder
If it comes without path, it is assumed to be in same folder as the script that calls this function. If this parameter is empty,
this script will be called.
static removeCommandFromMenu(ID_in_menu: str)[source]#
remove the command from the menu
Parameters:

ID_in_menu (str) – the ID of the command in the menu, it is the english text or the identifier of the command

static checkIfMenuItemInserted(ID_in_menu: str) bool[source]#
Check if the command inserted somewhere into the menu
Parameters:

ID_in_menu (str) – the ID of the command in the menu, look the list in C:/UsersndreOneDriveDocumentsDCoat/UserPrefsScriptsExtraMenuItemsmenu_sections.txt it is the english text or the identifier of the command

Returns:

true if the command is inserted

Return type:

bool

static addExtension(roomID: str, section: str, obj: any)[source]#
Add the extension (new tool) into the room. Look the
ef GeneratorExample.py
Args:
roomID (str): roomID the room identifier, same as folders names in Documents/3DCoat/UserPrefs/Rooms/CustomRooms/
section (str): section the section name. This string may be empty to add beyond sections (anyway, at the end) or in any existing section.
To get section name, pres RMB+MMB over the section name in the toolset. You will get something like “*Adjust” in the clipboard.
The “Adjust” in this case is the section name.
obj : the object that contains the extension. Look the
ef GeneratorExample.py
static checkIfExtensionPresent(extension_ID: str) bool[source]#
Check if extension named as extension_ID is present in the 3DCoat
Parameters:

extension_ID (str) – the identifier of the extension

Returns:

True if the extension installed

Return type:

bool

static addTranslation(id: str, text: str)[source]#
Add the translation for the text identifier
Parameters:
  • id (str) – the identifier

  • text (str) – the translation

static getIdTranslation(id: str) str[source]#
Get the translation for the text identifier
Parameters:

id (str) – the text identifier

Returns:

the translation or the id

Return type:

str

static getCurrentLanguage() str[source]#
Get the current language file name (without the XML extension)
Returns:

the language file name (without the XML extension)

Return type:

str

static switchToLanguage(language: str)[source]#
Switch the layout to the language
Parameters:

language (str) – the language identifier, actually it is the file name (withot the XML extension) in the data/Languages/ folder

static scale() float[source]#
returns the scale in comparison to the smallest UI theme
Returns:

the scale factor > 1

Return type:

float

static inputString(text: str, min_length: int = 0) str[source]#
input text under the mouse position
Parameters:
  • text (str) – the initial text value

  • min_length (int) – the minimal width of the input field, if zero passed the width taken from the parent control (if exists)

Returns:

the changed text (if the user pressed OK) or the initial text other vice.

Return type:

str

static stopNomodal()[source]#
static nomodalInputActive() bool[source]#
static getInputPixelsHeight() int[source]#
static inputInt(initial_value: int) int[source]#
input the integer value under the mouse position
Parameters:

initial_value (int) – the initial integer value

Returns:

the changed value (if the user pressed OK) or the initial value other vice.

Return type:

int

static inputFloat(initial_value: float) float[source]#
inputh the float value under the mouse position
Parameters:

initial_value (float) – the initial float value

Returns:

the changed value (if the user pressed OK) or the initial value other vice.

Return type:

float

class Camera[source]#

Bases: object

static rotateToGradually(destination_dir: any)[source]#
align the camera along the view
Parameters:

destination_dir – the view direction

static getForward() any[source]#
get the forward direction
Returns:

the direction

Return type:

any

static getUp() any[source]#
get the camera up direction
Returns:

the direction

Return type:

any

static getRight() any[source]#
get the camera right direction
Returns:

the direction

Return type:

any

static isOrtho() bool[source]#
return true if the camera is in the ortho mode
Returns:

the ortho mode state

Return type:

bool

static setOrtho(ortho: bool)[source]#
switch the camera to the ortho or perspective mode
Parameters:

ortho (bool) – set true if need ortho mode, false if need perspective mode

static getPivot() any[source]#
get the camera pivot position
Returns:

the position

Return type:

any

static setPivot(pivot: any)[source]#
set the camera pivot position
Parameters:

pivot – the pivot position

static getPosition() any[source]#
get the camera position
Returns:

the camera position

Return type:

any

static getWorldToScreenSpace(world_pos: any) any[source]#
convert the world position to the screen position
Parameters:

world_pos – the world position

Returns:

the screen position

Return type:

any

static getScreenToWorldSpace(screen_pos: any) any[source]#
convert the screen position to the world position
Parameters:

screen_pos – the screen position (pass z that you got using getWorldToScreenSpace)

Returns:

the world position

Return type:

any

static setCamera(position: any, lookAt: any, fovY: float, up: any = 3)[source]#
class dialog[source]#

Bases: object

the rich dialog. You may customize it, show your custom parameters and custom buttons.
text(id: str) dialog[source]#
pass the header text of the dialog
Parameters:

id (str) – the text or text identifier that will be used to take the text from the language file. You may press F9 to localize it in UI.

Returns:

the reference to pass multiple options at chain.

Return type:

dialog

caption(id: str) dialog[source]#
pass the caption of the dialog
Parameters:

id (str) – id the caption or caption identifier that will be used to take the text from the language file. You may press F9 to localize it in UI.

Returns:

the chain ref

Return type:

dialog

width(w: int) dialog[source]#
change the default width
Parameters:

w (int) – the width will be scaled in correspondence with the font size, so you may pass absolute values like 500

Returns:

itself

Return type:

dialog

modal() dialog[source]#
dialog will be modal. Generally, it is modal by default. Execution will be paused at show() till the user will press any dialog button.
Returns:

itself

Return type:

dialog

noModal() dialog[source]#
dialog will be no modal. Execution will continue after you will call the show()
buttons(list: str) dialog[source]#
pass the list of buttons for the dialog
Parameters:

list (str) – list of buttons. |, .+; may be used as separators between identifiers

Returns:

itself

Return type:

dialog

topRight() dialog[source]#
place the dialog at the top-right position of the viewport
Returns:

itself

Return type:

dialog

ok() dialog[source]#
add Ok button
Returns:

itself

Return type:

dialog

cancel() dialog[source]#
add Cancel button
Returns:

itself

Return type:

dialog

yes() dialog[source]#
add Yes button
Returns:

itself

Return type:

dialog

no() dialog[source]#
add No button
Returns:

itself

Return type:

dialog

warn() dialog[source]#
add Warning icon
Returns:

itself

Return type:

dialog

question() dialog[source]#
add Question icon
Returns:

itself

Return type:

dialog

undoWorks() dialog[source]#
allow undo (CTR-Z) act even in modal dialog
Returns:

itself

Return type:

dialog

transparentBackground() dialog[source]#
the background will not be faded
Returns:

itself

Return type:

dialog

static fadeDialogsBackground() bool[source]#
returns the reference to the global property - fade modal dialogs background (true) or not (false)
Returns:

the property reference

Return type:

bool

dontShowAgainCheckbox() dialog[source]#
show the checkbox “Don’t show again”. If user checks if the dialog will net be shown next time and show() will return 0 immediately.
Returns:

itself

Return type:

dialog

params(params: any) dialog[source]#
The important core feature. Pass the object to display object parameters in UI. Look the dialog example to understand how to use it.
Parameters:

params – the class reference

Returns:

itself

Return type:

dialog

process(callback: any) dialog[source]#
pass the function/lambda that will be called each frame.
Parameters:

callback – the callback/lambda called each frame within the dialog

Returns:

itself

Return type:

dialog

onPress(press: any) dialog[source]#
pass the function/lambda that will be called when the button will be pressed. The button index (starts from 1) will be passed to the function
Parameters:

press – the callback/lambda

Returns:

itself

Return type:

dialog

show() int[source]#
Show the dialog. This is usually the last command in the chain.
Returns:

the button index. First button in the list has index 1

Return type:

int

widget(w: any) dialog[source]#
class resource(id: str)[source]#

Bases: object

this class represents different resources accessible in UI - alphas, strips, materials, models, etc
static listAllResourcesTypes() list[str][source]#
list all available resources types
Returns:

the list of resource types (any type may be passed to the resource constructor)

Return type:

list[str]

listFolders() list[str][source]#
list folders of the resource type referred by this object
Returns:

the list of folders (short names without the full path)

Return type:

list[str]

currentFolder() str[source]#
get the current folder short name
Returns:

the name of current folder of the resource type referred by this object

Return type:

str

currentFolderFullPath() str[source]#
full path (relative to the 3DCoat’s documents) to the current folder files
Returns:

the path

Return type:

str

rootPath() str[source]#
the root path (relative to the 3DCoat’s documents) to the resource type referred by this object
Returns:

the path

Return type:

str

supportedExtensions() list[str][source]#
get the list of supported extensions for the resource type referred by this object
Returns:

the list of strings with extensions

Return type:

list[str]

setCurrentFolder(folder: str)[source]#
set the current folder (short name without the full path)
Parameters:

folder (str) – the folder name

createFolder(folderName: str)[source]#
create the folder and switch there
Parameters:

folderName (str) – the folder name

removeFolder(folderName: str)[source]#
remove the folder and switch to the root folder if this is the current folder
Parameters:

folderName (str) – the folder name

listCurrentFolderItems() list[str][source]#
get the list of all items in the current folder
Returns:

the list of items (usually long names with the relative path)

Return type:

list[str]

addItem(itemPath: str)[source]#
add the item to the current folder
Parameters:

itemPath (str) – the path to the item (full or relative to the 3DCoat’s documents)

removeItem(itemName: str)[source]#
remove the item from the current folder
Parameters:

itemName (str) – the item name as it is returned by listCurrentFolderItems()

selectItem(itemName: str)[source]#
select/activate the item in the current folder
Parameters:

itemName (str) – the item name as it is returned by listCurrentFolderItems()

moveItemToFolder(itemName: str, destFolderName: str)[source]#
move the item to another folder
Parameters:
  • itemName (str) – the item name as it is returned by listCurrentFolderItems()

  • destFolderName (str) – the short name of the destination folder

getCurrentItem() str[source]#
returns the current item name (if possible)
Returns:

the string, current item name

Return type:

str

class io[source]#

Bases: object

General I/O access
static installPath() str[source]#
the 3DCoat installation path
Returns:

the path

Return type:

str

static dataPath() str[source]#
the 3DCoat data path
Returns:

the path

Return type:

str

static documents(path: str) str[source]#
convert the relative path to the path in documents, if the path is absolute, just return the original path
Parameters:

path (str) – the relative or absolute path

Returns:

the absolute path in user documents

Return type:

str

static fileExists(path: str) bool[source]#
check if file exists
Parameters:

path (str) – 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.
Returns:

true if the file exists

Return type:

bool

static copyFile(src: str, dest: str)[source]#
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:
  • src (str) – the source filename

  • dest (str) – the destination filename

static copyFolder(src: str, dest: str)[source]#
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:
  • src (str) – the source folder

  • dest (str) – the destination folder

static removeFile(filename: str)[source]#
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:

filename (str) – the file path

static removeFolder(folder: str)[source]#
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:

folder (str) – the path to the folder

static toFullPathInDataFolder(path: any)[source]#
static toFullPathInInstallFolder(path: any)[source]#
static convertToWritablePath(path: any)[source]#
static convertToWritablePathIfFileExists(path: any)[source]#
static getExtension(filepath: str) str[source]#
get the file extension (without .)
Parameters:

filepath (str) – the file path - full or relative

Returns:

the extension

Return type:

str

static getFileName(filepath: str) str[source]#
get the file name from the path
Parameters:

filepath (str) – the full or relative path

Returns:

the filename without the path

Return type:

str

static getFilePath(filepath: str) str[source]#
get the file path without the filename
Parameters:

filepath (str) – the filepath

Returns:

the path that always ends with ‘/’

Return type:

str

static getFileNameWithoutExtension(filepath: str) str[source]#
remove the file extension from the filename
Parameters:

filepath (str) – the file name

Returns:

the filename without extension

Return type:

str

static strFromFile(filename: str) str[source]#
read string from file.
Parameters:

filename (str) – 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.
Returns:

true if file read succesful

Return type:

str

static strToFile(text: str, filename: str)[source]#
write the string to file
Parameters:
  • text (str) – the text to save

  • filename (str) – The path. If it is relative, it is relative to the documents folder.

static getFileSize(filename: str) int[source]#
get the file size
Parameters:

filename (str) – the filename, relative or full

Returns:

the file size

Return type:

int

static cursorPos() any[source]#
returns the current cursor position
Returns:

the 2d vector

Return type:

any

static snappedCursorPos() any[source]#
returns the snapped cursor position
Returns:

the 2d vector

Return type:

any

static wholeScreen() any[source]#
get the whole screen rectangle
Returns:

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

Return type:

any

static workArea() any[source]#
get the work area rectangle
Returns:

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

Return type:

any

static progressBar(stage: float, max_stage: float, message: str)[source]#
Show the progress bar
Parameters:
  • stage (float) – the current stage

  • max_stage (float) – the maximal stage

  • message (str) – the text to display

static progressBarInWindowHeader(stage: float, max_stage: float, message: str)[source]#
Show the progress bar only in the 3DCoat’s window header
Parameters:
  • stage (float) – the current stage

  • max_stage (float) – the maximal stage

  • message (str) – the text to display

static setWindowTitle(text: str, seconds: float)[source]#
Override the 3DCoat’s window title for some amount of time
Parameters:
  • text (str) – the text to show

  • seconds (float) – the seconds to stay in title

static step(count: int = 1)[source]#
perform rendering cycles
Parameters:

count (int) – amount of cycles

static exec(command: str, arguments: str = None)[source]#
execute command. It may be exe file, URL, batch command
Parameters:
  • command (str) – the command to execute

  • arguments (str) – optional command line arguments

static execAndWait(command: str, arguments: str = None) str[source]#
execute and wait till finished, the console output will be returned as string
Parameters:
  • command (str) – the command to execute

  • arguments (str) – optional arguments

Returns:

the console output of the executed program

Return type:

str

static updateCoatPyi(folderOrFile: str)[source]#
update the .pyi file for the given folder or py file
Parameters:

folderOrFile (str) – the full or relative path to the folder or py file

static ListFiles(folder: str, mask: str, recursive: bool = True) list[str][source]#
list files in the folder
Parameters:
  • folder (str) – the start folder. It may be absolute or relative to 3DCoat documents/install folder.

  • mask (str) – the seek mask (wildcards)

  • recursive (bool) – set true if recursive

Returns:

result the files list

Return type:

list[str]

static ListFolders(startFolder: str) list[str][source]#
list folders within the folder, non-recursive, just plain list
Parameters:

startFolder (str) – the start folder

Returns:

the resulting list

Return type:

list[str]

static supportedImagesFormats() str[source]#
returns the currently supported mesh export formats
Returns:

the list like “.obj;.fbx;…”

Return type:

str

static supportedMeshesFormats() str[source]#
returns the list of supported images formats
Returns:

the list like “.png;.jpg;…”

Return type:

str

static openFileDialog(extensions: str) str[source]#
static openFilesDialog(extensions: str) list[str][source]#
open multiple files dialog
Parameters:

extensions (str) – the list of supported extensions like .txt;.dat; etc…

Returns:

the resulting filenames list

Return type:

list[str]

static saveFileDialog(extensions: str) str[source]#
static currentSceneFilepath() str[source]#
returns the current scene filename, empty if the scene was not saved/opened
static pipInstall(requirements: str)[source]#
install one or multiple python packages
Parameters:

requirements (str) – the list of packages to install, this is all what you write after “pip install”

static pipUninstall(requirements: str)[source]#
static pythonPath() str[source]#
get the python libraries folder
Returns:

the path

Return type:

str

static showPythonConsole()[source]#
Show the python console, clear it and pop up
static executeScript(path: str)[source]#
execute python (.py file) or angelscript (c++ like), or CoreAPI (native C++) script
Parameters:

path (str) – the full or relative path to the script file

static installRequirements(path_to_requirements_txt: str)[source]#
Install all the requirements for the python script execution
Parameters:

path_to_requirements_txt (str) – te full or relative path to the requirements.txt

static toJson(obj: any, filename: str = '') str[source]#
Store the object to the file or string as json
Parameters:
  • obj – the python object reference

  • filename (str) – the filename to save, if empty, the string will be returned

Returns:

the string that contains json data

Return type:

str

static fromJsonFile(obj: any, filename: str)[source]#
Restore the object from the json file
Parameters:
  • obj – the object to restore

  • filename (str) – the path to the json file, full or relative

static restoreObjectFormJsonString(obj: any, data: str)[source]#
Restore the object from the json string
Parameters:
  • obj – the object to restore

  • data (str) – the json string

static createRedistributablePackageFromFolder(folder: str, package_name: str, excluded_folders_names: str = '', excluded_extensions: str = '')[source]#
Create the 3dcpack file from the folder placed in Documents
Parameters:
  • folder (str) – the folder to pack, it should be relative to the 3DCoat’s Documents folder

  • package_name (str) – the package name, the extension is .3dcpack

  • excluded_folders_names (str) – the folders names to be excluded from the package, separated by semicolon

  • excluded_extensions (str) – the file extensions to be excluded from the package, separated by semicolon

static getDownloadProgress() int[source]#
returns the overall download progress
Returns:

the progress in percents

Return type:

int

static listBlenderInstallFolders() list[str][source]#
list the blender install folders
Returns:

the list of the blender install folders

Return type:

list[str]

static saveScreenshot(filename: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0)[source]#
save the screenshot to the file
Parameters:
  • filename (str) – the filename

  • x (int) – the x coordinate of the screenshot

  • y (int) – the y coordinate of the screenshot

  • width (int) – the width of the screenshot, if 0 all to the right will be captured

  • height (int) – the height of the screenshot, if 0 all to the bottom will be captured

static removeBackground(image1: str, image2: str, result: str)[source]#
static ppp(filename: str)[source]#
Opens model for PPP, if path is empty, shows open dialog
Parameters:

filename (str) – the filename

class utils[source]#

Bases: object

static dwordToVec4(d: int) any[source]#
convert DWORD (unsigned int) to vec4
Parameters:

d (int) – the DWORD (unsigned int)

Returns:

the 4d vector

Return type:

any

static vec4ToDword(v: any) any[source]#
convert vec4 to DWORD (unsigned int)
Parameters:

v – the 4d vector

Returns:

the DWORD (unsigned int)

Return type:

any

static randomize(seed: int)[source]#
set the random seed for all further random value generation
Parameters:

seed (int) – the seed

static random01() float[source]#
get the random value 0..1
Returns:

the random value

Return type:

float

static random(min: float, max: float) float[source]#
get the random value in range
Parameters:
  • min (float) – low bound

  • max (float) – high bound

Returns:

the random value

Return type:

float

static randomNormal() any[source]#
get the normalized random vector
Returns:

the 3d random vector

Return type:

any

static perlin3d(p: any, seed: float = 0) any[source]#
returns the perlin noise 3d vector
Parameters:
  • p – the value in 3d space

  • seed (float) – the seed

Returns:

the perlin noise value

Return type:

any

static perlin(p: any, seed: float = 0) float[source]#
generate the perlin noise value
Parameters:
  • p – the value in 3d space

  • seed (float) – the seed

Returns:

the perlin noise value

Return type:

float

static getEnumValueByIndex(enumID: str, index: int) str[source]#
get the value from the global strings list by index. That lists used in dropdown boxes in UI
Parameters:
  • enumID (str) – the enumerator ID

  • index (int) – the index of the value

Returns:

the string

Return type:

str

static getEnumValue(enumID: str, key: str) int[source]#
get the integer value that corresponds to the string value from the global strings list.
Parameters:
  • enumID (str) – the enumerator ID

  • key (str) – the string value fo find

Returns:

the integer value that corresponds to the string

Return type:

int

static getEnumValueIndex(enumID: str, key: str) int[source]#
get the index of the value in the global strings list. That lists used in dropdown boxes in UI
Parameters:
  • enumID (str) – the enumerator ID

  • key (str) – the value to find

Returns:

the index of the value, -1 means that value not found

Return type:

int

static getEnumValuesCount(enumID: str) int[source]#
get the count of the values in the global strings list. That lists used in dropdown boxes in UI
Parameters:

enumID (str) – the enumerator ID

Returns:

the count of the values

Return type:

int

static clearEnum(enumID: str)[source]#
clear the global strings list.
Parameters:

enumID (str) – the enumerator ID

static addEnumValue(enumID: str, key: str, value: int = 1)[source]#
add the value to the global strings list.
Parameters:
  • enumID (str) – the enumerator ID

  • key (str) – the string to add

  • value (int) – the integer value that corresponds to the string, -1 means that the value will be the index of the string in the list, it is default value

static quit()[source]#
exit the 3DCoat
static testSuccessful()[source]#
report that the test was successful. In this case the file “InstallFolder/.installer/test_success.txt created
static testFailed(message: str)[source]#
report that the test was successful. In this case the file “InstallFolder/.installer/test_failed.txt created
Parameters:

message (str) – the message to put into that file

static signal(message: str)[source]#
send some message to 3DCoat (usually used for internal purposes)
Parameters:

message (str) – the message

static last_signals() list[str][source]#
get the list of last signals sent to 3DCoat
Returns:

the list reference

Return type:

list[str]

static getFPS() float[source]#
get the current FPS
Returns:

the fps value (averaged)

Return type:

float

static getFrameTimeMs() float[source]#
get the frame time in milliseconds
Returns:

the milliseconds amount

Return type:

float

static inRenderProcess() bool[source]#
check if the viewport is in render process in render room
Returns:

true if in render

Return type:

bool

static set(key: str, value: str)[source]#
Globally set the value for the key, it is even stored between sessions of the 3DCoat
Parameters:
  • key (str) – the key

  • value (str) – the value to store

static get(key: str) str[source]#
Get previously stored value by the key
Parameters:

key (str) – the key

Returns:

the value as string, empty string if not found

Return type:

str

class uv[source]#

Bases: object

The UV API. The mesh is taken from the current room. If paint or UV rooms is active, the mesh is taken from the paint room, otherwise the mesh is taken from the Retopo room
static uvSetsCount() int[source]#
get the UV-sets count.
Returns:

the amount

Return type:

int

static setUnwrapIslandsDistance(distance: float)[source]#
set the border around the islands when we pack it
Parameters:

distance (float) – the border size in percents

static getUnwrapIslandsDistance() float[source]#
get the border around the islands when we pack it
Returns:

the border size in percents

Return type:

float

static currentUvSet() int[source]#
get the current uv-set index
Returns:

the index

Return type:

int

static islandsCount(uv_set: int) int[source]#
get the islands count over the current uv-set
Parameters:

uv_set (int) – the uv-set index

Returns:

teh islands count

Return type:

int

static islandToMesh(uv_set: int, island_index: int) Mesh[source]#
get the mesh that contains the island, xy of each point is the UV coordinate. The mesh contains only one island
Parameters:
  • uv_set (int) – the uv set index

  • island_index (int) – the island index within the uv set

Returns:

the flat mesh

Return type:

Mesh

static islandToMeshInSpace(uv_set: int, island_index: int) Mesh[source]#
get the mesh that contains the island, each point is the coordinate in space (not the uv coordinate!). The mesh contains only one island. The faces correspond to the faces of the mesh that was got by islandToMesh
Parameters:
  • uv_set (int) – the uv set index

  • island_index (int) – the island index within the uv set

Returns:

s mesh the 3D mesh

Return type:

Mesh

static getIslandVertexMapping(uv_set: int, island_index: int) list[int][source]#
get the mapping from the vertex index in the mesh that was got by islandToMesh to the vertex index in the original mesh
Parameters:
  • uv_set (int) – the uv set index

  • island_index (int) – the island index within the uv set

Returns:

the list of the positional vertex indices of the original mesh in same order as the vertices in the mesh that was got by islandToMesh

Return type:

list[int]

static getIslandBorder(uv_set: int, island_index: int) list[int][source]#
get unsorted list of edges on the border of the island
Parameters:
  • uv_set (int) – the uv set index

  • island_index (int) – the island index within the uv set

Returns:

the list of edges, even amount of elements, each pair of elements is the positional vertex indices of the original mesh

Return type:

list[int]

static getBorderBetweenIslands(uv_set1: int, island_index1: int, uv_set2: int, island_index2: int) list[int][source]#
get the border between two islands
Parameters:
  • uv_set1 (int) – the uv set index of the first island

  • island_index1 (int) – the island index within the uv set of the first island

  • uv_set2 (int) – the uv set index of the second island

  • island_index2 (int) – the island index within the uv set of the second island

Returns:

the list of edges that are common for both islands, even amount of elements, each pair of elements is the positional vertex indices of the original mesh

Return type:

list[int]

static getIslandVertexUv(uv_set: int, island_index: int, vertex_index: int) any[source]#
get the uv coordinate of the positional vertex in the island
Parameters:
  • uv_set (int) – the uv set index

  • island_index (int) – the island index within the uv set

  • vertex_index (int) – the positional vertex index

Returns:

the uv coordinate of the vertex, vec2(0,0) if the vertex is not in the island

Return type:

any

static flattenSingleIsland(mesh: Mesh, method: int, optimize_rotation: bool = True, scale_to_geometry: bool = True) Mesh[source]#
Flatten the mesh that consists of the single island
Parameters:
  • mesh (Mesh) – the mesh that consists of the single island

  • method (int) – the flattening method. 0 - flatten to the plane, 1 - LSCM, 2 - ABF, 3 - GU, 4 - Stripe (if possible)

  • optimize_rotation (bool) – optimize the rotation of the island, place it approximately horizontally or vertically

  • scale_to_geometry (bool) – scale the island to keep average edge length equal to the average edge length of the original mesh

Returns:

the flat mesh

Return type:

Mesh

static meshToIsland(mesh: Mesh, uv_set: int, island_index: int)[source]#
use the mesh (that was previously got by islandToMesh) to replace the island in the current uv-set
Parameters:
  • mesh (Mesh) – the mesh that was previously got by islandToMesh

  • uv_set (int) – the uv set index

  • island_index (int) – the island index within the uv set

static pack(uv_set: int, rotate: bool, shuffle: bool)[source]#
pack the islands in the current uv-set
Parameters:
  • uv_set (int) – the uv set index

  • rotate (bool) – allow rotation while packing

  • shuffle (bool) – shuffle the identical islands to avoid the exact overlapping

static unwrap(uv_set: int)[source]#
unwrap the current uv-set
Parameters:

uv_set (int) – the uv set index

static toAbf(uv_set: int, island_index: int)[source]#
unwrap the island using the ABF approach
Parameters:
  • uv_set (int) – the uv set index

  • island_index (int) – the island index within the uv set

static toLscm(uv_set: int, island_index: int)[source]#
unwrap the island using the LSCM approach
Parameters:
  • uv_set (int) – the uv set index

  • island_index (int) – the island index within the uv set

static toGu(uv_set: int, island_index: int)[source]#
unwrap the island using the GU (Globally Uniform) approach
Parameters:
  • uv_set (int) – the uv set index

  • island_index (int) – the island index within the uv set

static toPlanar(uv_set: int, island_index: int)[source]#
unwrap the island using the Planar approach
Parameters:
  • uv_set (int) – the uv set index

  • island_index (int) – the island index within the uv set

static toStripe(uv_set: int, island_index: int)[source]#
try to uwrap the island as the regular stripe
Parameters:
  • uv_set (int) – the uv set index

  • island_index (int) – the island index within the uv set

static toUvSet(uv_set: int, island_index: int, destination_uv_set: int)[source]#
move the island from one uv-set to another one
Parameters:
  • uv_set (int) – the source uv set index

  • island_index (int) – the island index within the source uv set

  • destination_uv_set (int) – the destination uv set index

static getWholeMesh() Mesh[source]#
get the whole mesh from the paint/UV/Retopo room - in dependence on current room
Returns:

the whole paint or retopo mesh (in dependence on current room)

Return type:

Mesh

static selectedToMesh() Mesh[source]#
get the selected faces as the Mesh object
Returns:

the Mesh

Return type:

Mesh

static getSeams() list[int][source]#
get all seams across the mesh
Returns:

the list of integer values, each value is the index of the vertex in the mesh, the even index is start of the seam, the odd index is the end of the seam

Return type:

list[int]

static addSeam(start_vertex_index: any, end_vertex_index: int)[source]#
add the seam to the mesh
Parameters:
  • start_vertex_index – the start positional vertex index

  • end_vertex_index (int) – the end positional vertex index

static removeSeam(start_vertex_index: int, end_vertex_index: int)[source]#
remove the seam from the mesh
Parameters:
  • start_vertex_index (int) – the start positional vertex index

  • end_vertex_index (int) – the end positional vertex index

static getSharpEdges() list[int][source]#
get the sharp edges across the mesh
Returns:

the list of integer values, each value is the index of the vertex in the mesh, the even index is start of the edge, the odd index is the end of the edge

Return type:

list[int]

static addSharpEdge(start_vertex_index: int, end_vertex_index: int)[source]#
add the sharp edge to the mesh
Parameters:
  • start_vertex_index (int) – the start positional vertex index

  • end_vertex_index (int) – the end positional vertex index

static removeSharpEdge(start_vertex_index: int, end_vertex_index: int)[source]#
remove the sharp edge from the mesh
Parameters:
  • start_vertex_index (int) – the start positional vertex index

  • end_vertex_index (int) – the end positional vertex index

static unwrapUnassigned()[source]#
re-wrap/extend islands in correspondence to the changed seams and inserted faces. Pay attention, that it may lead to islands intersection.
static applyUVSet()[source]#
apply uv changes to the paint room mesh (if we use uv/paint context)
class Model[source]#

Bases: object

The class that corresponds to the retopo/modeling rooms meshes. This is advanced version of the Mesh that allows essential topology changes on the fly.
It is very similar to Mesh by basic functionality, may be easily converted to Mesh and vice versa. But it is more heavy structure, use Mesh if you don’t need the advanced functionality.
transform(m: any) Model[source]#
transform the whole Model with the matrix
Parameters:

m – the transformation matrix

Returns:

the reference to the Model

Return type:

Model

MakeCopy() Model[source]#
make a copy of the source mesh. Pay attention, if you taken it from the retopo/uv context, it will no longer refer to the retopo/uv mesh, it will be independent copy
static fromRetopo() Model[source]#
get the reference to the mesh in the retopo room
Returns:

the reference to the mesh

Return type:

Model

static fromModeling() Model[source]#
get the reference to the mesh in the modeling room, currently it is the same mesh as in the retopo room
Returns:

the reference to the mesh

Return type:

Model

static fromUv() Model[source]#
get the reference to the mesh in the uv room, pay attention that topology changes to that mesh may lead to instability!
Returns:

the reference to the mesh

Return type:

Model

UpdateMesh()[source]#
Apply changes on the mesh
displayOptions(showWireframe: bool = True, showColored: bool = True, showSeams: bool = True, showSharpEdges: bool = True, smoothView: bool = False)[source]#
Set the display options for the retopo/modeling/uv meshes
Parameters:
  • showWireframe (bool) – show the wireframe

  • showColored (bool) – show colored clusters

  • showSeams (bool) – show seams

  • showSharpEdges (bool) – show sharp edges

  • smoothView (bool) – smooth view

getObjectsCount() int[source]#
get the retopo groups count
Returns:

the amount

Return type:

int

getCurrentObject() int[source]#
get the index of the current group
Returns:

the index

Return type:

int

setCurrentObject(index: int)[source]#
set the current group index
Parameters:

index (int) – the index

getObjectName(group_index: int) str[source]#
get the retopo group name
Parameters:

group_index (int) – the group index

Returns:

the name

Return type:

str

removeObject(group_index: int)[source]#
remove the group by index
setObjectName(index: int, name: str)[source]#
rename the group by index
Parameters:
  • index (int) – the group index to rename

  • name (str) – the new name

setObjectVisibility(index: int, visible: bool)[source]#
set the group visibility
Parameters:
  • index (int) – the group index

  • visible (bool) – the visibility state

getObjectVisibility(index: int) bool[source]#
get the group visibility
Parameters:

index (int) – the group index

Returns:

the visibility state

Return type:

bool

addObject(name: str) int[source]#
add new retopo group
Parameters:

name (str) – the group name

Returns:

the index of new group

Return type:

int

addMaterial(name: str) int[source]#
add the new UV set/Material
Parameters:

name (str) – the name

Returns:

the new UV set/Material index

Return type:

int

removeUnusedMaterials()[source]#
remove all unused UV sets (not referred within the mesh)
getObjectReferenceColor(group_index: int) any[source]#
get the group reference color
Parameters:

group_index (int) – the group index

Returns:

the (r,g,b,a) vector, 0..255

Return type:

any

setObjectReferenceColor(group_index: int, color: any)[source]#
set the group reference color
Parameters:
  • group_index (int) – the group index

  • color – the (r,g,b,a) vector, 0..255

selectedToObject(group_index: int)[source]#
move the selected faces to the group
Parameters:

group_index (int) – the group index

getWholeMesh() Mesh[source]#
get the whole mesh from the retopo room
Returns:

the Mesh object

Return type:

Mesh

selectedToMesh() Mesh[source]#
get the selected faces as the Mesh object
Returns:

the Mesh

Return type:

Mesh

visibleToMesh() Mesh[source]#
get the visible faces as the Mesh object
Returns:

teh Mesh

Return type:

Mesh

addTransformed(mesh: Mesh, Transform: any = 4, b: BoolOpType = BoolOpType.BOOL_MERGE, select: bool = False, snap_to_existing: bool = False)[source]#
insert the mesh to the retopo/modeling room, each object of the mesh treated as the new retopo layer
Parameters:
  • mesh (Mesh) – the Mesh object

  • Transform – the transformation matrix

  • b (BoolOpType) – the boolean operation type

  • select (bool) – the flag that indicates if we need to select faces of the the inserted mesh, used only if b is BOOL_MERGE

  • snap_to_existing (bool) – the flag that indicates if we need to snap the mesh to the existing sculpt/paint objects

getObjectMesh(group_index: int) Mesh[source]#
get the mesh from some retopo group
Parameters:

group_index (int) – the group index

Returns:

the Mesh object

Return type:

Mesh

setObjectMesh(group_index: int, mesh: Mesh, transform: any = 4)[source]#
replace the retopo layer with mesh
Parameters:
  • group_index (int) – the group index

  • mesh (Mesh) – the Mesh object to insert

  • transform – the transformation matrix

duplicateObject(group_index: int, name: str = None, transform: any = 4, select: bool = False) int[source]#
duplicate the object (retopo group)
Parameters:
  • group_index (int) – the object/group index

  • name (str) – the new name, if not passed the name will be generated automatically

  • transform – the additional transformation matrix

  • select (bool) – the flag that indicates if we need to select the new object’s faces (in addition to existing selection)

Returns:

the new object index

Return type:

int

generateName(base: str) str[source]#
generate unique name for the object, it will start as the string in base base
Parameters:

base (str) – the base name

Returns:

the unique name

Return type:

str

clearObjectMesh(group_index: int)[source]#
remove all faces from the group
Parameters:

group_index (int) – the group index

clear()[source]#
clear the whole mesh
dropUndo()[source]#
Drop the whole mesh to the undo queue, it is important if you want allow the user to undo your mesh changes, call it before your changes. It works for UV room too.
getSelectedFaces() list[int][source]#
get the list of selected faces
Returns:

the list of selected faces

Return type:

list[int]

setSelectedFaces(faces: list[int])[source]#
set the selected faces list
Parameters:

faces (list[int]) – the faces indices list

selectFace(face: int)[source]#
select the face by index
Parameters:

face (int) – the face index

selectObject(group_index: int, add_to_selected: bool = True)[source]#
select all feces in the group
Parameters:

group_index (int) – the group index

getObjectFaces(group_index: int) list[int][source]#
get the list of faces in the group
Parameters:

group_index (int) – the group index

Returns:

the list of faces

Return type:

list[int]

isFaceSelected(face: int) bool[source]#
check if the face selected
Parameters:

face (int) – the face index

Returns:

the selection state

Return type:

bool

unselectAllFaces()[source]#
unselect all faces
expandSelection()[source]#
expand the faces/vertices/edges selection to the connected geometry
contractSelection()[source]#
contract the faces/vertices/edges selection to the connected geometry
selectedToEdges()[source]#
convert faces/vertices selection to edges selection
selectedToFaces()[source]#
convert edges/vertices selection to faces selection
selectedToVertices()[source]#
convert faces/edges selection to vertices selection
getSelectedEdges() list[int][source]#
returns even amount of vertex indices, pairs os start and end vertices of the selected edges
Returns:

the list of vertex indices (pairs)

Return type:

list[int]

setSelectedEdges(edges: list[int])[source]#
set the selected edges list
Parameters:

edges (list[int]) – the edges indices list (should be even amount of indices)

selectEdge(vertex1: int, vertex2: int)[source]#
select the edge by vertex indices (add to selection)
Parameters:
  • vertex1 (int) – the first vertex index

  • vertex2 (int) – the second vertex index

isEdgeSelected(vertex1: int, vertex2: int) bool[source]#
check if the edge is selected, order of vertices has no matter
Parameters:
  • vertex1 (int) – the first vertex index

  • vertex2 (int) – the second vertex index

Returns:

true if the edge is selected

Return type:

bool

unselectAllEdges()[source]#
unselect all edges
getSelectedVertices() list[int][source]#
get the list of selected vertices
Returns:

the list of selected vertices

Return type:

list[int]

getSelectedVerticesWeights() list[float][source]#
get the soft selection weights of the selected vertices, 1 is maximum value
Returns:

the list of weights, the size of the list is equal to the size of the selected vertices list

Return type:

list[float]

setSelectedVertices(vertices: list[int], weights: list[float])[source]#
set the selected vertices list
Parameters:
  • vertices (list[int]) – the list of vertices indices

  • weights (list[float]) – the list of soft selection weights, the size of the list should be zero or equal to the size of the vertices list. If it is empty, the vertices will be selected with the maximal weight

selectVertex(vertex: int, weight: float = 1.0)[source]#
add the vertex to the selection
Parameters:
  • vertex (int) – the vertex index

  • weight (float) – the soft selection weight, 1 is maximum value

isVertexSelected(vertex: int) bool[source]#
check if the vertex is selected
Parameters:

vertex (int) – the vertex index

Returns:

true if the vertex is selected

Return type:

bool

unselectAllVertices()[source]#
unselect all vertices
facesCount() int[source]#
get the faces count
Returns:

the faces count

Return type:

int

vertsCount() int[source]#
get the positional vertices count
Returns:

the vertices count

Return type:

int

vertsUvCount() int[source]#
get the uv vertices count
Returns:

the uv vertices count

Return type:

int

removeFace(face: int)[source]#
remove the face by index
Parameters:

face (int) – the face index

createNewFace(Group: int, UVSet: int) int[source]#
create empty face, you need to call setFaceVertices to set the vertices, setFaceUVVerts to set the UV vertices
Parameters:
  • Group (int) – the face group index

  • UVSet (int) – the UV set index

Returns:

the new face index

Return type:

int

getFaceVertsCount(face: int) int[source]#
get the vertices count over the face
Parameters:

face (int) – the face index

Returns:

the vertices count

Return type:

int

getFaceVertex(face: int, vertex_index: int) int[source]#
get the vertex index over the face
Parameters:
  • face (int) – the face index

  • vertex_index (int) – the vertex index over the face

Returns:

the vertex index, -1 if the vertex/face index is out of range

Return type:

int

getFaceVerts(face: int) list[int][source]#
get the list of UV vertex indices over the face, pay attention UV vertices are not same as position vertices
Parameters:

face (int) – the face index

Returns:

the list of vertex indices

Return type:

list[int]

setFaceVerts(face: int, vertices: list[int])[source]#
set the list of positional vertex indices over the face
Parameters:
  • face (int) – the face index

  • vertices (list[int]) – the list of vertex indices

getFaceVisibility(face: int) bool[source]#
get the face visibility
Parameters:

face (int) – the face index

Returns:

the visibility state

Return type:

bool

setFaceVisibility(face: int, visibility: bool)[source]#
set the face visibility
Parameters:
  • face (int) – the face index

  • visibility (bool) – the visibility state

getFaceSquare(face: int) float[source]#
get the face square
Parameters:

face (int) – the face index

Returns:

the square

Return type:

float

getFaceUVSquare(face: int) float[source]#
get the face square in UV space
Parameters:

face (int) – the face index

Returns:

the square

Return type:

float

getFaceNormal(face: int) any[source]#
get the face normal
Parameters:

face (int) – the face index

Returns:

the face normal

Return type:

any

getFaceObject(face: int) int[source]#
get the group index of the face
Parameters:

face (int) – the face index

Returns:

the group index

Return type:

int

setFaceObject(face: int, group: int)[source]#
set the group index of the face
Parameters:
  • face (int) – the face index

  • group (int) – the group index

getFaceMaterial(face: int) int[source]#
get the UV set index for the face
Parameters:

face (int) – the face index

Returns:

the UV set index, -1 if out of range

Return type:

int

setFaceMaterial(face: int, uv_set: int)[source]#
set the UV set for the face
Parameters:
  • face (int) – the face index

  • uv_set (int) – the UV set index

getFaceUvVertsCount(face: int) int[source]#
get the amount of UV vertices over the face
Parameters:

face (int) – the face index

Returns:

amount of vertices over the face, 0 if UV-s not assigned

Return type:

int

getFaceUvVertex(face: int, vertex_index: int) int[source]#
get the UV vertex index over the face
Parameters:
  • face (int) – the face index

  • vertex_index (int) – the vertex index over the face

Returns:

the UV vertex index, -1 if the vertex/face index is out of range

Return type:

int

getFaceUvVerts(face: int) list[int][source]#
get the list of UV vertices indices over the face
Parameters:

face (int) – the face index

Returns:

the list of UV vertices indices

Return type:

list[int]

setFaceUvVerts(face: int, vertices: list[int])[source]#
set the UV vertices for the face
Parameters:
  • face (int) – the face index

  • vertices (list[int]) – the UV vertices list

getVertex(vertex: int) any[source]#
get the vertex position in space
Parameters:

vertex (int) – the vertex index

Returns:

the position

Return type:

any

setVertex(vertex: int, position: any)[source]#
set the vertex position in space
Parameters:
  • vertex (int) – the vertex index

  • position – the position

createNewVertex(position: any) int[source]#
create the positional vertex
Parameters:

position – the position

Returns:

the positional vertex index

Return type:

int

getVertexUV(uv_vertex: int) any[source]#
get the UV coordinates of the UV vertex
Parameters:

uv_vertex (int) – the uv vertex index

Returns:

teh UV coordinates

Return type:

any

setVertexUV(uv_vertex: int, uv: any)[source]#
set the UV for the UV vertex
Parameters:
  • uv_vertex (int) – the uv vertex index

  • uv – the UV coordinates

createNewUvVertex(uv: any) int[source]#
create new UV vertex to be used for faces
Parameters:

uv – the texture coordinates

Returns:

the index

Return type:

int

getVertexNormal(vertex: int) any[source]#
get vertex normal, calculated as average of adjacent faces normals
Parameters:

vertex (int) – the vertex index

Returns:

the normal

Return type:

any

updateNormals(for_snapping: bool = True)[source]#
update the vertex normals
Parameters:

for_snapping (bool) – if true, the normals will lay in the middle of faces, ne respecting the faces square.

updateTopology()[source]#
update the connectivity information, it should be called sometimes if you feel that the connectivity information lost due to some heavy operations
cleanup()[source]#
complete cleanul from non-manifolds or other problems, some faces may be removed
getVertsNearVertex(vertex: int) list[int][source]#
get the list of vertices that are adjacent to the vertex
Parameters:

vertex (int) – the vertex index

Returns:

the list of adjacent vertices

Return type:

list[int]

getFacesNearVertex(vertex: int) list[int][source]#
get the list of faces that are adjacent to the vertex
Parameters:

vertex (int) – the vertex index

Returns:

the list of adjacent faces

Return type:

list[int]

getFaceNeighbors(face: int) list[int][source]#
get the list of faces that are adjacent to the face
Parameters:

face (int) – the face index

Returns:

the list of adjacent faces

Return type:

list[int]

getFacesNearEdge(vertex1: int, vertex2: int) list[int][source]#
get the list of faces that are adjacent to the edge
Parameters:
  • vertex1 (int) – the positional vertex index (1)

  • vertex2 (int) – the positional vertex index (2)

Returns:

the list of adjacent faces

Return type:

list[int]

isOpenEdge(vertex1: int, vertex2: int) bool[source]#
check if the edge is open
Parameters:
  • vertex1 (int) – the positional vertex index (1)

  • vertex2 (int) – the positional vertex index (2)

Returns:

true if open

Return type:

bool

isSharpEdge(vertex1: int, vertex2: int) bool[source]#
check if the edge is sharp
Parameters:
  • vertex1 (int) – the positional vertex index (1)

  • vertex2 (int) – the positional vertex index (2)

Returns:

true if sharp

Return type:

bool

setEdgeSharpness(vertex1: int, vertex2: int, sharp: bool)[source]#
set the sharpness state for the edge
Parameters:
  • vertex1 (int) – the positional vertex index (1)

  • vertex2 (int) – the positional vertex index (2)

  • sharp (bool) – the sharpness state

isSeam(vertex1: int, vertex2: int) bool[source]#
check if edge is seam
Parameters:
  • vertex1 (int) – the positional vertex index (1)

  • vertex2 (int) – the positional vertex index (2)

Returns:

true if seam

Return type:

bool

setEdgeSeam(vertex1: int, vertex2: int, seam: bool)[source]#
set or clear the seam state for the edge
Parameters:
  • vertex1 (int) – the positional vertex index (1)

  • vertex2 (int) – the positional vertex index (2)

  • seam (bool) – the seam state

collapseEdge(vertex1: int, vertex2: int)[source]#
collapse the edge to the middle of the edge
Parameters:
  • vertex1 (int) – the positional vertex index (1)

  • vertex2 (int) – the positional vertex index (2)

islandsCount(uv_set: int) int[source]#
get the islands count over the current uv-set
Parameters:

uv_set (int) – the uv-set index

Returns:

teh islands count

Return type:

int

islandToMesh(uv_set: int, island_index: int) Mesh[source]#
get the mesh that contains the island, xy of each point is the UV coordinate. The mesh contains only one island
Parameters:
  • uv_set (int) – the uv set index

  • island_index (int) – the island index within the uv set

Returns:

the flat mesh

Return type:

Mesh

islandToMeshInSpace(uv_set: int, island_index: int) Mesh[source]#
get the mesh that contains the island, each point is the coordinate in space (not the uv coordinate!). The mesh contains only one island. The faces correspond to the faces of the mesh that was got by islandToMesh
Parameters:
  • uv_set (int) – the uv set index

  • island_index (int) – the island index within the uv set

Returns:

s mesh the 3D mesh

Return type:

Mesh

getIslandVertexMapping(uv_set: int, island_index: int) list[int][source]#
get the mapping from the vertex index in the mesh that was got by islandToMesh to the vertex index in the original mesh
Parameters:
  • uv_set (int) – the uv set index

  • island_index (int) – the island index within the uv set

Returns:

the list of the positional vertex indices of the original mesh in same order as the vertices in the mesh that was got by islandToMesh

Return type:

list[int]

getIslandBorder(uv_set: int, island_index: int) list[int][source]#
get unsorted list of edges on the border of the island
Parameters:
  • uv_set (int) – the uv set index

  • island_index (int) – the island index within the uv set

Returns:

the list of edges, even amount of elements, each pair of elements is the positional vertex indices of the original mesh

Return type:

list[int]

getBorderBetweenIslands(uv_set1: int, island_index1: int, uv_set2: int, island_index2: int) list[int][source]#
get the border between two islands
Parameters:
  • uv_set1 (int) – the uv set index of the first island

  • island_index1 (int) – the island index within the uv set of the first island

  • uv_set2 (int) – the uv set index of the second island

  • island_index2 (int) – the island index within the uv set of the second island

Returns:

the list of edges that are common for both islands, even amount of elements, each pair of elements is the positional vertex indices of the original mesh

Return type:

list[int]

getIslandVertexUv(uv_set: int, island_index: int, vertex_index: int) any[source]#
get the uv coordinate of the positional vertex in the island
Parameters:
  • uv_set (int) – the uv set index

  • island_index (int) – the island index within the uv set

  • vertex_index (int) – the positional vertex index

Returns:

the uv coordinate of the vertex, vec2(0,0) if the vertex is not in the island

Return type:

any

static flattenSingleIsland(mesh: Mesh, method: int, optimize_rotation: bool = True, scale_to_geometry: bool = True) Mesh[source]#
Flatten the mesh that consists of the single island
Parameters:
  • mesh (Mesh) – the mesh that consists of the single island

  • method (int) – the flattening method. 0 - flatten to the plane, 1 - LSCM, 2 - ABF, 3 - GU, 4 - Stripe (if possible)

  • optimize_rotation (bool) – optimize the rotation of the island, place it approximately horizontally or vertically

  • scale_to_geometry (bool) – scale the island to keep average edge length equal to the average edge length of the original mesh

Returns:

the flat mesh

Return type:

Mesh

meshToIsland(mesh: Mesh, uv_set: int, island_index: int)[source]#
use the mesh (that was previously got by islandToMesh) to replace the island in the current uv-set
Parameters:
  • mesh (Mesh) – the mesh that was previously got by islandToMesh

  • uv_set (int) – the uv set index

  • island_index (int) – the island index within the uv set

pack(uv_set: int, rotate: bool, shuffle: bool)[source]#
pack the islands in the current uv-set
Parameters:
  • uv_set (int) – the uv set index

  • rotate (bool) – allow rotation while packing

  • shuffle (bool) – shuffle the identical islands to avoid the exact overlapping

unwrap(uv_set: int)[source]#
unwrap the current uv-set
Parameters:

uv_set (int) – the uv set index

toAbf(uv_set: int, island_index: int)[source]#
unwrap the island using the ABF approach
Parameters:
  • uv_set (int) – the uv set index

  • island_index (int) – the island index within the uv set

toLscm(uv_set: int, island_index: int)[source]#
unwrap the island using the LSCM approach
Parameters:
  • uv_set (int) – the uv set index

  • island_index (int) – the island index within the uv set

toGu(uv_set: int, island_index: int)[source]#
unwrap the island using the GU (Globally Uniform) approach
Parameters:
  • uv_set (int) – the uv set index

  • island_index (int) – the island index within the uv set

toPlanar(uv_set: int, island_index: int)[source]#
unwrap the island using the Planar approach
Parameters:
  • uv_set (int) – the uv set index

  • island_index (int) – the island index within the uv set

toStripe(uv_set: int, island_index: int)[source]#
try to uwrap the island as the regular stripe
Parameters:
  • uv_set (int) – the uv set index

  • island_index (int) – the island index within the uv set

extrudeSelected()[source]#
Extrude the selected edges or selected faces without the actual moving of the extruded elements. They stay selected, so you amy apply some transform to the selected elements
moveSelectedFacesAlongFacesNormals(displacement: float)[source]#
move selected faces along the faces normals, trying to keep faces parallel to the original direction
Parameters:

displacement (float) – the displacement value

moveSelectedFacesAlongVertexNormals(displacement: float)[source]#
move selected faces along the vertex normals, each vertex displace on the same distance
Parameters:

displacement (float) – the displacement value

subdivideSelectedFaces(apply_catmull_clark: bool = False)[source]#
subdivide the selected faces
Parameters:

apply_catmull_clark (bool) – apply the catmull-clark subdivision

subdivide(apply_catmull_clark: bool = True)[source]#
subdivide the whole mesh
Parameters:

apply_catmull_clark (bool) – apply the catmull-clark subdivision

transformSelected(transform: any, apply_symmetry: bool)[source]#
apply the transformation to the selected elements
Parameters:
  • transform – the transformation matrix

  • apply_symmetry (bool) – apply the global symmetry

scaleSelectedFacesClusters(scale: float, method: ClusterScale = ClusterScale.Uniform_Scaling)[source]#
scale each selection cluster separately, to own center mass
Parameters:

scale (float) – the scale coefficient

bevelOverSelectedVertices(size: float)[source]#
perform the bevel over the selected vertices. As result, new faces will be selected
Parameters:

size (float) – the bevel size

bevelOverSelectedEdges(size: float, segments: int = 1, OldVariant: bool = False)[source]#
perform the bevel over the selected edges.
Parameters:
  • size (float) – the bevel width

  • OldVariant (bool) – if true the older variant of the bevel (splits edges in strightforward way), in some cases it works more stable.

splitEdge(vertex1: int, vertex2: int, position: float) int[source]#
split existing edge somewhere between vertices.
Parameters:
  • vertex1 (int) – the positional vertex index (1)

  • vertex2 (int) – the positional vertex index (2)

  • position (float) – the position to split the edge, [0..1], 0 - near the vertex1, 1 - near the vertex2

Returns:

the new vertex index

Return type:

int

connect(vertex1: int, vertex2: int) bool[source]#
split existing edge somewhere between vertices.
Parameters:
  • vertex1 (int) – the positional vertex index (1)

  • vertex2 (int) – the positional vertex index (2)

Returns:

true if succeeed to connect

Return type:

bool

checkConnectivity(vertex1: int, vertex2: int) bool[source]#
check if connecting the two vertices is possible
Parameters:
  • vertex1 (int) – the positional vertex index (1)

  • vertex2 (int) – the positional vertex index (2)

Returns:

true if connection is possible

Return type:

bool

connectSelectedVerts()[source]#
connect selected vertices in smart way
invertSelectedFacesTopoplogically()[source]#
invert selected faces only within the connective area, if some objects has no selected faces, the selection there will not change
inset(distance: float)[source]#
perform the inset over the selected faces
shell()[source]#
perform the shell operation over the selected faces. After calling the shell() you should call the moveSelectedFacesAlongFacesNormals or moveSelectedFacesAlongVertexNormals
to give some thickness to the resulting figure
intrude()[source]#
perform the intrude operation over the selected faces. After calling the intrude() you should call the moveSelectedFacesAlongFacesNormals or moveSelectedFacesAlongVertexNormals
to give some thickness to the resulting figure
relaxSelected()[source]#
relax selected vergtices
selectPath(vertex1: int, vertex2: int)[source]#
select all edges on the path from vertex1 to vertex2 (add to existing edges selection)
Parameters:
  • vertex1 (int) – the first vertex

  • vertex2 (int) – the second vertex

getPath(vertex1: int, vertex2: int) list[int][source]#
get all vertices on the path from vertex1 to vertex2
Parameters:
  • vertex1 (int) – the first vertex

  • vertex2 (int) – the second vertex

class logger[source]#

Bases: object

open()[source]#
open the accumulated log in the default text editor
showMessage()[source]#
show the accumulated log in the message box
directTo(filename: str) logger[source]#
Direct the log output to the file
Parameters:

filename (str) – the filename to log there. The filename may be relative path.

Returns:

the logger reference

Return type:

logger

getFullPath() any[source]#
Returns the absolute path to the log file.
Returns:

the absolute path even if you passed the relative path.

Return type:

any

flush() logger[source]#
save all acumulated text to the file
Returns:

the chain reference

Return type:

logger

newline() logger[source]#
start newline in the text file
Returns:

the chain reference

Return type:

logger

timestamp() logger[source]#
add the timestamp to the log as the
Returns:

the reference

Return type:

logger

startTimer() logger[source]#
start the timer to profile some operation
Returns:

the reference

Return type:

logger

endTimer() logger[source]#
stop the timer and output the time into the log as amount of microseconds
Returns:

the reference

Return type:

logger

floatPrecission(signs: int = 2) logger[source]#
set the precission of floating-point output
Returns:

the reference

Return type:

logger