Coat python module

Contents

Coat python module#

The Coat module includes high-level CoreAPI commands that are easy to use but do not provide access to low-level processes and data structures. This module does not have its own source code; it imports and includes modules like this:

coat.py#
  from cPy.CoreAPI import *
  from cPy.cTypes import *
  from cPy.PrimAPI import *

  from cPy.cTypes import cVec2 as vec2
  from cPy.cTypes import cVec3 as vec3
  from cPy.cTypes import cVec4 as vec4
  from cPy.cTypes import cMat3 as mat3
  from cPy.cTypes import cMat4 as mat4
  from cPy.cTypes import cRect as rect
  from cPy.cTypes import cQuat as quat
  from cPy.cTypes import cRotation as rotation
  from cPy.cTypes import cAngles as angles
  from cPy.cTypes import cBounds as boundbox

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

cPy.cTypes module#

class cStr(Src: str)[source]#

Bases: object

A custom string class optimized for performance and ease of use. *
This class provides a wide range of string manipulation functions, including
dynamic resizing, formatting, path handling, and type conversions.
It is designed to work with standard C-style strings and provides
safe memory management.
ToCharPtr() str[source]#
Returns a pointer to the internal character buffer.
Returns:

A const char pointer to the string data. Returns a pointer to an empty string if null.

Return type:

str

ToNonConstCharPtr() str[source]#
Length() int[source]#
rief Gets the length of the string.
SetLength(Length: int, Fill: any)[source]#
Ensures needed capacity and sets a specified length.
Parameters:
  • Length (int) – The new length of the string.

  • Fill – The character to fill new space with if expanding.

CalcLength()[source]#
Recalculates the length based on the actual null terminator position.
Useful after direct buffer manipulation via ToCharPtr().
Fill(c: any)[source]#
rief Fills the entire string with a specified character.
IsEmpty() bool[source]#
rief Checks if the string is empty.
empty() bool[source]#
rief Checks if the string length is 0 (STL compatibility).
Clear()[source]#
rief Clears the string content (sets length to 0).
Empty: cStr#
brief A static constant representing an empty string.
static Equals(l: cStr, r: cStr) bool[source]#
static EqualsNoCase(l: cStr, r: cStr, MaxLength: int) bool[source]#
static Compare(l: cStr, r: cStr, MaxLength: int) int[source]#
static CompareNoCase(l: cStr, r: cStr, MaxLength: int) int[source]#
static EqualsPath(l: cStr, r: cStr, MaxLength: int) bool[source]#
static ComparePath(l: cStr, r: cStr, MaxLength: int) int[source]#
StartsWith(Str: str, NoCase: bool = False) bool[source]#
Determines whether the beginning of this instance matches the specified string.
Parameters:
  • Str (str) – The string to compare.

  • NoCase (bool) – If true, ignores case.

Returns:

True if it starts with Str or if Str is empty.

Return type:

bool

EndsWith(Str: str, NoCase: bool = False) bool[source]#
Determines whether the end of this instance matches the specified string.
Parameters:
  • Str (str) – The string to compare.

  • NoCase (bool) – If true, ignores case.

Returns:

True if it ends with Str or if Str is empty.

Return type:

bool

static ToString(DoubleArray: float, Count: int, Prec: int = 6, Separator: str = ' ') cStr[source]#
static ToHex(Ptr: any) cStr[source]#
rief Converts pointer address to hex string.
AppendWithEndLn(Src: cStr)[source]#
rief Appends a string followed by a newline.
EndLn: cStr#
brief Static newline constant.
AppendPath(Path: str)[source]#
rief Appends a path segment, automatically adding a slash or backslash.
Insert(Index: int, Src: float, Prec: int = 6)[source]#
Remove(StartIndex: int, Count: int)[source]#
Deletes a specific number of characters.
Parameters:
  • StartIndex (int) – Position to start removing.

  • Count (int) – Number of characters to remove.

ReplaceCommaWithDot()[source]#
rief Utility to replace commas with dots (e.g. for localization fixing).
Replace(String: str, WithString: str, StartIndex: int, Count: int, NoCase: bool = False) int[source]#
ReplaceFirst(String: str, WithString: str, StartIndex: int, Count: int, NoCase: bool = False) int[source]#
ReplaceAny(Chars: str, WithChar: any, StartIndex: int, Count: int)[source]#
Substring(StartIndex: int, Count: int) cStr[source]#
rief Retrieves a substring of specified length.
TrimStart(TrimChars: str)[source]#
rief Removes specified characters from the start of the string.
TrimEnd(TrimChars: str)[source]#
rief Removes specified characters from the end of the string.
Trim(TrimChars: str)[source]#
rief Removes specified characters from both start and end.
PadLeft(TotalWidth: int, PaddingChar: any)[source]#
rief Right-aligns characters, padding on the left.
PadRight(TotalWidth: int, PaddingChar: any)[source]#
rief Left-aligns characters, padding on the right.
Contains(Str: str, NoCase: bool = False) bool[source]#
rief Checks if the string contains a substring.
IndexOf(c: any) int[source]#
rief Returns the index of the first occurrence of a character, or -1.
IndexOfAny(Chars: str, StartIndex: int, Count: int) int[source]#
LastIndexOf(Str: str, StartIndex: int, Count: int, NoCase: bool = False) int[source]#
LastIndexOfAny(Chars: str, StartIndex: int, Count: int) int[source]#
static ToLower(c: any) any[source]#
rief Static helper to convert char to lower case.
static ToUpper(c: any) any[source]#
rief Static helper to convert char to upper case.
MakeLower(start: int = 0)[source]#
rief Converts this string instance to lowercase in place.
MakeUpper(start: int = 0)[source]#
rief Converts this string instance to uppercase in place.
static Formatv(Format: str, Args: any) cStr[source]#
Creates a formatted string (printf style).
Parameters:

Format (str) – The format string.

Returns:

A new formatted cStr.

Return type:

cStr

static CharIsLower(c: int) bool[source]#
rief Helper: Is character lowercase?
static CharIsUpper(c: int) bool[source]#
rief Helper: Is character uppercase?
static CharIsAlpha(c: int) bool[source]#
rief Helper: Is character alphabetical?
static CharIsNumeric(c: int) bool[source]#
rief Helper: Is character a digit?
static CharIsHexadecimal(c: int) bool[source]#
rief Helper: Is character hexadecimal digit?
static CharIsNewLine(c: int) bool[source]#
rief Helper: Is character a newline type?
static CharIsTab(c: int) bool[source]#
rief Helper: Is character a tab?
static CharIsWhitespace(c: int) bool[source]#
rief Helper: Is character whitespace?
static CharIsDecimalPoint(c: int) bool[source]#
rief Helper: Is character a decimal point (. or ,)?
static CharIsSign(c: int) bool[source]#
rief Helper: Is character a sign (+ or -)?
static CharIsExponent(c: int) bool[source]#
rief Helper: Is character part of exponent notation (e, E, d, D)?
static ToInt(Str: str, Value: int) bool[source]#
rief Parses string to integer.
static ToFloat(Str: str, Value: float) bool[source]#
rief Parses string to float.
GetHashCode(NoCase: bool = False) int[source]#
rief Calculates a hash code for the string.
GetFileExtension() cStr[source]#
rief Extracts file extension from path.
GetFileName() cStr[source]#
rief Extracts file name (with extension) from path.
GetFileBase() cStr[source]#
rief Extracts file base name (no path, no extension).
GetFilePath() cStr[source]#
rief Extracts directory path (excluding filename).
RemoveFileExtension()[source]#
rief Removes extension from the string (in place).
RemoveFileName()[source]#
rief Removes filename, leaving only path (in place).
RemoveFilePath()[source]#
rief Removes path, leaving only filename (in place).
RemoveFileAbsPath(AbsPath: str)[source]#
rief Removes absolute path prefix if present.
AppendFileRelPath(RelPath: str)[source]#
rief Appends a relative path correctly.
SetFileExtension(Extension: str)[source]#
rief Sets or replaces file extension.
SetFileDefaultExtension(DefaultExtension: str)[source]#
rief Sets extension only if none exists.
SetFilePath(Path: str)[source]#
rief Sets or replaces the directory path.
SetFileDefaultPath(DefaultPath: str)[source]#
rief Sets path only if none exists.
EnsureTrailingBackslash()[source]#
rief Ensures string ends with a backslash.
EnsureTrailingSlash()[source]#
rief Ensures string ends with a forward slash.
EnsureTrailingPlatformSlash()[source]#
rief Ensures trailing slash based on current platform (Windows/Linux/Mac).
SlashesToBackSlashes()[source]#
BackSlashesToSlashes()[source]#
rief Converts all backslashes to forward slashes.
MakePlatformSlashes()[source]#
rief Normalizes slashes based on current platform.
CalcUTF8Length(StartIndex: int) int[source]#
Init()[source]#
rief Resets internal state to empty.
Free()[source]#
rief Frees memory and resets state.
Copy(_0: any)[source]#
toWstring() any[source]#
Append(_0: any)[source]#
class cVec2(v: cVec2)[source]#

Bases: object

A 2D vector class providing linear algebra operations and geometry functions. *
This class represents a 2-component vector (x, y) and includes methods for
arithmetic, geometric transformations (dot, cross, normalize), matrix multiplication,
and various utility functions (lerp, clamp, reflect). *
Refer to it as coat::vec2 in the Core API.
x: float#
The X component of the vector.
y: float#
The Y component of the vector.
Copy(Src: float)[source]#
SetZero()[source]#
Sets the vector to (0, 0).
SetOne()[source]#
Sets the vector to (1, 1).
Set(X: float, Y: float)[source]#
Sets components to specific X and Y values.
Transform(_0: any)[source]#
Transforms the vector by a 3x3 matrix.
Treats the vector as a direction (x, y, 0).
TransformCoordinate(_0: any)[source]#
Transforms the vector by a 4x4 matrix treating it as a point.
Implicitly extends to (x, y, 0, 1) and projects the result back
by dividing by w (Perspective divide).
TransformNormal(_0: any)[source]#
Transforms the vector by a 4x4 matrix treating it as a normal/direction.
Implicitly extends to (x, y, 0, 0), ignoring translation.
static Equals(_0: cVec2, _1: cVec2, Eps: float) bool[source]#
Checks if two vectors are equal within a given epsilon tolerance.
Length() float[source]#
Returns the length (magnitude) of the vector.
LengthSq() float[source]#
Returns the squared length of the vector (faster than Length).
Normalize() float[source]#
Normalizes the vector in place. Returns the previous length.
NormalizeSafe(Fallback: cVec2) float[source]#
Normalizes the vector safely.
Parameters:

Fallback (cVec2) – The value to assign if the vector length is zero.

Returns:

The previous length, or 0.0f if the vector was zero.

Return type:

float

IsValid() bool[source]#
Checks if the vector components are valid numbers (not NaN/Inf).
IsNormalized(Eps: float) bool[source]#
Checks if the vector is normalized (length == 1) within tolerance.
IsZero(Eps: float) bool[source]#
Checks if the vector is zero (length == 0) within tolerance.
static Round(_0: cVec2) cVec2[source]#
Returns a new vector with components rounded to the nearest integer.
ToRound() cVec2[source]#
Returns a new vector with this vector’s components rounded.
static Abs(_0: cVec2) cVec2[source]#
Returns a vector containing the absolute values of the components.
static Fract(_0: cVec2) cVec2[source]#
Returns the fractional part of the components.
static Angle(_0: cVec2, _1: cVec2) float[source]#
Returns the angle in degrees between two vectors.
static AreaSigned(t0: cVec2, t1: cVec2, t2: cVec2) float[source]#
Returns the signed area of the triangle formed by t0, t1, t2.
static Ccw(_0: cVec2, _1: cVec2) float[source]#
“Counter-Clockwise” or 2D Cross Product.
Returns:

The magnitude of the Z component of the cross product (u.x*v.y - u.y*v.x).

Return type:

float

static Clamp(Value: cVec2, Lo: cVec2, Hi: cVec2) cVec2[source]#
Clamps a vector between a Low and High range (component-wise).
static Distance(_0: cVec2, _1: cVec2) float[source]#
Calculates the distance between two vectors.
static DistanceSq(_0: cVec2, _1: cVec2) float[source]#
Calculates the squared distance between two vectors.
static Dot(_0: cVec2, _1: cVec2) float[source]#
Calculates the Dot Product of two vectors.
static Lerp(_0: cVec2, _1: cVec2, _2: float) cVec2[source]#
Linearly interpolates between two vectors.
static Lerp05(_0: cVec2, _1: cVec2) cVec2[source]#
Linearly interpolates between two vectors with factor 0.5.
static Max(_0: cVec2, _1: cVec2) cVec2[source]#
Returns the component-wise maximum of two vectors.
static Min(_0: cVec2, _1: cVec2) cVec2[source]#
Returns the component-wise minimum of two vectors.
static PerpCw(_0: cVec2) cVec2[source]#
Returns a vector perpendicular to u (Clockwise rotation 90 deg).
static PerpCcw(_0: cVec2) cVec2[source]#
Returns a vector perpendicular to u (Counter-Clockwise rotation 90 deg).
static Reflect(RayDir: cVec2, Normal: cVec2) cVec2[source]#
Reflects a ray direction off a surface normal.
static Refract(RayDir: cVec2, Normal: cVec2, Eta: float) cVec2[source]#
Refracts a ray direction through a surface normal with index of refraction Eta.
static Truncate(u: cVec2, MaxLength: float) cVec2[source]#
Truncates the vector length to MaxLength. Returns a new vector.
static RandRange1() cVec2[source]#
Returns a random vector with components in range [0, 1].
static RandNormal() cVec2[source]#
Returns a random normalized vector.
static Rand(Lo: cVec2, Hi: cVec2) cVec2[source]#
Returns a random vector between Lo and Hi.
distance2(_0: cVec2) float[source]#
Python-style distance squared.
distance(_0: cVec2) float[source]#
Python-style distance.
DistanceToLineSegSq(A: cVec2, B: cVec2, pScale: float = None) float[source]#
Squared distance from this point to a line segment AB.
static SegIntersection(L0: cVec2, L1: cVec2, R0: cVec2, R1: cVec2, l: float = None, r: float = None) bool[source]#
Calculates the intersection of two line segments.
static FromBaryCentric(t0: cVec2, t1: cVec2, t2: cVec2, u: float, v: float) cVec2[source]#
Calculates a position from Barycentric coordinates (u, v) on a triangle.
static FromPolar(Radius: float, Angle: float) cVec2[source]#
Creates a vector from Polar coordinates (Radius, Angle in degrees).
Zero: cVec2 = 0.0000 0.0000#
One: cVec2 = 1.0000 1.0000#
Infinity: cVec2 = 340282346638528859811704183484516925440.0000 340282346638528859811704183484516925440.0000#
AxisX: cVec2 = 1.0000 0.0000#
AxisY: cVec2 = 0.0000 1.0000#
AxisNegX: cVec2 = -1.0000 0.0000#
AxisNegY: cVec2 = 0.0000 -1.0000#
GetDimension() int[source]#
Returns the number of dimensions (2).
ToFloatPtr() float[source]#
Returns a pointer to the raw float data.
ToPolar(Radius: float, Angle: float)[source]#
Converts Cartesian coordinates to Polar (Radius, Angle).
ToBaryCentric(t0: cVec2, t1: cVec2, t2: cVec2, u: float, v: float) float[source]#
Calculates Barycentric coordinates of this point within triangle t0,t1,t2.
IsInsideTri(t0: cVec2, t1: cVec2, t2: cVec2) bool[source]#
Checks if this point lies inside the triangle t0,t1,t2.
ToString(Prec: int = 2) cStr[source]#
Converts the vector to a formatted string.
ToNormal() cVec2[source]#
Returns a normalized copy of this vector.
ToPerpCw() cVec2[source]#
Returns a copy rotated 90 degrees Clockwise.
ToPerpCcw() cVec2[source]#
Returns a copy rotated 90 degrees Counter-Clockwise.
AddWithWeight(src: cVec2, weight: float)[source]#
for compatibility with OpenSubdiv ////
SetPosition(aX: float, aY: float)[source]#
GetPosition() float[source]#
class cVec3(v: cVec3)[source]#

Bases: object

The 3D-vector, refer it as coat::vec3 in the Core API.
  • This class represents a 3-dimensional vector with float precision components (x, y, z).

It includes standard vector arithmetic, geometric operations, and transformation utilities.
x: float#
X component of the vector
y: float#
Y component of the vector
z: float#
Z component of the vector
Copy(Src: float)[source]#
SetZero()[source]#
Sets the vector to (0, 0, 0).
SetOne()[source]#
Sets the vector to (1, 1, 1).
SetRandRange1()[source]#
Sets components to random values in the range [0, 1].
Set(XY: cVec2, Z: float)[source]#
Sets components from a 2D vector and a Z value.
TransformCoordinate(_0: any)[source]#
Transforms the vector as a coordinate (position) using a 4x4 matrix.
TransformNormal(_0: any)[source]#
Transforms the vector as a normal using a 4x4 matrix.
TransformNormalTransposed(_0: any)[source]#
Transforms the vector as a normal using the transpose of a 4x4 matrix.
Transform(_0: any)[source]#
Transforms the vector using a 3x3 matrix.
Rotate(_0: any)[source]#
Rotates the vector using a rotation object.
distance(u: cVec3) float[source]#
Calculates the Euclidean distance to another vector.
distanceSq(u: cVec3) float[source]#
dot(u: cVec3) float[source]#
cross(u: cVec3, v: cVec3)[source]#
AddWithWeight(src: cVec3, weight: float)[source]#
Adds a weighted vector to this vector.
SetPosition(aX: float, aY: float, aZ: float)[source]#
GetPosition() float[source]#
static Equals(_0: cVec3, _1: cVec3, Eps: float) bool[source]#
Checks if two vectors are equal within a given epsilon tolerance.
Length() float[source]#
Returns the length (magnitude) of the vector.
Length2() float[source]#
Returns the length using fast sqrt approximation.
LengthSq() float[source]#
Returns the squared length of the vector.
LengthM() float[source]#
Returns the Manhattan distance (sum of absolute components).
Normalize() float[source]#
Normalizes the vector. Returns the original length.
Normalize2() float[source]#
Normalizes the vector using fast sqrt. Returns the squared length.
NormalizeSafe(Fallback: cVec3 = cVec3.AxisZ) float[source]#
Safely normalizes the vector. If length is zero, uses the Fallback vector.
FixDegenerateNormal() bool[source]#
Fixes degenerate normal vectors (NaN or zero length). Returns true if fixed.
FixDenormals() bool[source]#
Fixes denormalized floating point numbers in the vector.
IsValid() bool[source]#
Checks if the vector contains valid numbers (not NaN or Inf).
IsNormalized(Eps: float) bool[source]#
Checks if the vector is normalized (length is approximately 1).
IsZero(Eps: float) bool[source]#
Checks if the vector is approximately zero.
Round()[source]#
Rounds components to the nearest integer.
static Abs(_0: cVec3) cVec3[source]#
Returns a vector with absolute values of the components.
static Angle(p1: cVec3, p2: cVec3, p3: cVec3, normal: cVec3) float[source]#
Returns the signed angle between (p1-p2) and (p3-p2) around a normal.
static AreaSigned(t0: cVec3, t1: cVec3, t2: cVec3) float[source]#
Returns the area of the triangle formed by t0, t1, t2.
static BaryCentric(t0: cVec3, t1: cVec3, t2: cVec3, f: float, g: float) cVec3[source]#
Computes a point using barycentric coordinates (f, g).
static Clamp(_0: cVec3, _1: cVec3, _2: cVec3) cVec3[source]#
Clamps a vector between a min and max vector (component-wise).
static Cross(_0: cVec3, _1: cVec3) cVec3[source]#
Computes the cross product of two vectors (static).
SetCross(_0: cVec3, _1: cVec3)[source]#
Computes the cross product of two vectors and sets the result to this.
static Distance(_0: cVec3, _1: cVec3) float[source]#
Computes the distance between two vectors.
static Distance2(_0: cVec3, _1: cVec3) float[source]#
Computes the distance between two vectors using fast sqrt.
static DistanceSq(_0: cVec3, _1: cVec3) float[source]#
Computes the squared distance between two vectors.
static Dot(_0: cVec3, _1: cVec3) float[source]#
Computes the dot product of two vectors.
static Lerp(_0: cVec3, _1: cVec3, _2: float) cVec3[source]#
Linearly interpolates between two vectors.
static Lerp05(_0: cVec3, _1: cVec3) cVec3[source]#
Linearly interpolates between two vectors with factor 0.5.
static Max(_0: cVec3, _1: cVec3) cVec3[source]#
Returns the component-wise maximum of two vectors.
static Min(_0: cVec3, _1: cVec3) cVec3[source]#
Returns the component-wise minimum of two vectors.
static Reflect(RayDir: cVec3, Normal: cVec3) cVec3[source]#
Reflects a ray direction off a surface with the given normal.
static Refract(RayDir: cVec3, Normal: cVec3, Eta: float) cVec3[source]#
Refracts a ray direction.
Parameters:

Eta (float) – Ratio of indices of refraction at the surface interface.

static Slerp(n0: cVec3, n1: cVec3, s: float) cVec3[source]#
Spherical linear interpolation between two vectors.
static Truncate(u: cVec3, MaxLen: float) cVec3[source]#
Truncates the vector u so its length does not exceed MaxLen.
static RandRange1() cVec3[source]#
Returns a vector with random components in range [0, 1].
static RandNormal() cVec3[source]#
Returns a random normalized vector.
static Rand(Lo: cVec3, Hi: cVec3) cVec3[source]#
Returns a vector with random components in the range [Lo, Hi].
static Project(v1: cVec3, v2: cVec3) cVec3[source]#
Projects vector v1 onto vector v2.
static Perpendicular(v1: cVec3) cVec3[source]#
Returns a vector perpendicular to v1 (arbitrary axis).
TriProjectionSolidAngle(a: cVec3, b: cVec3, c: cVec3) float[source]#
Calculates the solid angle of the triangle (a, b, c) as seen from this point.
Zero: cVec3 = 0.0000 0.0000 0.0000#
Constants
One: cVec3 = 1.0000 1.0000 1.0000#
< (0, 0, 0)
Infinity: cVec3 = 340282346638528859811704183484516925440.0000 340282346638528859811704183484516925440.0000 340282346638528859811704183484516925440.0000#
< (1, 1, 1)
AxisX: cVec3 = 1.0000 0.0000 0.0000#
< (Inf, Inf, Inf)
AxisY: cVec3 = 0.0000 1.0000 0.0000#
< (1, 0, 0)
AxisZ: cVec3 = 0.0000 0.0000 1.0000#
< (0, 1, 0)
AxisNegX: cVec3 = -1.0000 0.0000 0.0000#
< (0, 0, 1)
AxisNegY: cVec3 = 0.0000 -1.0000 0.0000#
< (-1, 0, 0)
AxisNegZ: cVec3 = 0.0000 0.0000 -1.0000#
< (0, -1, 0)
GetDimension() int[source]#
Returns the dimension of the vector (3).
ToFloatPtr() float[source]#
Returns a pointer to the float data.
ToVec2() cVec2[source]#
Casts to a reference of a 2D vector (xy).
ToString(Prec: int = 2) cStr[source]#
Converts the vector to a formatted string.
ToAngles() any[source]#
Converts the vector to Euler angles (Pitch, Yaw, Roll).
GetOrthonormal() cVec3[source]#
Returns an arbitrary vector orthonormal to this one.
GetOrthonormalPair() list[source]#
Returns a pair of vectors orthonormal to this one and each other (forming a basis).
MakeOrthonormalTo(vec: cVec3)[source]#
Makes this vector orthonormal to the given vector.
ToPolarXZ(Radius: float, Angle: float)[source]#
Converts to Polar coordinates in the XZ plane.
static FromPolarXZ(Radius: float, Angle: float) cVec3[source]#
Creates a vector from Polar coordinates in the XZ plane.
ToBaryCentric(t0: cVec3, t1: cVec3, t2: cVec3, f: float, g: float) float[source]#
Computes barycentric coordinates (f, g) of this point relative to triangle (t0, t1, t2).
ToNormal() cVec3[source]#
Returns a normalized copy of this vector.
ToPerps(X: cVec3, Y: cVec3)[source]#
Computes two perpendicular vectors (X, Y) to this vector.
ToPerp() cVec3[source]#
Returns a single perpendicular vector.
static RayTri(RayOrig: cVec3, RayDir: cVec3, t0: cVec3, t1: cVec3, t2: cVec3, u: float, v: float, t: float, BackFaceCull: bool = False) bool[source]#
Ray-Triangle intersection test.
static PointInTriangle(p: cVec3, t0: cVec3, t1: cVec3, t2: cVec3) bool[source]#
Checks if a point p lies within triangle (t0, t1, t2).
class cVec4(v: cVec4)[source]#

Bases: object

A 4-component vector class (x, y, z, w).
  • This class represents a 4D vector, often used for homogeneous coordinates in 3D graphics,

colors (RGBA), or generic 4-value mathematical operations.
Refer to it as coat::vec4 in the Core API.
x: float#
X component of the vector.
y: float#
Y component of the vector.
z: float#
Z component of the vector.
w: float#
W component of the vector.
SetZero()[source]#
Set(XYZ: cVec3, W: float)[source]#
Sets components from a 3D vector and a scalar.
Parameters:
  • XYZ (cVec3) – The vector containing x, y, and z.

  • W (float) – The w component.

Copy(pSrc: float)[source]#
Copies components from a raw float array.
Parameters:

pSrc (float) – Pointer to an array of at least 4 floats.

Transform(mat: any)[source]#
Transforms this vector by a 4x4 matrix.
Parameters:

mat – The matrix to transform by.

static Equals(u: cVec4, v: cVec4, Eps: float) bool[source]#
Checks if two vectors are equal within a tolerance.
Parameters:
  • u (cVec4) – First vector.

  • v (cVec4) – Second vector.

  • Eps (float) – Epsilon tolerance.

Length() float[source]#
Calculates the length (magnitude) of the vector.
LengthSq() float[source]#
Calculates the squared length of the vector (faster than Length).
Normalize() float[source]#
Normalizes the vector to unit length.
Returns:

The original length of the vector.

Return type:

float

NormalizeSafe(Fallback: cVec4 = cVec4.AxisW) float[source]#
Safely normalizes the vector. If length is close to zero, sets to Fallback.
Parameters:

Fallback (cVec4) – The vector to use if this vector is zero-length.

Returns:

The original length.

Return type:

float

IsNormalized(Eps: float) bool[source]#
Checks if the vector is normalized (length is ~1).
IsZero(Eps: float) bool[source]#
Checks if the vector is zero (all components ~0).
static Abs(_0: cVec4) cVec4[source]#
Returns a vector containing the absolute values of the input components.
static Dot(_0: cVec4, _1: cVec4) float[source]#
Calculates the dot product of two vectors.
static Lerp(u: cVec4, v: cVec4, s: float) cVec4[source]#
Linear interpolation between two vectors.
Parameters:
  • u (cVec4) – Start vector.

  • v (cVec4) – End vector.

  • s (float) – Interpolation factor (0.0 to 1.0).

Returns:

Interpolated vector.

Return type:

cVec4

static Max(_0: cVec4, _1: cVec4) cVec4[source]#
Returns a vector containing the maximum components of two vectors.
static Min(_0: cVec4, _1: cVec4) cVec4[source]#
Returns a vector containing the minimum components of two vectors.
Zero: cVec4 = 0.0000 0.0000 0.0000 0.0000#
One: cVec4 = 1.0000 1.0000 1.0000 1.0000#
< (0, 0, 0, 0)
Infinity: cVec4 = 340282346638528859811704183484516925440.0000 340282346638528859811704183484516925440.0000 340282346638528859811704183484516925440.0000 340282346638528859811704183484516925440.0000#
< (1, 1, 1, 1)
AxisX: cVec4 = 1.0000 0.0000 0.0000 0.0000#
< (Inf, Inf, Inf, Inf)
AxisY: cVec4 = 0.0000 1.0000 0.0000 0.0000#
< (1, 0, 0, 0)
AxisZ: cVec4 = 0.0000 0.0000 1.0000 0.0000#
< (0, 1, 0, 0)
AxisW: cVec4 = 0.0000 0.0000 0.0000 1.0000#
< (0, 0, 1, 0)
AxisNegX: cVec4 = -1.0000 0.0000 0.0000 0.0000#
< (0, 0, 0, 1)
AxisNegY: cVec4 = 0.0000 -1.0000 0.0000 0.0000#
< (-1, 0, 0, 0)
AxisNegZ: cVec4 = 0.0000 0.0000 -1.0000 0.0000#
< (0, -1, 0, 0)
AxisNegW: cVec4 = 0.0000 0.0000 0.0000 -1.0000#
< (0, 0, -1, 0)
ToFloatPtr() float[source]#
Returns a pointer to the raw float data.
ToVec2() cVec2[source]#
Casts this vector to a cVec2 (x, y).
ToVec3() cVec3[source]#
Casts this vector to a cVec3 (x, y, z).
GetDimension() int[source]#
Returns the number of dimensions (4).
ToString(Prec: int = 2) cStr[source]#
Converts the vector to a formatted string.
AddWithWeight(src: cVec4, weight: float)[source]#
Clears the vector (sets all to 0). OpenSubdiv compat.
SetPosition(aX: float, aY: float, aZ: float, aW: float)[source]#
GetPosition() float[source]#
class cMat3(v: cMat3)[source]#

Bases: object

Represents a 3x3 Matrix.
  • Used for 3D linear algebra transformations, primarily rotation and scaling.

  • Stored in row-major order (array of 3 rows).

  • Supports interaction with cVec3, cQuat, and cAngles.

Copy(Float9: float)[source]#
CopyTransposed(Float9: float)[source]#
Copies 9 floats into the matrix treating input as Column-Major (Transposes).
SetZero()[source]#
Sets all elements to zero.
SetIdentity()[source]#
Sets the matrix to Identity (diagonal 1.0, others 0.0).
GetRow(Index: int) cVec3[source]#
Returns the specified row as a vector (0, 1, or 2).
GetRow0() cVec3[source]#
GetRow1() cVec3[source]#
GetRow2() cVec3[source]#
Row(Index: int) cVec3[source]#
Returns a mutable reference to the specified row.
Row0() cVec3[source]#
Row1() cVec3[source]#
Row2() cVec3[source]#
SetRow(Index: int, X: float, Y: float, Z: float)[source]#
Sets the values of a specific row using floats.
SetRow0(X: float, Y: float, Z: float)[source]#
SetRow1(X: float, Y: float, Z: float)[source]#
SetRow2(X: float, Y: float, Z: float)[source]#
GetCol(Index: int) cVec3[source]#
Constructs and returns a vector representing the specified column.
GetCol0() cVec3[source]#
GetCol1() cVec3[source]#
GetCol2() cVec3[source]#
SetCol(Index: int, X: float, Y: float, Z: float)[source]#
Sets the values of a specific column using floats.
SetCol0(X: float, Y: float, Z: float)[source]#
SetCol1(X: float, Y: float, Z: float)[source]#
SetCol2(X: float, Y: float, Z: float)[source]#
SetElem(Row: int, Col: int, Value: float)[source]#
Sets a specific element at (Row, Col).
GetElem(Row: int, Col: int) float[source]#
Returns the value at (Row, Col).
Elem(Row: int, Col: int) float[source]#
Returns a mutable reference to the element at (Row, Col).
Trace() float[source]#
Calculates the sum of the diagonal elements.
Determinant() float[source]#
Calculates the determinant of the matrix.
static Equals(_0: cMat3, _1: cMat3, Eps: float) bool[source]#
Checks equality with a tolerance (Epsilon).
IsZero(Eps: float) bool[source]#
Checks if all elements are zero (within Eps).
IsIdentity(Eps: float) bool[source]#
Checks if the matrix is Identity (within Eps).
IsSymmetric(Eps: float) bool[source]#
Checks if the matrix is symmetric (Matrix == Transpose).
IsOrthonormal(Eps: float) bool[source]#
Checks if rows are orthogonal and unit length (Pure rotation matrix).
Add(R: cMat3)[source]#
Adds matrix R to this matrix.
Sub(R: cMat3)[source]#
Subtracts matrix R from this matrix.
Mul(s: float)[source]#
Multiplies all elements by scalar s.
Zero: cMat3 = 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000#
Zero matrix constant.
Identity: cMat3 = 1.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 1.0000#
Identity matrix constant.
static Transpose(_0: cMat3) cMat3[source]#
Returns the transpose of matrix M (swaps rows and columns).
static Invert(Fm: cMat3, To: cMat3) bool[source]#
Calculates the inverse of matrix Fm.
Parameters:
  • Fm (cMat3) – Source matrix.

  • To (cMat3) – Pointer to destination matrix.

Returns:

True if successful, False if determinant is too small (singular).

Return type:

bool

static OrthoNormalize(Src: cMat3) cMat3[source]#
Inverts this matrix in place. Returns false if singular.
static Rotation(Axis: cVec3, Angle: float) cMat3[source]#
Creates a rotation matrix around an arbitrary axis.
static RotationX(Angle: float) cMat3[source]#
Creates a rotation matrix around the X axis.
static RotationY(Angle: float) cMat3[source]#
Creates a rotation matrix around the Y axis.
static RotationZ(Angle: float) cMat3[source]#
Creates a rotation matrix around the Z axis.
static RotationXYZ(Pitch: float, Yaw: float, Roll: float) cMat3[source]#
Creates a rotation matrix from Euler angles (Pitch, Yaw, Roll).
static EulerZYX(eulerX: float, eulerY: float, eulerZ: float) cMat3[source]#
Creates a rotation matrix using ZYX order.
static Scaling(XYZ: cVec3) cMat3[source]#
Creates a scaling matrix from a 3D vector.
ToFloatPtr() float[source]#
Returns mutable pointer to raw data.
ToMat4() any[source]#
Converts to a 4x4 matrix (puts this in top-left, Identity elsewhere).
ToQuat() any[source]#
Converts rotation matrix to Quaternion.
ToVectors(Forward: cVec3, Right: cVec3 = None, Up: cVec3 = None)[source]#
Extracts basis vectors (Forward, Right, Up) from the matrix.
Typically assumes rows contain the basis vectors.
static FromVectors(Forward: cVec3, Right: cVec3, Up: cVec3) cMat3[source]#
Constructs a matrix from basis vectors.
static FromForward(Forward: cVec3) cMat3[source]#
Constructs a rotation matrix looking in ‘Forward’ direction.
ToForward() cVec3[source]#
Extracts the Forward vector (Row 0).
ToRight() cVec3[source]#
Extracts the Right vector (Row 1).
ToUp() cVec3[source]#
Extracts the Up vector (Row 2).
ToAngles() any[source]#
Converts rotation matrix to Euler angles.
class cMat4(v: cMat4)[source]#

Bases: object

A 4x4 Matrix class designed for 3D graphics and linear algebra. *
This class uses row-major storage (cVec4 m_Rows[4]).
It supports row-vector multiplication conventions (v’ = v * M).
Translation data is typically stored in the 4th row (Index 3). *
ote Refer to it as coat::mat4 in the Core API.
Copy(Float16: float)[source]#
CopyTransposed(Float16: float)[source]#
Copies data from a float array and transposes it.
SetZero()[source]#
Sets all elements to zero.
SetIdentity()[source]#
Sets the matrix to the identity matrix.
GetRow(Index: int) cVec4[source]#
GetRow0() cVec4[source]#
GetRow1() cVec4[source]#
GetRow2() cVec4[source]#
GetRow3() cVec4[source]#
Row(Index: int) cVec4[source]#
Row0() cVec4[source]#
Row1() cVec4[source]#
Row2() cVec4[source]#
Row3() cVec4[source]#
SetRow(Index: int, X: float, Y: float, Z: float, W: float)[source]#
SetRow0(X: float, Y: float, Z: float, W: float)[source]#
SetRow1(X: float, Y: float, Z: float, W: float)[source]#
SetRow2(X: float, Y: float, Z: float, W: float)[source]#
SetRow3(X: float, Y: float, Z: float, W: float)[source]#
GetCol(Index: int) cVec4[source]#
GetCol0() cVec4[source]#
GetCol1() cVec4[source]#
GetCol2() cVec4[source]#
GetCol3() cVec4[source]#
SetCol(Index: int, X: float, Y: float, Z: float, W: float)[source]#
SetCol0(X: float, Y: float, Z: float, W: float)[source]#
SetCol1(X: float, Y: float, Z: float, W: float)[source]#
SetCol2(X: float, Y: float, Z: float, W: float)[source]#
SetCol3(X: float, Y: float, Z: float, W: float)[source]#
SetElem(Row: int, Col: int, Value: float)[source]#
GetElem(Row: int, Col: int) float[source]#
Elem(Row: int, Col: int) float[source]#
Trace() float[source]#
Calculates the trace (sum of diagonal elements).
Determinant() float[source]#
Calculates the determinant of the matrix.
static Equals(_0: cMat4, _1: cMat4, Eps: float) bool[source]#
Checks equality with another matrix within a tolerance epsilon.
IsZero(Eps: float) bool[source]#
Checks if this is a zero matrix.
IsIdentity(Eps: float) bool[source]#
Checks if this is an identity matrix.
IsSymmetric(Eps: float) bool[source]#
Checks if the matrix is symmetric (M == M^T).
IsOrthonormal(Eps: float) bool[source]#
Checks if the matrix is orthonormal (Determinant is 1).
Add(R: cMat4)[source]#
In-place arithmetic operations
Sub(R: cMat4)[source]#
Mul(s: float)[source]#
ToFloatPtr() float[source]#
ToString(Prec: int = 2) cStr[source]#
Converts the matrix to a formatted string.
ToMat3() cMat3[source]#
Extracts the upper-left 3x3 matrix.
ToNormalMatrix() cMat3[source]#
Extracts the normal matrix (usually inverse transpose of upper 3x3).
ToQuat() any[source]#
Converts the rotation component to a Quaternion.
GetTranslation() cVec3[source]#
SetTranslation(_0: cVec3)[source]#
GetScaling() cVec3[source]#
SetScaling(_0: cVec3)[source]#
GetRotation() any[source]#
SetRotation(_0: any)[source]#
static Transpose(_0: cMat4) cMat4[source]#
Returns the transpose of matrix M.
static Invert(Fm: cMat4, To: cMat4) bool[source]#
Calculates the inverse of Fm and stores it in To. Returns false if singular.
Zero: cMat4 = 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000#
Inverts this matrix in-place. Returns false if singular.
Identity: cMat4 = 1.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 1.0000#
static Translation(XYZ: cVec3) cMat4[source]#
static Rotation(Axis: cVec3, Angle: float) cMat4[source]#
static RotationX(Angle: float) cMat4[source]#
static RotationY(Angle: float) cMat4[source]#
static RotationZ(Angle: float) cMat4[source]#
static RotationXYZ(Pitch: float, Yaw: float, Roll: float) cMat4[source]#
static EulerZYX(eulerX: float, eulerY: float, eulerZ: float) cMat4[source]#
static RotationAt(Orig: cVec3, Axis: cVec3, Angle: float) cMat4[source]#
static Scaling(XYZ: cVec3) cMat4[source]#
static ScalingAt(Orig: cVec3, Dir: cVec3, Scale: float) cMat4[source]#
static Perspective(YFov: float, AspectWtoH: float, Znear: float, Zfar: float) cMat4[source]#
Creates a perspective projection matrix.
static PerspectiveInf(YFov: float, AspectWtoH: float, Znear: float) cMat4[source]#
Creates an infinite perspective projection matrix (Zfar at infinity).
static Ortho(B: any) cMat4[source]#
static CubeViewProjection(Pos: cVec3, Side: int, Radius: float, GL: bool) cMat4[source]#
Creates a view-projection matrix for a specific side of a cube map.
static LookAtViewProjection(LookFrom: cVec3, LookAt: cVec3, FovY: float, AspectYtoH: float, Znear: float, Zfar: float) cMat4[source]#
Creates a LookAt view matrix.
class cRect(v: cRect)[source]#

Bases: object

Represents an axis-aligned 2D rectangle defined by Min and Max points.
  • Coordinate system note: This class typically assumes a standard mathematical

coordinate system where Y increases upwards (Top > Bottom), based on the implementation
of AlignTop/Bottom.
static Equals(_0: cRect, _1: cRect, Eps: float) bool[source]#
Checks if two rectangles are equal within a tolerance epsilon.
Parameters:

Eps (float) – Tolerance for floating point comparison.

Set(Min: cVec2, Max: cVec2)[source]#
Sets the rectangle coordinates using vectors.
x() float[source]#
y() float[source]#
width() float[source]#
height() float[source]#
SetLeft(Left: float)[source]#
AlignLeft(X: float)[source]#
SetTop(Top: float)[source]#
Sets the top edge position (resizes height).
AlignTop(Y: float)[source]#
SetRight(Right: float)[source]#
Sets the right edge position (resizes width).
AlignRight(X: float)[source]#
SetBottom(Bottom: float)[source]#
Sets the bottom edge position (resizes height).
AlignBottom(Y: float)[source]#
AlignInside(Parent: cRect)[source]#
Successively aligns right, bottom, left, and top edges to keep this rectangle inside the parent.
GetTopLeft() cVec2[source]#
TopLeft
SetTopLeft(TopLeft: cVec2)[source]#
AlignTopLeft(TopLeft: cVec2)[source]#
GetTopCenter() cVec2[source]#
AlignTopCenter(TopCenter: cVec2)[source]#
GetTopRight() cVec2[source]#
SetTopRight(TopRight: cVec2)[source]#
AlignTopRight(TopRight: cVec2)[source]#
GetMiddleLeft() cVec2[source]#
AlignMiddleLeft(MiddleLeft: cVec2)[source]#
GetMiddleCenter() cVec2[source]#
AlignMiddleCenter(MiddleCenter: cVec2)[source]#
GetMiddleRight() cVec2[source]#
AlignMiddleRight(MiddleRight: cVec2)[source]#
GetBottomLeft() cVec2[source]#
SetBottomLeft(BottomLeft: cVec2)[source]#
AlignBottomLeft(BottomLeft: cVec2)[source]#
GetBottomCenter() cVec2[source]#
AlignBottomCenter(BottomCenter: cVec2)[source]#
GetBottomRight() cVec2[source]#
SetBottomRight(BottomRight: cVec2)[source]#
AlignBottomRight(BottomRight: cVec2)[source]#
GetPoint(Align: int) cVec2[source]#
AlignPoint(Align: int, Parent: cRect)[source]#
GetDockingAlign(Child: cVec2, DockingRegion: cRect = None, RelPos: cVec2 = None) int[source]#
GetDockingRegion(Child: cVec2, Align: int) cRect[source]#
GetLeft() float[source]#
GetTop() float[source]#
GetRight() float[source]#
GetBottom() float[source]#
GetWidth() float[source]#
GetHeight() float[source]#
SetWidth(HoldPoint: int, Width: float)[source]#
SetHeight(HoldPoint: int, Height: float)[source]#
Sets the height, resizing relative to a specific hold point (cAlign).
GetSize() cVec2[source]#
SetSize(HoldPoint: int, Side: float)[source]#
GetCenterX() float[source]#
GetCenterY() float[source]#
AlignCenterX(X: float)[source]#
AlignCenterY(Y: float)[source]#
Moves the rectangle vertically to center at Y.
Inflate(Delta: cVec2)[source]#
SetToPoint(P: cVec2)[source]#
ProjectPoint(_0: cVec2) cVec2[source]#
AddPoint(P: cVec2) bool[source]#
AddRect(Rc: cRect) bool[source]#
Translate(Delta: cVec2)[source]#
Contains(Rc: cRect) bool[source]#
static Union(l: cRect, r: cRect) cRect[source]#
Returns the smallest rectangle containing both inputs.
static Intersect(l: cRect, r: cRect) cRect[source]#
Returns the overlapping area of two rectangles.
IntersectsWith(Rc: cRect) bool[source]#
Checks if this rectangle overlaps with Rc.
Transform(T: cMat4)[source]#
Applies a 3D transform (projecting back to w=1) to the rectangle.
ToRound() cRect[source]#
Returns a rectangle with integer coordinates (rounded).
Round()[source]#
Rounds the coordinates of this rectangle in place.
Zero: cRect = cRect object>#
Empty: cRect = cRect object>#
Unit: cRect = cRect object>#
IsEmpty() bool[source]#
Checks if the rectangle is invalid (Min > Max).
SetEmpty()[source]#
SetZero()[source]#
static Inscribe(What: cRect, Where: cRect) cRect[source]#
class cBounds(v: any)[source]#

Bases: object

Represents an Axis-Aligned Bounding Box (AABB) in 3D space.
  • Defined by a minimum point (min x, min y, min z) and a maximum point (max x, max y, max z).

Used for collision detection, visibility testing, and spatial partitioning.
GetMin() cVec3[source]#
Returns a mutable reference to the minimum corner.
GetMax() cVec3[source]#
Returns a mutable reference to the maximum corner.
Set(Min: cVec3, Max: cVec3)[source]#
Sets the bounds using new min and max values.
Parameters:
  • Min (cVec3) – New minimum corner.

  • Max (cVec3) – New maximum corner.

SetMin(_0: cVec3)[source]#
Sets the minimum corner.
SetMax(_0: cVec3)[source]#
Sets the maximum corner.
GetSize() cVec3[source]#
Calculates the size vector (Max - Min).
GetSizeX() float[source]#
Returns the width (X axis size).
GetSizeY() float[source]#
Returns the height (Y axis size).
GetSizeZ() float[source]#
Returns the depth (Z axis size).
GetDiagonal() float[source]#
Calculates the length of the diagonal.
GetCenter() cVec3[source]#
Calculates the center point of the bounds.
GetLargestAxis() int[source]#
Returns the index of the longest axis.
Returns:

0 for X, 1 for Y, 2 for Z.

Return type:

int

GetShortestAxis() int[source]#
Returns the index of the shortest axis.
Returns:

0 for X, 1 for Y, 2 for Z.

Return type:

int

SetEmpty()[source]#
Invalidates the bounds by setting Min to MaxValue and Max to -MaxValue.
SetZero()[source]#
Sets bounds to (0,0,0) -> (0,0,0).
IsEmpty() bool[source]#
Checks if the bounds are empty (invalid or zero volume).
Empty: cBounds = cBounds object>#
Represents an invalid/empty bounding box.
Zero: cBounds = cBounds object>#
Represents a zero-sized bounding box at the origin.
One: cBounds = cBounds object>#
Represents a box from (-1,-1,-1) to (1,1,1).
AddPoint(_0: cVec3) bool[source]#
Expands the bounds to include the given point.
Returns:

True if the bounds were expanded.

Return type:

bool

AddBounds(_0: any) bool[source]#
Expands the bounds to include another bounding box.
Returns:

True if the bounds were expanded.

Return type:

bool

Inflate(Delta: cVec3)[source]#
Translate(_0: cVec3)[source]#
Translates the bounds by a 3D vector.
DistanceToPointSq(p: cVec3) float[source]#
Squared distance from a 3D point to the bounds (0 if inside).
ContainsCircle(Center: cVec2, Radius: float) bool[source]#
Checks if a 2D circle is contained within or overlaps the projected bounds.
ContainsPoint(_0: cVec3) bool[source]#
Checks if a 3D point is inside the bounds.
ContainsBounds(_0: any) bool[source]#
Checks if another bounding box is fully contained within this one.
IntersectsBounds(_0: any) bool[source]#
Checks if this box intersects with another box.
IntersectsSphere(_0: any) bool[source]#
Checks if this box intersects with a sphere.
RayIntersection(RayOrig: cVec3, RayDir: cVec3, Cross: cVec3 = None) bool[source]#
Helper for RayIntersection that returns the intersection point.
Parameters:
  • RayOrig (cVec3) – Ray origin.

  • RayDir (cVec3) – Ray direction.

  • Cross (cVec3) – [Out] Intersection point (optional).

Returns:

True if intersecting.

Return type:

bool

LineIntersection(RayOrig: cVec3, RayDir: cVec3, Scale: float) bool[source]#
class cRotation(Orig: cVec3, Axis: cVec3, Angle: float)[source]#

Bases: object

Represents a rotation defined by an origin (pivot), an axis, and an angle. *
This class handles rotation logic including conversion to matrices, quaternions,
and Euler angles. It includes an internal caching mechanism for the rotation matrix
to optimize repeated access.
Set(Orig: cVec3, Axis: cVec3, Angle: float) cRotation[source]#
Sets new parameters for the rotation.
  • Invalidates the cached matrix.

Parameters:
  • Orig (cVec3) – The new origin.

  • Axis (cVec3) – The new axis.

  • Angle (float) – The new angle.

Returns:

Reference to this cRotation object.

Return type:

cRotation

GetOrig() cVec3[source]#
Gets the origin of the rotation.
Returns:

Const reference to the origin vector.

Return type:

cVec3

GetAxis() cVec3[source]#
Gets the axis of the rotation.
Returns:

Const reference to the axis vector.

Return type:

cVec3

GetAngle() float[source]#
Gets the angle of the rotation.
Returns:

The angle value.

Return type:

float

SetOrig(Orig: cVec3)[source]#
Sets the origin of the rotation.
Parameters:

Orig (cVec3) – The new origin vector.

SetAxis(Axis: cVec3)[source]#
Sets the axis of the rotation.
  • Invalidates the cached matrix.

Parameters:

Axis (cVec3) – The new axis vector.

SetAngle(Angle: float)[source]#
Sets the angle of the rotation.
  • Invalidates the cached matrix.

Parameters:

Angle (float) – The new angle value.

ReCalcMatrix()[source]#
Forces recalculation of the cached rotation matrix.
Normalize180() cRotation[source]#
Normalizes the angle to be within [-180, 180] degrees (or radians equivalent).
Returns:

Reference to this object.

Return type:

cRotation

Normalize360() cRotation[source]#
Normalizes the angle to be within [0, 360] degrees (or radians equivalent).
Returns:

Reference to this object.

Return type:

cRotation

ToAngles() any[source]#
Converts the rotation to Euler angles.
Returns:

A cAngles object representing the rotation.

Return type:

any

ToQuat() any[source]#
Converts the rotation to a Quaternion.
Returns:

A cQuat object representing the rotation.

Return type:

any

ToMat3() cMat3[source]#
Converts the rotation to a 3x3 Matrix.
  • Updates the internal cache if necessary.

Returns:

Const reference to the cMat3 matrix.

Return type:

cMat3

ToMat4() cMat4[source]#
Converts the rotation to a 4x4 Matrix.
Returns:

A cMat4 object.

Return type:

cMat4

ToAngularVelocity() cVec3[source]#
Calculates the angular velocity vector.
Returns:

A cVec3 representing angular velocity.

Return type:

cVec3

class cAngles(Pitch: float, Yaw: float, Roll: float)[source]#

Bases: object

Represents Euler angles for 3D rotations.
  • This class manages rotations using Pitch, Yaw, and Roll components.

Commonly used for object orientation, camera control, and physics calculations.
Pitch: float#
Rotation around the X-axis (Up/Down) in degrees.
Yaw: float#
Rotation around the Y-axis (Left/Right) in degrees.
Roll: float#
Rotation around the Z-axis (Banking/Fall over) in degrees.
Set(Pitch: float, Yaw: float, Roll: float)[source]#
Sets the angles to new values.
Parameters:
  • Pitch (float) – Rotation around X-axis.

  • Yaw (float) – Rotation around Y-axis.

  • Roll (float) – Rotation around Z-axis.

SetZero()[source]#
Resets all angles to zero.
Copy(Src: float)[source]#
Copies values from a float array.
Parameters:

Src (float) – Pointer to an array of at least 3 floats [Pitch, Yaw, Roll].

static Equals(_0: cAngles, _1: cAngles, Eps: float) bool[source]#
Checks if two angles are equal within a given epsilon tolerance.
Parameters:

Eps (float) – Tolerance value (default is cMath::Epsilon).

Returns:

True if components are within Eps of each other.

Return type:

bool

Length() float[source]#
Calculates the length (magnitude) of the angle vector.
Returns:

Square root of sum of squares.

Return type:

float

LengthSq() float[source]#
Calculates the squared length of the angle vector.
Returns:

Sum of squares (Pitch^2 + Yaw^2 + Roll^2).

Return type:

float

Normalize360()[source]#
Normalizes the angles to be within the range [0, 360).
Normalize180()[source]#
Normalizes the angles to be within the range [-180, 180).
Round()[source]#
Rounds each component to the nearest integer.
static Clamp(u: cAngles, Min: cAngles, Max: cAngles) cAngles[source]#
Clamps angle values between a minimum and maximum range.
Parameters:
  • u (cAngles) – The angle to clamp.

  • Min (cAngles) – Minimum values.

  • Max (cAngles) – Maximum values.

Returns:

The clamped cAngles object.

Return type:

cAngles

static Rand(Range: cAngles) cAngles[source]#
Generates random angles within the specified range.
Parameters:

Range (cAngles) – Maximum magnitude for each component.

Returns:

Random angles.

Return type:

cAngles

static Angle(l: cAngles, r: cAngles) float[source]#
Calculates the angular difference between two orientations.
Parameters:
Returns:

Angle in degrees.

Return type:

float

static Distance(l: cAngles, r: cAngles) float[source]#
Calculates the “distance” between two angles (alias for Angle).
Parameters:
Returns:

Angle in degrees.

Return type:

float

Zero: cAngles = cAngles object>#
ToVectors(Forward: cVec3, Right: cVec3 = None, Up: cVec3 = None)[source]#
Converts Euler angles to direction vectors (Forward, Right, Up).
Parameters:
  • Forward (cVec3) – Pointer to store the forward vector.

  • Right (cVec3) – Pointer to store the right vector (optional).

  • Up (cVec3) – Pointer to store the up vector (optional).

ToForward() cVec3[source]#
Converts to a forward direction vector.
ToRight() cVec3[source]#
Converts to a right direction vector.
ToUp() cVec3[source]#
Converts to an up direction vector.
ToMat3() cMat3[source]#
Converts angles to a 3x3 rotation matrix.
ToMat4() cMat4[source]#
Converts angles to a 4x4 rotation matrix.
ToQuat() any[source]#
Converts angles to a Quaternion.
GetDimension() int[source]#
Returns the number of components (3).
ToFloatPtr() float[source]#
Returns a pointer to the raw float data.
ToString(Prec: int = 2) cStr[source]#
Converts the angles to a string representation.
Parameters:

Prec (int) – Decimal precision.

Returns:

String formatted as “Pitch Yaw Roll”.

Return type:

cStr

static EnsureShortestPath(l: cAngles, r: cAngles)[source]#
Modifies angles to ensure the interpolation takes the shortest path.
  • Ensures that the difference between components is within [-180, 180].

Parameters:
static Lerp(l: cAngles, r: cAngles, s: float) cAngles[source]#
Linearly interpolates between two angles.
Parameters:
  • l (cAngles) – Start angle.

  • r (cAngles) – End angle.

  • s (float) – Interpolation factor (0.0 to 1.0).

Returns:

Interpolated angle.

Return type:

cAngles

class cQuat(v: cQuat)[source]#

Bases: object

Header file for the Quaternion class.
  • Implementation of quaternions for 3D rotations and orientation,

including arithmetic operations, interpolation (SLERP, SQUAD),
and conversions to/from matrices and Euler angles.
x: float#
y: float#
< X component of the vector part.
z: float#
< Y component of the vector part.
w: float#
< Z component of the vector part.
SetIdentity()[source]#
SetZero()[source]#
Sets all components to zero.
IsZero(Eps: float) bool[source]#
Checks if the quaternion is zero (within epsilon).
Parameters:

Eps (float) – Tolerance for comparison.

Returns:

true if all components are close to zero.

Return type:

bool

Set(XYZ: cVec3, W: float)[source]#
Sets the components using a vector and a scalar.
static Mul(_0: cQuat, _1: cQuat) cQuat[source]#
Multiplies two quaternions.
  • Represents combining two rotations (q0 applied then q1, depending on convention).

static Div(_0: cQuat, _1: cQuat) cQuat[source]#
Divides two quaternions.
  • Equivalent to q0 * Inverse(q1).

static Equals(_0: cQuat, _1: cQuat, Eps: float) bool[source]#
Checks if two quaternions are equal component-wise.
static EqualRotations(_0: cQuat, _1: cQuat, Eps: float) bool[source]#
Checks if two quaternions represent the same rotation.
  • Considers that q and -q represent the same orientation in 3D space.

static SameHemisphere(_0: cQuat, _1: cQuat) bool[source]#
Checks if two quaternions are in the same hemisphere.
  • Based on the dot product sign.

Compress()[source]#
Compresses the quaternion for storage (e.g., usually for network).
  • Ensures W is positive and then sets it to 0 (assuming reconstruction later).

CalcW()[source]#
Reconstructs W component assuming a unit quaternion.
  • w = sqrt(1 - x^2 - y^2 - z^2).

Length() float[source]#
Returns the magnitude (length) of the quaternion.
LengthSq() float[source]#
Returns the squared magnitude.
Normalize() cQuat[source]#
Normalizes the quaternion to unit length.
Returns:

Reference to this quaternion.

Return type:

cQuat

IsNormalized(Eps: float) bool[source]#
Checks if the quaternion is normalized (length is close to 1).
static Conjugate(_0: cQuat) cQuat[source]#
Returns the conjugate of a quaternion (-x, -y, -z, w).
static Dot(_0: cQuat, _1: cQuat) float[source]#
Calculates the dot product of two quaternions.
static Exp(_0: cQuat) cQuat[source]#
Calculates the exponential map.
static Invert(_0: cQuat) cQuat[source]#
Calculates the inverse of the quaternion.
static Lerp(q0: cQuat, q1: cQuat, s: float, ShortestPath: bool = True) cQuat[source]#
Linear Interpolation between two quaternions.
Parameters:

ShortestPath (bool) – If true, flips signs to ensure shortest rotational path.

static Ln(_0: cQuat) cQuat[source]#
Calculates the natural logarithm map.
static LnDif(_0: cQuat, _1: cQuat) cQuat[source]#
Calculates the difference in log space.
static Slerp(q0: cQuat, q1: cQuat, s: float, ShortestPath: bool = True) cQuat[source]#
Spherical Linear Interpolation (SLERP).
  • Provides constant speed interpolation along the arc.

static Squad(q1: cQuat, A: cQuat, B: cQuat, C: cQuat, s: float) cQuat[source]#
Spherical Quadrangle Interpolation (SQUAD).
  • Used for smooth spline interpolation between quaternions.

static SquadSetup(q0: cQuat, q1: cQuat, q2: cQuat, q3: cQuat, A: cQuat, B: cQuat, C: cQuat)[source]#
Helper function to calculate intermediate control points for SQUAD.
Identity: cQuat = cQuat object>#
Zero: cQuat = cQuat object>#
< Identity Quaternion (0, 0, 0, 1).
GetDimension() int[source]#
Returns the dimensionality (4).
ToAngles() cAngles[source]#
Conversions
ToRotation() cRotation[source]#
ToMat3() cMat3[source]#
ToMat4() cMat4[source]#
ToAngularVelocity() cVec3[source]#
ToFloatPtr() float[source]#
ToStr(nPrec: int = 2) cStr[source]#
Converts quaternion to a string representation.
class cPlane(Normal: cVec3, Offset: float)[source]#

Bases: object

Class representing a generic plane in 3D space.
  • The plane is defined by the equation: ax + by + cz + d = 0.

The vector (a, b, c) represents the plane’s normal, and d represents
the distance factor relative to the origin.
a: float#
brief X component of the plane normal (A in the plane equation).
b: float#
brief Y component of the plane normal (B in the plane equation).
c: float#
brief Z component of the plane normal (C in the plane equation).
d: float#
brief Distance coefficient (D in the plane equation).
SetNormalize(A: float, B: float, C: float, D: float)[source]#
Sets the plane coefficients and normalizes them.
Parameters:
  • A (float) – X component.

  • B (float) – Y component.

  • C (float) – Z component.

  • D (float) – Distance coefficient.

GetNormal() cVec3[source]#
Gets the normal vector of the plane.
Returns:

Const reference to the normal vector (interpreted from a, b, c).

Return type:

cVec3

SetNormal(_0: cVec3)[source]#
Sets the normal vector of the plane.
SetOffset(Offset: float)[source]#
Sets the offset (distance to origin).
  • Note: Internal ‘d’ is stored as -Offset.

Parameters:

Offset (float) – The distance from the origin.

GetOffset() float[source]#
MutableNormal() cVec3[source]#
SetFromPoints(t0: cVec3, t1: cVec3, t2: cVec3) float[source]#
Defines the plane from three points.
Parameters:
  • t0 (cVec3) – First point.

  • t1 (cVec3) – Second point.

  • t2 (cVec3) – Third point.

Returns:

The area of the triangle formed by the points (before normalization).

Return type:

float

SetFromPointAndNormal(Pt: cVec3, Normal: cVec3)[source]#
Defines the plane from a point and a normal.
Parameters:
  • Pt (cVec3) – A point on the plane.

  • Normal (cVec3) – The normal vector.

MoveToPoint(p: cVec3)[source]#
Moves the plane so that it passes through the specified point.
  • The normal vector remains unchanged.

Parameters:

p (cVec3) – The point to move the plane to.

Distance(p: cVec3) float[source]#
Calculates the signed distance from a point to the plane.
Parameters:

p (cVec3) – The point to check.

Returns:

Positive value if in front, negative if behind, zero if on the plane.

Return type:

float

ProjectPoint(p: cVec3) cVec3[source]#
Projects a point onto the plane.
Parameters:

p (cVec3) – The point to project.

Returns:

The projected point on the plane surface.

Return type:

cVec3

ProjectVector(u: cVec3) cVec3[source]#
Projects a vector onto the plane (removes the component parallel to the normal).
Parameters:

u (cVec3) – The vector to project.

Returns:

The projected vector.

Return type:

cVec3

MirrorPoint(p: cVec3) cVec3[source]#
Mirrors a point across the plane.
Parameters:

p (cVec3) – The point to mirror.

Returns:

The mirrored point position.

Return type:

cVec3

MirrorVector(u: cVec3) cVec3[source]#
Mirrors a vector across the plane.
Parameters:

u (cVec3) – The vector to mirror.

Returns:

The mirrored vector.

Return type:

cVec3

MirrorOrient(q: cQuat) cQuat[source]#
Mirrors a quaternion (orientation) across the plane.
Parameters:

q (cQuat) – The orientation to mirror.

Returns:

The mirrored orientation.

Return type:

cQuat

FlipNormal()[source]#
Inverts the normal of the plane and the distance coefficient.
  • Effectively flips the front and back sides of the plane.

BelowPlane(B: any, T: cMat4) bool[source]#
Checks if a bounding box is completely on the negative side of the plane.
Parameters:
  • B – The bounding box.

  • T (cMat4) – Transformation matrix applied to the bounds.

Returns:

True if all vertices are on the back side.

Return type:

bool

ClassifyPoint(p: cVec3, Eps: float) any[source]#
Classifies a point’s position relative to the plane.
Parameters:
  • p (cVec3) – The point to classify.

  • Eps (float) – Epsilon tolerance for “on the plane” check.

Returns:

S_FRONT, S_BACK, or S_ON.

Return type:

any

ClassifySphere(S: any, Eps: float) any[source]#
Classifies a sphere’s position relative to the plane.
Parameters:
  • S – The sphere to classify.

  • Eps (float) – Epsilon tolerance.

Returns:

S_FRONT, S_BACK, or S_CROSS.

Return type:

any

IsFrontFacingTo(Dir: cVec3) bool[source]#
Checks if the plane is facing towards a specific direction.
Parameters:

Dir (cVec3) – The direction vector.

Returns:

True if the plane normal opposes the direction vector (dot product <= 0).

Return type:

bool

RayIntersection(RayOrig: cVec3, RayDir: cVec3, pScale: float = None, pCross: cVec3 = None) bool[source]#
Intersects a ray with the plane.
Parameters:
  • RayOrig (cVec3) – Origin of the ray.

  • RayDir (cVec3) – Direction of the ray.

  • pScale (float) – [out] Optional pointer to store the distance/scale along the ray.

  • pCross (cVec3) – [out] Optional pointer to store the intersection point.

Returns:

True if an intersection occurs (ray is not parallel).

Return type:

bool

SegIntersection(S0: cVec3, S1: cVec3, pCross: cVec3 = None) bool[source]#
Intersects a line segment with the plane.
Parameters:
  • S0 (cVec3) – Start point of the segment.

  • S1 (cVec3) – End point of the segment.

  • pCross (cVec3) – [out] Optional pointer to store the intersection point.

Returns:

True if the segment intersects the plane.

Return type:

bool

PlaneIntersection(P: cPlane, pCross: cVec3 = None, pDir: cVec3 = None) bool[source]#
Intersects this plane with another plane.
Parameters:
  • P (cPlane) – The other plane.

  • pCross (cVec3) – [out] A point on the intersection line.

  • pDir (cVec3) – [out] The direction of the intersection line.

Returns:

True if planes intersect, False if they are parallel.

Return type:

bool

ToPtr() float[source]#
Returns a const raw pointer to the plane coefficients.
Returns:

Const pointer to float array {a, b, c, d}.

Return type:

float

ToVec4() cVec4[source]#
Casts the plane coefficients to a const cVec4 reference.
Returns:

Const reference to cVec4.

Return type:

cVec4

class cMath[source]#

Bases: object

Static helper class providing a wide range of mathematical functions. *
This class includes constants, trigonometry, interpolation (Linear, Cosine, Hermite, TCB),
geometric calculations, random number generation, and utility functions for
floating-point and integer comparisons.
Pi: float = 3.1415927410125732#
TwoPi: float = 6.2831854820251465#
< brief Value of Pi (3.14159…)
HalfPi: float = 1.5707963705062866#
< brief Value of 2 * Pi
QuarterPi: float = 0.7853981852531433#
< brief Value of Pi / 2
RadsPerDeg: float = 0.01745329238474369#
< brief Value of Pi / 4
DegsPerRad: float = 57.2957763671875#
< brief Multiplier to convert Degrees to Radians
Epsilon: float = 0.0010000000474974513#
< brief Multiplier to convert Radians to Degrees
EpsilonSq: float = 1.0000001111620804e-06#
< brief Standard small epsilon for float comparisons
SpaceEpsilon: float = 0.10000000149011612#
< brief Epsilon squared
MatrixEpsilon: float = 9.999999974752427e-07#
< brief Epsilon used for spatial calculations
MatrixInvertEpsilon: float = 9.9999998245167e-15#
< brief Epsilon for matrix operations
dMatrixInvertEpsilon: float = 1.0000000195414814e-24#
< brief Epsilon for matrix inversion checks (float)
dEpsilon: float = 1e-06#
< brief Epsilon for matrix inversion checks (double)
Sqrt1Over2: float = 0.7071067690849304#
< brief Standard small epsilon for double comparisons
Sqrt1Over3: float = 0.5773502588272095#
< brief Square root of 1/2
SecsPerMs: float = 0.0010000000474974513#
< brief Square root of 1/3
MsPerSec: float = 1000.0#
< brief Seconds per Millisecond (0.001)
DoubleMinValue: float = 2.2250738585072014e-308#
< brief Milliseconds per Second (1000.0)
DoubleMaxValue: float = 1.7976931348623157e+308#
< brief Minimum representable positive double (0x0010000000000000)
FloatMinValue: float = 1.1754943508222875e-38#
< brief Maximum representable double (0x7fefffffffffffff)
FloatMaxValue: float = 3.4028234663852886e+38#
< brief Minimum representable positive float (0x00800000)
static IsInfinity(Value: float) bool[source]#
< rief Maximum representable float (0x7f7fffff)
static IsPositiveInfinity(Value: float) bool[source]#
< rief Checks if value is either positive or negative infinity
static IsNegativeInfinity(Value: float) bool[source]#
< rief Checks if value is positive infinity
IntMinValue: int = -2147483648#
< brief Checks if value is negative infinity
IntMaxValue: int = 2147483647#
< brief Minimum integer value (0x80000000)
static MulDiv(Number: int, Numerator: int, Denominator: int) int[source]#
Multiplies two 32-bit values and then divides the 64-bit result by a third 32-bit value.
Equivalent to Win32 API “MulDiv”.
Parameters:
  • Number (int) – Multiplicand

  • Numerator (int) – Multiplier

  • Denominator (int) – Divisor

Returns:

(Number * Numerator) / Denominator

Return type:

int

static Rad(Deg: float) float[source]#
< rief Converts Radians to Degrees (float)
static Deg(Rad: float) float[source]#
< rief Converts Degrees to Radians (double)
static Sec(Ms: float) float[source]#
< rief Converts Radians to Degrees (double)
static Ms(Sec: float) float[source]#
< rief Converts Milliseconds to Seconds
static IsOne(f: float, Eps: float) bool[source]#
< rief Checks if float is close to one
static IsMinusOne(f: float, Eps: float) bool[source]#
< rief Checks if double is close to one
static IsZeroToOneExact(f: float) bool[source]#
< rief Checks if float is close to minus one
static IsZeroToOneEps(f: float, Eps: float) bool[source]#
< rief Checks if 0.0 <= f <= 1.0
static IsInRange(i: int, Lo: int, Hi: int) bool[source]#
< rief Checks if -Eps <= f <= 1.0 + Eps
static IsInRangeExact(f: float, Lo: float, Hi: float) bool[source]#
< rief Checks if Lo <= i <= Hi (integer)
static IsInRangeEps(f: float, Lo: float, Hi: float, Eps: float) bool[source]#
< rief Checks if Lo <= f <= Hi (float)
static IsValid(f: float) bool[source]#
< rief Checks if float is a valid number (not infinite, inside bounds)
static IsZero(d: float, Eps: float) bool[source]#
< rief Checks if double is a valid number
static Equals(x: float, y: float, Eps: float) bool[source]#
< rief Checks if double is close to zero
static Clamp01(f: float) float[source]#
static ClampRange1(f: float) float[source]#
< rief Clamps value between 0.0 and 1.0
static ClampRange(f: float, l: float) float[source]#
< rief Clamps value between -1.0 and 1.0
static Lerp(a: float, b: float, s: float) float[source]#
< rief Clamps value between -l and l
static Cerp(a: float, b: float, s: float) float[source]#
< rief Linear Interpolation: a + s * (b - a)
static Lerp05(a: float, b: float) float[source]#
< rief Cosine Interpolation
static Lerper(Fm: float, To: float, x: float) float[source]#
< rief Returns midpoint (a + b) * 0.5
static LerperClamp01(Lo: float, Hi: float, x: float) float[source]#
< rief Inverse Lerp: Returns factor given value x
static MidPointLerp(Start: float, Mid: float, End: float, s: float) float[source]#
< rief Inverse Lerp clamped to [0, 1]
static Abs(x: float) float[source]#
< rief Absolute value (float)
static Round(x: float) float[source]#
< rief Round to nearest integer (float)
static Sqrt(x: float) float[source]#
< rief Square root (float)
static FastInvSqrt(x: float) float[source]#
< rief Square root (double)
static FastSqrt(x: float) float[source]#
< rief Fast Inverse Square Root (Quake III algorithm)
static Sin(a: float) float[source]#
< rief Cosine (float)
static Cos(a: float) float[source]#
< rief Sine (double)
static SinCos(Angle: float, S: float, C: float)[source]#
< rief Simultaneous Sine and Cosine (float)
static Tan(a: float) float[source]#
< rief Tangent (float)
static ASin(x: float) float[source]#
< rief ArcSine (float)
static ACos(x: float) float[source]#
< rief ArcCosine (float)
static ATan(y: float, x: float) float[source]#
< rief ArcTangent2 (y, x) float
static Pow(x: float, y: float) float[source]#
< rief Power x^y (float)
static Exp(x: float) float[source]#
< rief Exponential e^x (float)
static Ldexp(x: float, exp: int) float[source]#
< rief Multiply x by 2^exp (float)
static Frexp(x: float, exp: int) float[source]#
< rief Split x into mantissa and exponent (float)
static Log(x: float) float[source]#
< rief Natural logarithm (float)
static Floor(d: float) float[source]#
< rief Fractional part (float)
static Ceil(d: float) float[source]#
< rief Floor value (double)
static Frac(d: float) float[source]#
< rief Ceiling value (double)
static Periodic(f: float, Lo: float, Hi: float, nPeriods: int = None) float[source]#
< rief Fractional part (double)
static IndexForInsert(f: float, Array: float, nCount: int, Stride: int = 0) int[source]#
< rief Normalizes value to a periodic range
static AngleNormalizeTwoPi(Angle: float) float[source]#
< rief Normalizes angle to [0, 2Pi) (float)
static AngleNormalizePi(Angle: float) float[source]#
< rief Normalizes angle to [0, 2Pi) (double)
static AngleNormalize360(Angle: float) float[source]#
< rief Normalizes angle to (-Pi, Pi]
static AngleNormalize180(Angle: float) float[source]#
< rief Normalizes angle to [0, 360)
static AngleEnsureShortestPath180(Alpha: float, Beta: float)[source]#
< rief Normalizes angle to (-180, 180]
static AngleDeltaRad(Alpha: float, Beta: float) float[source]#
< rief Adjusts Beta so transition from Alpha is shortest
static AngleLerpRad(Alpha: float, Beta: float, s: float) float[source]#
< rief Smallest difference between two angles in radians
static AngleDeltaDeg(Alpha: float, Beta: float) float[source]#
< rief Interpolates between angles in radians correctly
static AngleLerpDeg(Alpha: float, Beta: float, s: float) float[source]#
< rief Smallest difference between two angles in degrees
static ClosestPowerOfTwo(X: int) int[source]#
static UpperPowerOfTwo(X: int) int[source]#
< rief Finds closest power of two
static LowerPowerOfTwo(X: int) int[source]#
< rief Finds next higher power of two
static IsPowerOfTwo(X: int) bool[source]#
< rief Finds next lower power of two
static Randomize(Seed: int)[source]#
static Rand01() float[source]#
< rief Seeds the random generator
static RandBool() bool[source]#
< rief Returns random float in [0, 1]
static RandRange1() float[source]#
< rief Returns random boolean
static dRand(Lo: float, Hi: float) float[source]#
< rief Returns random float in [-1, 1]
static Rand(Lo: int, Hi: int) int[source]#
< rief Returns random float in [Lo, Hi]
static SignBitSet(i: int) int[source]#
static SignBitNotSet(i: int) int[source]#
< rief Returns non-zero if sign bit is set
static TCBAdjInCoeff(tPrev: float, tCur: float, tNext: float) float[source]#
static TCBAdjOutCoeff(tPrev: float, tCur: float, tNext: float) float[source]#
static AlignToDword(i: int) int[source]#
static Checksum(Src: any, Size: int) int[source]#
< rief Aligns integer to 4-byte boundary
static Float2Half(Float: float) int[source]#
< rief Calculates simple checksum
static Half2Float(Half: int) float[source]#
< rief Convert Float32 to Float16 (Half)
static EndianSwap2(Src: any, Count: int = 1) any[source]#
b (byte, char)
static EndianSwap4(Src: any, Count: int = 1) any[source]#
< rief Swap bytes for 16-bit values (Word)
static EndianSwap8(Src: any, Count: int = 1) any[source]#
< rief Swap bytes for 32-bit values (Dword/Float)
static EndianSwap(Src: any, Format: str, Count: int = 1) any[source]#
< rief Swap bytes for 64-bit values (Qword/Double)

cPy.PrimAPI module#

class SpiralProfile(value)[source]#

Bases: Enum

The profile type of the spiral.
CIRCLE = 0#
RECTANGLE = 1#
class FontStyle(value)[source]#

Bases: Enum

Enumeration of the string drawing styles.
Regular = 0#
Italic = 1#
Underline = 2#
StrikeThrough = 4#
class FontWeight(value)[source]#

Bases: Enum

Dont = 0#
Thin = 100#
ExtraLight = 200#
Light = 300#
Normal = 400#
Medium = 500#
DemiBold = 600#
Bold = 700#
ExtraBold = 800#
Black = 900#
class ThreadProfile(value)[source]#

Bases: Enum

thread profile types
ThreadNone = -1#
ThreadTriangle = 0#
ThreadTrapeze = 1#
ThreadRectangular = 2#
ThreadRound = 3#
ThreadPersistent = 4#
class ThreadStudBodyType(value)[source]#

Bases: Enum

thread body type
StudCylinder = 0#
StudCone = 1#
class SlitType(value)[source]#

Bases: Enum

enumeration the slit types
none = -1#
Slot = 0#
Phillipse = 1#
Pozidriv = 2#
Robertson = 3#
HexSocket = 4#
SecurityHexSocket = 5#
Torx = 6#
SecurityTorx = 7#
TriWing = 8#
TorqSet = 9#
TripleSquare = 10#
Polydrive = 11#
DoubleSquare = 12#
SplineDrive = 13#
DoubleHex = 14#
Bristol = 15#
Pentalobular = 16#
Frearson = 17#
SnakeEyes = 18#
TA = 19#
TP3 = 20#
MorTorq = 21#
ClutCHG = 22#
ClutCHA = 23#
GroupEyes = 24#
class BoltHeadType(value)[source]#

Bases: Enum

enumeration the types of the bolt head
BoltNone = -1#
BoltHexa = 0#
Countersunk = 1#
BoltRound = 2#
Pan = 3#
Dome = 4#
Oval = 5#
Square = 6#
TShaped = 7#
Cylinder = 8#
Lamb = 9#
Rim = 10#
Eye = 11#
Bugle = 12#
Clop = 13#
class NutType(value)[source]#

Bases: Enum

enumeration the types of the nut
NutNone = -1#
NutHexa = 0#
Quard = 1#
Acorn = 2#
Lowacorn = 3#
NutFlange = 4#
Slits = 5#
Radial = 6#
NutLamb = 7#
NutRim = 8#
Selflock = 9#
NutTShaped = 10#
Clamplever = 11#
NtCount = 12#
class ThreadSurface(value)[source]#

Bases: Enum

ThreadCylinder = 0#
ThreadCone = 1#
ThreadEdge = 2#
class prim[source]#

Bases: object

The abstract prim class.
class_name() any[source]#
get the primitive class name.
name() any[source]#
get the primitive object name.
add(v: Volume)[source]#
add the prim into scene
Parameters:

v (Volume) – the scene volume reference

subtract(v: Volume)[source]#
subtract the prim from scene
Parameters:

v (Volume) – the scene volume reference

intersect(v: Volume)[source]#
intersect the prim into scene
Parameters:

v (Volume) – the scene volume reference

merge(v: Volume, op: BoolOpType)[source]#
merge the prim into scene
Parameters:
  • v (Volume) – the scene volume reference

  • op (BoolOpType) – the type of the merge

mesh() Mesh[source]#
get the mesh prim
Returns:

mesh object

Return type:

cPy.CoreAPI.Mesh

color(colorid: str) prim[source]#
assign the color to the primitive (in voxels)
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”
Returns:

the reference

Return type:

prim

gloss(value: float) prim[source]#
assign the gloss for the voxel primitive, it will work only if the color already assigned
Parameters:

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

Returns:

the reference

Return type:

prim

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

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

Returns:

the reference

Return type:

prim

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

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

Returns:

the reference

Return type:

prim

opacity(value: float) prim[source]#
assign the opacity of the color over the voxel primitive. The color should be assigned before you assign the opacity,
for example p.color(“red”).opacity(0.5)
Parameters:

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

Returns:

the reference

Return type:

prim

details() float[source]#
get the detail level
Returns:

detail level

Return type:

float

transform() any[source]#
get the transform matrix
Returns:

matrix

Return type:

any

scale() any[source]#
get the scale
Returns:

the scale 3d vector

Return type:

any

translate(x: float, y: float, z: float) prim[source]#
Set the primitive translation
Parameters:
  • x (float) – the new x primitive position

  • y (float) – the new y primitive position

  • z (float) – the new z primitive position

Returns:

this primitive reference

Return type:

prim

x(x: float) prim[source]#
shift the primitive along the x - axis
Parameters:

x (float) – the x value

Returns:

this primitive reference

Return type:

prim

y(y: float) prim[source]#
shift the primitive along the y - axis
Parameters:

y (float) – the y value

Returns:

this primitive reference

Return type:

prim

z(z: float) prim[source]#
shift the primitive along the z - axis
Parameters:

z (float) – the z value

Returns:

this primitive reference

Return type:

prim

auto_divide(average_div: float) prim[source]#
set the auto devide
Parameters:

average_div (float) – the average divide factor

Returns:

this prim reference

Return type:

prim

step_divide(step: float) prim[source]#
set the step devide
Parameters:

step (float) – the step divide factor

Returns:

primitive reference

Return type:

prim

fillet(radius: float) prim[source]#
set the fillet
Parameters:

radius (float) – the fillet radius

Returns:

this primitive reference

Return type:

prim

static debug_on(isOn: bool = True)[source]#
indicates whether to turn on or off the debug mode.
Parameters:

isOn (bool) – if this parameter is true, the debug mode is on, otherwise the debug mode is off.

static debug_clear()[source]#
clear the debug info for primitive operations
static push_transform(t: any)[source]#
set the global transform matrix to all primitives
Parameters:

t – the matrix

static push_translate(d: any)[source]#
Set the translation to all primitives
Not implemented yet
Parameters:

d – the new position of the primitives

static push_scale(s: any)[source]#
Set the scale to all primitives
Not implemented yet
static push_details(details_modulator: float)[source]#
set the detail level to all primitives
Not implemented yet
Parameters:

details_modulator (float) – datail level

static reset_transform()[source]#
reset the global transform matrix
Not implemented yet
fillet_relative() float[source]#
calculates a fillet relative value (0..1).
Returns:

fillet relative value

Return type:

float

class box(pos: any, size: any, fillet: float)[source]#

Bases: prim

The box.
static dynamic_cast(pObject: prim) box[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a box class or its descendant, and if so, returns the specified object, but of the box type.
axis(directionX: any, directionY: any, directionZ: any) box[source]#
set the x, y and z direction
Parameters:
  • directionX – the x-direction

  • directionY – the y-direction

  • directionZ – the z-direction

Returns:

box reference

Return type:

box

reset_axis() box[source]#
reset the x, y and z direction
Returns:

box reference

Return type:

box

axis_x() any[source]#
get the x-axis
Returns:

vec3 axis

Return type:

any

axis_y() any[source]#
get the y-axis
Returns:

vec3 axis

Return type:

any

axis_z() any[source]#
get the z-axis
Returns:

vec3 axis

Return type:

any

divide(nx: int, ny: int, nz: int) box[source]#
set the number deviding
Parameters:
  • nx (int) – number deviding along the x-axis

  • ny (int) – number deviding along the y-axis

  • nz (int) – number deviding along the z-axis

Returns:

box reference

Return type:

box

size() any[source]#
get the box size.
Returns:

size

Return type:

any

fillet_relative() float[source]#
calculates a fillet relative value (0..1).
Returns:

fillet relative value

Return type:

float

class torus(pos: any, ringRadius: float, crossSectionRadius: float)[source]#

Bases: box

The torus.
static dynamic_cast(pObject: prim) torus[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a torus class or its descendant, and if so, returns the specified object, but of the torus type.
slices() int[source]#
get the number of slices in the mesh.
Returns:

number of slices

Return type:

int

rings() int[source]#
get the number of rings in the mesh.
Returns:

number of rings

Return type:

int

radius() float[source]#
get the ring radius.
Returns:

ring radius

Return type:

float

section_radius() float[source]#
get the cross section radius.
Returns:

cross section radius

Return type:

float

diameter() float[source]#
get the ring diameter.
Returns:

ring diameter

Return type:

float

section_diameter() float[source]#
get the cross section diameter.
Returns:

cross section diameter

Return type:

float

sector_on() bool[source]#
get the flag of creating a portion of torus. Default = false.
Returns:

the sector switch

Return type:

bool

slices_angle() float[source]#
get the angle for torus slices
Returns:

the slices angle

Return type:

float

rings_angle() float[source]#
get the angle for torus rings
Returns:

the rings angle

Return type:

float

class sphere(pos: any, radius: float)[source]#

Bases: prim

The sphere.
static dynamic_cast(pObject: prim) sphere[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a sphere class or its descendant, and if so, returns the specified object, but of the sphere type.
radius() float[source]#
get the radius of the sphere.
Returns:

radius value

Return type:

float

diameter() float[source]#
get the diameter of the sphere.
Returns:

diameter value

Return type:

float

sub_division() int[source]#
get the degree of subdivision triangular or cubic division of the sphere.
Returns:

subdivision degree.

Return type:

int

sub_div_mode() any[source]#
get the division mode for the mesh.
Returns:

mode of the mesh division

Return type:

any

rings() int[source]#
get the number of rings in the mesh.
Returns:

number of rings

Return type:

int

slices() int[source]#
get the number of slices in the mesh.
Returns:

number of slices

Return type:

int

sector_on() bool[source]#
get the flag of creating a portion of sphere. Default = false.
Returns:

the sector switch

Return type:

bool

slice_from() float[source]#
get the angle where the sphere slice begins.
Returns:

the slice begin angle

Return type:

float

slice_to() float[source]#
get the angle where the sphere slice ends.
Returns:

the slice end angle

Return type:

float

ring_from() float[source]#
get the angle where the sphere ring begins.
Returns:

the ring begin angle

Return type:

float

ring_to() float[source]#
get the angle where the sphere ring ends.
Returns:

the ring end angle

Return type:

float

class ellipse(size: any)[source]#

Bases: sphere

The ellipse.
static dynamic_cast(pObject: prim) ellipse[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a ellipse class or its descendant, and if so, returns the specified object, but of the ellipse type.
axis(directionX: any, directionY: any = 3, directionZ: any = 3) ellipse[source]#
set the axis x, y and z direction
Parameters:
  • directionX – the x-direction

  • directionY – the y-direction

  • directionZ – the z-direction

Returns:

ellipse reference

Return type:

ellipse

reset_axis() ellipse[source]#
reset the x, y and z directions
Returns:

ellipse reference

Return type:

ellipse

size() any[source]#
get the size of the ellipse.
Returns:

ellipse size

Return type:

any

class cylinder(posTop: any, posBottom: any, radiusTop: float, radiusBottom: float, fillet: float = 0.0)[source]#

Bases: prim

The cylinder.
static dynamic_cast(pObject: prim) cylinder[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a cylinder class or its descendant, and if so, returns the specified object, but of the cylinder type.
positionTop() any[source]#
get the top position.
Returns:

position

Return type:

any

positionBottom() any[source]#
get the bottom position.
Returns:

position

Return type:

any

radiusTop() float[source]#
get the top radius.
Returns:

radius value

Return type:

float

radiusBottom() float[source]#
get the bottom radius.
Returns:

radius value

Return type:

float

radius() float[source]#
get the radius.
Returns:

radius value

Return type:

float

diameterTop() float[source]#
get the top diameter.
Returns:

diameter value

Return type:

float

diameterBottom() float[source]#
get the bottom diameter.
Returns:

diameter value

Return type:

float

diameter() float[source]#
get the diameter.
Returns:

diameter value

Return type:

float

height() float[source]#
get the height.
Returns:

height value

Return type:

float

sectorAngle() float[source]#
get the sector angle.
Returns:

angle value

Return type:

float

topCapScale() float[source]#
get the top cap scale.
Returns:

the scale value

Return type:

float

bottomCapScale() float[source]#
get the bottom cap scale.
Returns:

the scale value

Return type:

float

slices() int[source]#
get the number of slices in the mesh.
Returns:

number of slices.

Return type:

int

rings() int[source]#
get the number of rings in the mesh.
Returns:

number of rings.

Return type:

int

caps() int[source]#
get the number of caps in the mesh.
Returns:

number of caps.

Return type:

int

fillet_relative() float[source]#
calculates a fillet relative value (0..1).
Returns:

fillet relative value

Return type:

float

class cone(posTop: any, posBottom: any, radiusBottom: float, fillet: float = 0.0)[source]#

Bases: cylinder

The cone.
static dynamic_cast(pObject: prim) cone[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a cone class or its descendant, and if so, returns the specified object, but of the cone type.
radius() float[source]#
get the value of radius.
Returns:

radius value

Return type:

float

diameter() float[source]#
get the value of diameter.
Returns:

diameter value

Return type:

float

fillet_relative() float[source]#
calculates a fillet relative value (0..1).
Returns:

fillet relative value

Return type:

float

class tube(posTop: any, posBottom: any, radiusTop: float, radiusBottom: float, relativeHoleRadius: float, fillet: float)[source]#

Bases: cylinder

The tube.
static dynamic_cast(pObject: prim) tube[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a tube class or its descendant, and if so, returns the specified object, but of the tube type.
relativeHoleRadius() float[source]#
get the relative value of the hole radius.
Returns:

relative value (0..1)

Return type:

float

thickness() float[source]#
get the relative value of the hole radius.
Returns:

relative value (0..1)

Return type:

float

fillet_relative() float[source]#
calculates a fillet relative value (0..1).
Returns:

fillet relative value

Return type:

float

class gear(posTop: any, posBottom: any, radiusTop: float, radiusBottom: float, depth: float = 0.1, sharpness: float = 0.5, order: int = 16)[source]#

Bases: tube

The gear.
static dynamic_cast(pObject: prim) gear[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a gear class or its descendant, and if so, returns the specified object, but of the gear type.
depth() float[source]#
get the depth value.
Returns:

depth value

Return type:

float

sharpness() float[source]#
get the depth value.
Returns:

depth value

Return type:

float

order() int[source]#
get the number of teeth in gear.
Returns:

the number of teeth

Return type:

int

class ngon(posTop: any, posBottom: any, radiusTop: float, radiusBottom: float, order: int)[source]#

Bases: gear

The ngon.
static dynamic_cast(pObject: prim) ngon[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a ngon class or its descendant, and if so, returns the specified object, but of the ngon type.
fillet_relative() float[source]#
calculates a fillet relative value (0..1).
Returns:

fillet relative value

Return type:

float

class capsule(posTop: any, posBottom: any, radiusTop: float, radiusBottom: float)[source]#

Bases: cylinder

The capsule.
static dynamic_cast(pObject: prim) capsule[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a capsule class or its descendant, and if so, returns the specified object, but of the capsule type.
class spiral(out_radius: float, in_radius: float, _2: float, nturns: float)[source]#

Bases: prim

The spiral.
static dynamic_cast(pObject: prim) spiral[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a spiral class or its descendant, and if so, returns the specified object, but of the spiral type.
radius() float[source]#
get the outer radius.
Returns:

outer radius

Return type:

float

profile_radius() float[source]#
get the profile radius.
Returns:

profile radius

Return type:

float

diameter() float[source]#
get the outer diameter.
Returns:

outer diameter

Return type:

float

profile_diameter() float[source]#
get the profile diameter.
Returns:

profile diameter

Return type:

float

turns() int[source]#
get the number of turns.
Returns:

turns count

Return type:

int

step() float[source]#
get the spiral step.
Returns:

step value

Return type:

float

profile_type(type: SpiralProfile) spiral[source]#
set the type of profile (circle or rectangle).
Parameters:

type (SpiralProfile) – profile type

Returns:

spiral reference

Return type:

spiral

profile_rect(width: float, height: float) spiral[source]#
set the dimensions for the rectangle profile.
Parameters:
  • width (float) – the width value

  • height (float) – the height value

Returns:

spiral reference

Return type:

spiral

clock_wise() bool[source]#
get the clokwise direction of the spiral.
Returns:

the clokwise direction( true or false)

Return type:

bool

profile_height() float[source]#
get the profile height for rectangle profile.
Returns:

the profile height

Return type:

float

profile_width() float[source]#
get the profile width for rectangle profile.
Returns:

the profile width

Return type:

float

slices() int[source]#
get the number of slices in the mesh.
Returns:

number of slices

Return type:

int

rings() int[source]#
get the number of rings in the mesh.
Returns:

number of rings

Return type:

int

caps() int[source]#
get the number of caps in the mesh.
Returns:

number of caps

Return type:

int

class FontInfo[source]#

Bases: object

Holds the general information about font
size: int#
weight: int#
style: int#
fname: str#
class Font(_0: str, _1: int)[source]#

Bases: object

size() int[source]#
get the font size
Returns:

font size

Return type:

int

weight() int[source]#
get the font weight
Returns:

font weight

Return type:

int

style() int[source]#
get the font style
Returns:

the font style

Return type:

int

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

the font name

Return type:

str

select()[source]#
selects a font object into the viewport
class text(s: str)[source]#

Bases: prim

text primitive
static dynamic_cast(pObject: prim) text[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a text class or its descendant, and if so, returns the specified object, but of the text type.
string() any[source]#
get the text’s string.
Returns:

the string

Return type:

any

font() Font[source]#
get the font object
Returns:

font object

Return type:

Font

width() float[source]#
get the text width
Returns:

the width value

Return type:

float

depth() float[source]#
get the text depth
Returns:

the depth value

Return type:

float

bendRadius() float[source]#
get the bend radius.
Returns:

the bend radius of the text

Return type:

float

extraRotation() float[source]#
get the rotate angle around the x-axis.
Returns:

the rotate angle

Return type:

float

invertBending() float[source]#
get the invert of the text bending.
Returns:

the invert bending

Return type:

float

class lathe[source]#

Bases: box

lathe primitive
static dynamic_cast(pObject: prim) lathe[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a lathe class or its descendant, and if so, returns the specified object, but of the lathe type.
type() any[source]#
get the lathe type.
Returns:

the type value

Return type:

any

add_point(point: any, st: int) lathe[source]#
add the point into curve
Parameters:
  • point – the 2d point

  • st (int) – the point state

Returns:

lathe reference

Return type:

lathe

profile() any[source]#
get the pointer to the profile
Returns:

the profile pointer

Return type:

any

reset() lathe[source]#
reset the curve points
clear() lathe[source]#
clear points of the profile
class image[source]#

Bases: text

image primitive
static dynamic_cast(pObject: prim) image[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a image class or its descendant, and if so, returns the specified object, but of the image type.
topTexture() any[source]#
get the top texture
Returns:

the string of the image file name

Return type:

any

topBumpTexture() any[source]#
get the top bump texture
Returns:

the string of the image file name

Return type:

any

bottomTexture() any[source]#
get the bottom texture
Returns:

the string of the image file name

Return type:

any

bottomBumpTexture() any[source]#
get the bottom bump texture
Returns:

the string of the image file name

Return type:

any

strencilTexture() any[source]#
get the strencil texture
Returns:

the string of the image file name

Return type:

any

bottomStrencilTexture() any[source]#
get the bottom strencil texture
Returns:

the string of the image file name

Return type:

any

basicThickness() float[source]#
get the basic thickness of image
Returns:

the thickness value

Return type:

float

bumpThickness() float[source]#
get the bump thickness of image
Returns:

the thickness value

Return type:

float

taperAngle() float[source]#
get the angle of tapering of image
Returns:

the taper angle value

Return type:

float

topBottomWeight() float[source]#
get the weight of the top and bottom image
Returns:

the weight value

Return type:

float

sizeInScene() float[source]#
get the size of image in the scene
Returns:

the size value

Return type:

float

class thread[source]#

Bases: prim

thread primitive
static dynamic_cast(pObject: prim) thread[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a thread class or its descendant, and if so, returns the specified object, but of the thread type.
diameter() float[source]#
get the diameter of the thread.
Returns:

thread diameter

Return type:

float

pitch() float[source]#
set the pitch of the thread.
Returns:

pitch value

Return type:

float

stub() float[source]#
get the stub length of the thread.
Returns:

stub length value

Return type:

float

height() float[source]#
get the height of the thread.
Returns:

height value

Return type:

float

turns() int[source]#
get the number of the thread turns.
Returns:

turns count

Return type:

int

clockwise() bool[source]#
get the clockwise of the thread.
Returns:

clockwise flag

Return type:

bool

close() bool[source]#
set the closed thread.
Returns:

closed flag

Return type:

bool

profile() ThreadProfile[source]#
get the thread profile type.
Returns:

profile type

Return type:

ThreadProfile

class threadStud[source]#

Bases: thread

thread stud primitive
static dynamic_cast(pObject: prim) threadStud[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a threadStud class or its descendant, and if so, returns the specified object, but of the threadStud type.
diameter() float[source]#
get the diameter of the thread.
Returns:

diameter value

Return type:

float

diameterTop() float[source]#
get the top diameter of the thread.
Returns:

diameter value

Return type:

float

diameterBottom() float[source]#
get the bottom diameter of the thread.
Returns:

diameter value

Return type:

float

length() float[source]#
get the length of the stud.
Returns:

length value

Return type:

float

threadLength() float[source]#
get the length of the thread.
Returns:

length value

Return type:

float

enableThread() bool[source]#
get the indicator of the enabled thread.
Returns:

enabled/disabled value

Return type:

bool

bodyType() ThreadStudBodyType[source]#
get the body type.
Returns:

type value

Return type:

ThreadStudBodyType

class Slit(w: float, h: float, d: float, t: SlitType)[source]#

Bases: object

class of the slits
type() int[source]#
get the slit type.
Returns:

type value

Return type:

int

width() float[source]#
get the width.
Returns:

width value

Return type:

float

height() float[source]#
get the height.
Returns:

height value

Return type:

float

depth() float[source]#
get the depth.
Returns:

depth value

Return type:

float

class HeadParams[source]#

Bases: object

setData(_0: int, param: any) HeadParams[source]#
set the parameters data with specified type.
Parameters:

_type (int) – head type

getData() any[source]#
get the head data
Returns:

pointer to the head data

Return type:

any

copy(h: HeadParams)[source]#
copies the HeadParams object
release()[source]#
release the data
class HeadBaseParams(_0: float, _1: float)[source]#

Bases: object

HeadBaseParams struct of the head data
diameter(_0: float) HeadBaseParams[source]#
set the diameter.
Parameters:

_d (float) – diameter

Returns:

HeadBaseParams reference

Return type:

HeadBaseParams

height(_0: float) HeadBaseParams[source]#
set the height.
Parameters:

_h (float) – height

Returns:

HeadBaseParams reference

Return type:

HeadBaseParams

class TShapedParams(_0: float, _1: float, _2: float)[source]#

Bases: object

struct of the TShapedParams data
diameter(_0: float) TShapedParams[source]#
set the diameter.
Parameters:

_d (float) – diameter

Returns:

TShapedParams reference

Return type:

TShapedParams

height(_0: float) TShapedParams[source]#
set the height.
Parameters:

_h (float) – height

Returns:

TShapedParams reference

Return type:

TShapedParams

width(_0: float) TShapedParams[source]#
set the width.
Parameters:

_w (float) – width

Returns:

TShapedParams reference

Return type:

TShapedParams

class LambParams(_0: float, _1: float, _2: float, _3: float, _4: float, _5: float)[source]#

Bases: object

struct of the LambParams data
length(_0: float) LambParams[source]#
set the length.
Parameters:

_l (float) – length

Returns:

LambParams reference

Return type:

LambParams

diameterTop(_0: float) LambParams[source]#
set the top diameter.
Parameters:

_d (float) – top diameter

Returns:

LambParams reference

Return type:

LambParams

diameterBottom(_0: float) LambParams[source]#
set the bottom diameter.
Parameters:

_d (float) – bottom diameter

Returns:

LambParams reference

Return type:

LambParams

height(_0: float) LambParams[source]#
set the height.
Parameters:

_h (float) – height

Returns:

LambParams reference

Return type:

LambParams

headHeight(_0: float) LambParams[source]#
set the head height.
Parameters:

_h (float) – height

Returns:

LambParams reference

Return type:

LambParams

thickness(_0: float) LambParams[source]#
set the thickness.
Parameters:

_t (float) – thickness

Returns:

LambParams reference

Return type:

LambParams

class RimParams(_0: float, _1: float, _2: float, _3: float)[source]#

Bases: object

struct of the RimParams data
shoulderDiameter(_0: float) RimParams[source]#
set the shoulder diameter.
Parameters:

_d (float) – diameter

Returns:

RimParams reference

Return type:

RimParams

shoulderHeight(_0: float) RimParams[source]#
set the shoulder height.
Parameters:

_h (float) – height

Returns:

RimParams reference

Return type:

RimParams

inRingDiameter(_0: float) RimParams[source]#
set the inner ring diameter.
Parameters:

_d (float) – diameter

Returns:

RimParams reference

Return type:

RimParams

outRingDiameter(_0: float) RimParams[source]#
set the outer ring diameter.
Parameters:

_d (float) – diameter

Returns:

RimParams reference

Return type:

RimParams

class EyeParams(_0: float, _1: float, _2: float)[source]#

Bases: object

struct of the EyeParams data
inRingDiameter(_0: float) EyeParams[source]#
set the inner ring diameter.
Parameters:

_d (float) – diameter

Returns:

EyeParams reference

Return type:

EyeParams

outRingDiameter(_0: float) EyeParams[source]#
set the outer ring diameter.
Parameters:

_d (float) – diameter

Returns:

EyeParams reference

Return type:

EyeParams

thickness(_0: float) EyeParams[source]#
set the thickness.
Parameters:

_t (float) – thickness

Returns:

EyeParams reference

Return type:

EyeParams

class boltHead[source]#

Bases: prim

bolt head primitive
static dynamic_cast(pObject: prim) boltHead[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a boltHead class or its descendant, and if so, returns the specified object, but of the boltHead type.
head(_0: int, data: any) boltHead[source]#
set the head object with specified type and data.
Parameters:

_type (int) – head type

Returns:

bolt head reference

Return type:

boltHead

slit() Slit[source]#
get the const slit object.
Returns:

slit object reference

Return type:

Slit

class NutHeadBaseParams(t: NutType, d: float, h: float)[source]#

Bases: object

diameter() float[source]#
get the diameter.
Returns:

diameter

Return type:

float

height() float[source]#
get the height.
Returns:

height value

Return type:

float

type() int[source]#
set the nut type.
Returns:

type value.

Return type:

int

copy(p: NutHeadBaseParams = None) NutHeadBaseParams[source]#
copies the object.
Parameters:

p (NutHeadBaseParams) – pointer to the object to copy. If the pointer equals to null then the object is duplicated

Returns:

the pointer to a copy of an object.

Return type:

NutHeadBaseParams

class NutHexaParams(d: float, h: float)[source]#

Bases: NutHeadBaseParams

static dynamic_cast(pObject: NutHeadBaseParams) NutHexaParams[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a NutHexaParams class or its descendant, and if so, returns the specified object, but of the NutHexaParams type.
class NutAcornParams(d: float, h: float, h1: float)[source]#

Bases: NutHeadBaseParams

static dynamic_cast(pObject: NutHeadBaseParams) NutAcornParams[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a NutAcornParams class or its descendant, and if so, returns the specified object, but of the NutAcornParams type.
facetHeight() float[source]#
get the facet height.
Returns:

facet height value.

Return type:

float

copy(p: NutHeadBaseParams = None) NutHeadBaseParams[source]#
copies the NutAcornParams object.
Parameters:

p (NutHeadBaseParams) – pointer to the NutAcornParams object to copy. If the pointer equals to null then the object is duplicated

Returns:

the pointer to a copy of an NutAcornParams object.

Return type:

NutHeadBaseParams

class NutLowAcornParams(d: float, h: float, h1: float)[source]#

Bases: NutAcornParams

static dynamic_cast(pObject: NutHeadBaseParams) NutLowAcornParams[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a NutLowAcornParams class or its descendant, and if so, returns the specified object, but of the NutLowAcornParams type.
class NutSelfLockParams(d: float, h: float, h1: float)[source]#

Bases: NutAcornParams

static dynamic_cast(pObject: NutHeadBaseParams) NutSelfLockParams[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a NutSelfLockParams class or its descendant, and if so, returns the specified object, but of the NutSelfLockParams type.
class NutTShapedParams(d: float, h: float, h1: float)[source]#

Bases: NutAcornParams

static dynamic_cast(pObject: NutHeadBaseParams) NutTShapedParams[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a NutTShapedParams class or its descendant, and if so, returns the specified object, but of the NutTShapedParams type.
class NutFlangeParams(d: float, h: float, fw: float, fh: float)[source]#

Bases: NutHeadBaseParams

static dynamic_cast(pObject: NutHeadBaseParams) NutFlangeParams[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a NutFlangeParams class or its descendant, and if so, returns the specified object, but of the NutFlangeParams type.
facetWidth() float[source]#
get the width.
Returns:

width value.

Return type:

float

facetHeight() float[source]#
get the height.
Returns:

height value.

Return type:

float

copy(p: NutHeadBaseParams = None) NutHeadBaseParams[source]#
copies the NutFlangeParams object.
Parameters:

p (NutHeadBaseParams) – pointer to the NutFlangeParams object to copy. If the pointer equals to null then the object is duplicated

Returns:

the pointer to a copy of an NutFlangeParams object.

Return type:

NutHeadBaseParams

class NutRadialParams(d: float, h: float, d1: float, d2: float)[source]#

Bases: NutHeadBaseParams

static dynamic_cast(pObject: NutHeadBaseParams) NutRadialParams[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a NutRadialParams class or its descendant, and if so, returns the specified object, but of the NutRadialParams type.
holeDiameter() float[source]#
set the hole diameter.
Returns:

hole diameter

Return type:

float

holeDepth() float[source]#
get the hole depth.
Returns:

NutRadialParams hole depth

Return type:

float

holePlace() int[source]#
get the hole place.
Returns:

place flag 0 - face, 1 - side

Return type:

int

copy(p: NutHeadBaseParams = None) NutHeadBaseParams[source]#
copies the radial object.
Parameters:

p (NutHeadBaseParams) – pointer to the radial object to copy. If the pointer equals to null then the object is duplicated

Returns:

the pointer to a copy of an radial object.

Return type:

NutHeadBaseParams

class NutLambParams(d: float, h: float)[source]#

Bases: NutHeadBaseParams

static dynamic_cast(pObject: NutHeadBaseParams) NutLambParams[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a NutLambParams class or its descendant, and if so, returns the specified object, but of the NutLambParams type.
length() float[source]#
get the length.
Returns:

length value

Return type:

float

diameterBottom() float[source]#
get the bottom diameter.
Returns:

bottom diameter

Return type:

float

diameterTop() float[source]#
get the top diameter.
Returns:

top diameter

Return type:

float

headHeight() float[source]#
get the head height.
Returns:

height value

Return type:

float

thickness() float[source]#
get the thickness.
Returns:

thickness value

Return type:

float

copy(p: NutHeadBaseParams = None) NutHeadBaseParams[source]#
copies the NutLambParams object.
Parameters:

p (NutHeadBaseParams) – pointer to the NutLambParams object to copy. If the pointer equals to null then the object is duplicated

Returns:

the pointer to a copy of an NutLambParams object.

Return type:

NutHeadBaseParams

class NutSlitsParams(d: float, h: float)[source]#

Bases: NutHeadBaseParams

static dynamic_cast(pObject: NutHeadBaseParams) NutSlitsParams[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a NutSlitsParams class or its descendant, and if so, returns the specified object, but of the NutSlitsParams type.
width() float[source]#
get the width.
Returns:

width value.

Return type:

float

length() float[source]#
get the length.
Returns:

length value.

Return type:

float

count() int[source]#
get the count of NutSlitsParams.
Returns:

count value.

Return type:

int

copy(p: NutHeadBaseParams = None) NutHeadBaseParams[source]#
copies the NutSlitsParams object.
Parameters:

p (NutHeadBaseParams) – pointer to the NutSlitsParams object to copy. If the pointer equals to null then the object is duplicated

Returns:

the pointer to a copy of an NutSlitsParams object.

Return type:

NutHeadBaseParams

class NutRimParams(d: float, h: float)[source]#

Bases: NutHeadBaseParams

static dynamic_cast(pObject: NutHeadBaseParams) NutRimParams[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a NutRimParams class or its descendant, and if so, returns the specified object, but of the NutRimParams type.
inRingDiameter() float[source]#
get the inner ring diameter.
Returns:

inner diameter

Return type:

float

outRingDiameter() float[source]#
get the outer ring diameter.
Returns:

outer diameter

Return type:

float

copy(p: NutHeadBaseParams = None) NutHeadBaseParams[source]#
copies the NutRimParams object.
Parameters:

p (NutHeadBaseParams) – pointer to the NutRimParams object to copy. If the pointer equals to null then the object is duplicated

Returns:

the pointer to a copy of an NutRimParams object.

Return type:

NutHeadBaseParams

class NutClampLever(d: float, h: float)[source]#

Bases: NutHeadBaseParams

static dynamic_cast(pObject: NutHeadBaseParams) NutClampLever[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a NutClampLever class or its descendant, and if so, returns the specified object, but of the NutClampLever type.
holderDiameter() float[source]#
get the diameter of the holder.
Returns:

holder diameter

Return type:

float

length() float[source]#
get the length.
Returns:

length value

Return type:

float

copy(p: NutHeadBaseParams = None) NutHeadBaseParams[source]#
copies the NutClampLever object.
Parameters:

p (NutHeadBaseParams) – pointer to the NutClampLever object to copy. If the pointer equals to null then the object is duplicated

Returns:

the pointer to a copy of an NutClampLever object.

Return type:

NutHeadBaseParams

class nut[source]#

Bases: prim

nut primitive
static dynamic_cast(pObject: prim) nut[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a nut class or its descendant, and if so, returns the specified object, but of the nut type.
setTypeData(data: any) nut[source]#
set the typed data.
Parameters:

data – pointer to the data

Returns:

nut reference

Return type:

nut

getTypeData() any[source]#
get the typed data.
Returns:

pointer to the data

Return type:

any

threadDiameter() float[source]#
get the hole thread diameter.
Returns:

diameter

Return type:

float

pitch() float[source]#
get the thread pitch.
Returns:

pitch

Return type:

float

enableThread() bool[source]#
get the enabled thread.
Returns:

enabled flag

Return type:

bool

threadType() int[source]#
get the nut thread profile.
Returns:

thread type value.

Return type:

int

class bolt[source]#

Bases: prim

bolt primitive
static dynamic_cast(pObject: prim) bolt[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a bolt class or its descendant, and if so, returns the specified object, but of the bolt type.
head() boltHead[source]#
get the head object.
Returns:

head obj reference

Return type:

boltHead

diameter() float[source]#
get the bolt diameter.
Returns:

diameter

Return type:

float

pitch() float[source]#
get the thread pitch.
Returns:

pitch

Return type:

float

threadHeight() float[source]#
get the thread height.
Returns:

height value

Return type:

float

length() float[source]#
get the bolt length.
threadLength() float[source]#
get the thread length.
Returns:

length

Return type:

float

threadType() int[source]#
get the screw thread profile.
Returns:

thread type value.

Return type:

int

underhead() int[source]#
get the under head type.
Returns:

under head type value

Return type:

int

uwidth() float[source]#
get the underhead width.
Returns:

width value

Return type:

float

uheight() float[source]#
get the underhead height.
Returns:

height value

Return type:

float

nutType() int[source]#
get the nut type.
Returns:

type value

Return type:

int

nutLocation() float[source]#
get the nut location on the bolt.
Returns:

location value

Return type:

float

nutHeight() float[source]#
get the nut height on the bolt.
Returns:

location value

Return type:

float

class screw[source]#

Bases: prim

screw primitive
static dynamic_cast(pObject: prim) screw[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a screw class or its descendant, and if so, returns the specified object, but of the screw type.
head() boltHead[source]#
get the bolt head object.
Returns:

bolt head obj reference

Return type:

boltHead

diameter() float[source]#
get the screw diameter.
Returns:

diameter

Return type:

float

pitch() float[source]#
get the screw thread step(pitch).
Returns:

step value

Return type:

float

threadDiameter() float[source]#
get the thread diameter.
Returns:

diameter

Return type:

float

threadHeight() float[source]#
get the screw thread height.
Returns:

thread height value

Return type:

float

threadLength() float[source]#
get the screw thread length.
Returns:

length value

Return type:

float

length() float[source]#
get the screw length.
Returns:

length

Return type:

float

underhead() int[source]#
get the underhead type.
Returns:

type value

Return type:

int

uwidth() float[source]#
get the underhead width.
Returns:

width value

Return type:

float

uheight() float[source]#
get the underhead height.
Returns:

height value

Return type:

float

class washer[source]#

Bases: prim

washer primitive
static dynamic_cast(pObject: prim) washer[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a washer class or its descendant, and if so, returns the specified object, but of the washer type.
innerDiameter() float[source]#
get the inner diameter.
Returns:

diameter

Return type:

float

outerDiameter() float[source]#
get the outer diameter.
Returns:

diameter

Return type:

float

conusDiameter() float[source]#
get the diameter of the conus washer.
Returns:

diameter

Return type:

float

thickness() float[source]#
get the washer thickness.
Returns:

thickness value

Return type:

float

height() float[source]#
get the washer height.
Returns:

height value

Return type:

float

facet() bool[source]#
get the facet flag.
Returns:

facet flag value

Return type:

bool

type() any[source]#
get the washer type.
Returns:

type value

Return type:

any

class freeform[source]#

Bases: prim

freeform primitive
static dynamic_cast(pObject: prim) freeform[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a freeform class or its descendant, and if so, returns the specified object, but of the freeform type.
symx(x: bool) freeform[source]#
Enable the XYZ-mirror symmetry
Parameters:

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

Returns:

freeform reference

Return type:

freeform

symy(y: bool) freeform[source]#
Enable the XYZ-mirror symmetry
Parameters:

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

Returns:

freeform reference

Return type:

freeform

symz(z: bool) freeform[source]#
Enable the XYZ-mirror symmetry
Parameters:

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

Returns:

freeform reference

Return type:

freeform

size(v: any) freeform[source]#
set the free form size
Parameters:

v – vector size

Returns:

freeform reference

Return type:

freeform

ffname() str[source]#
get the free form name.
Returns:

the name

Return type:

str

ffsubname() str[source]#
get the free form sub name.
Returns:

the name

Return type:

str

SetPoint(i: int, point: any) freeform[source]#
set the knot point of the primitive.
Parameters:
  • i (int) – point index

  • point – the coordinates of the point

Returns:

the freeform reference

Return type:

freeform

CountPoints() int[source]#
get the account of the knot points
Returns:

count of points

Return type:

int

ResetPoints()[source]#
reset the knot points
objsList() any[source]#
gets the object’s list.
Returns:

objs list reference

Return type:

any

ffControlPoints() any[source]#
get the knot(control) points of the primitive.
Returns:

the points reference

Return type:

any