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:
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:
EnumBoolean operations type- BOOL_MERGE = -1#
- BOOL_ADD = 0#
- BOOL_SUBTRACT = 1#
- BOOL_INTERSECT = 2#
- 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.pyorcpp
- 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.pyorcpp. 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
- 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
- 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
- finish the current submenu, this command may be called only from the menu making script
- add the separator to the current menu, this command may be called only from the menu making script
- 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.pyorcppShift (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
- Don’t allow this hotkey for this action
- 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_multires()[source]#
- check if the current sculpt object is on some multiresolution level
- 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
- 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
- tex_approach()[source]#
- returns the texturing approach index (from the Textures menu)
- Returns:
the index
- insert extension into the main menu (may be called only from the menu making script)
- Parameters:
id (str) – the extension id
- 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
- 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
- start_rmb_panel()[source]#
- start the RNB panel. This command may be called only from the RMB response making script (curves.py, rmb.py)
- sort items in the current menu
- IsInTool(ToolID: str)[source]#
- check if we are in some tool
- Parameters:
ToolID (str) – the tool identifier
- Returns:
True if in that tool
- 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
- lock_ui_changes()[source]#
- check if UI changes locked (for specialized applications, like printing)
- Returns:
the lock state
- class ClusterScale(value)[source]#
Bases:
Enumthe 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:
objectThe mesh reference- 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
- 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
- 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
- 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
- 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
- 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)
- setMeshVertices(positions: list[vec3])[source]#
- set the list of all positional vertices for the mesh
- Parameters:
positions (list[vec3]) – the list of positions
- 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
- 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……
- removeFaces(faces: list[int])[source]#
- remove the set of vertices from the mesh
- Parameters:
faces (list[int]) – the list of faces indices to remove
- 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
- 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
- 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
- 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:
- 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:
- 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:
- 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:
- 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:
- 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]#
-
- 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:
- 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:
- 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:
- 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]
- class Image(im: Image)[source]#
Bases:
objectThe 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
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- static toLocalSpace() symm[source]#
- set the symmetry to be in local space
- Returns:
the reference
- Return type:
- static toGeneral() symm[source]#
- set the symmetry to general case
- Returns:
the reference
- Return type:
- 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:
- 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:
- 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:
- static setCustomSymetryTransforms(symmetryTransforms: any) symm[source]#
- enable the custom symmetry, provide the symmetry transfoms
- 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
- 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]
- class SceneElement[source]#
Bases:
objectThe scene element, like sculpt object or curve- parent() SceneElement[source]#
- get the parent scene graph element
- Returns:
the parent reference
- Return type:
- 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:
- 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:
- transform(Transform: any) SceneElement[source]#
- Additional transform over the object
- Parameters:
Transform – the matrix
- Returns:
this element reference
- Return type:
- 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:
- 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:
- rename(name: str) SceneElement[source]#
- rename the element
- Parameters:
name (str) – the new name
- Returns:
this element reference
- Return type:
- 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:
- 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:
- 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 Trueel 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 Trueel 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:
dest (SceneElement) – the destination
op (BoolOpType) – the boolean operation type
- copyMergeTo(dest: SceneElement, op: BoolOpType)[source]#
- copy and merge the volume to another one, delete this volume
- Parameters:
dest (SceneElement) – the destination
op (BoolOpType) – the boolean operation type
- removeSubtreeItem(index: int)[source]#
- remove one child from the subtree
- Parameters:
index (int) – index of the child
- duplicate() SceneElement[source]#
- diplicate the item
- Returns:
the new item reference
- Return type:
- duplicateAsInstance() SceneElement[source]#
- create the instance of the object if instancing supported
- Returns:
the instance reference
- Return type:
- 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
- collectSelected() list[SceneElement][source]#
- Collect the selected elements in the subtree (including this element if selected)
- class Volume(vol: Volume)[source]#
Bases:
objectThe 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
- 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
- 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:
- 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
- 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
- basRelief(start_point: any = 3)[source]#
- perform the bas-relief for the current volume
- Parameters:
start_point – the cut point
- 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
- 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:
- findMoldingTop() SceneElement[source]#
- find the top molding shape (that was previously generated)
- Returns:
the top shape reference
- Return type:
- findMoldingBottom() SceneElement[source]#
- find the bottom molding shape (that was previously generated)
- Returns:
the bottom shape reference
- Return type:
- findMoldingTest() SceneElement[source]#
- find the test molding test shape (that was previously generated)
- Returns:
the test shape reference
- Return type:
- 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 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
- class Scene[source]#
Bases:
objectreferes 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:
- static sculptRoot() SceneElement[source]#
- get the root of all sculpt objects
- Returns:
the root reference
- Return type:
- static curvesRoot() SceneElement[source]#
- get the root of all curves
- Returns:
the root reference
- Return type:
- 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 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 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:
- 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 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
- class RenderRoom[source]#
Bases:
object- 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 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 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
- 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
- addSmooth(p: cVec3, normal: cVec3, Radius: float)[source]#
- add the smooth B-spline-like point to the curve
- 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
- 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
- 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:
objectThe class intended to place spheres in space and identify if there are spheres around. It is important forrandom 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
- 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
- class ui[source]#
Bases:
objectoperate 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 controlThe 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 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 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 dialogthis 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 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 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 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 folderIf 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 theef GeneratorExample.pyArgs: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 theef 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
- class Camera[source]#
Bases:
object- static rotateToGradually(destination_dir: any)[source]#
- align the camera along the view
- Parameters:
destination_dir – the view direction
- 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 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
- class dialog[source]#
Bases:
objectthe 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:
- 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:
- 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:
- 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:
- noModal() dialog[source]#
- dialog will be no modal. Execution will continue after you will call the show()
- topRight() dialog[source]#
- place the dialog at the top-right position of the viewport
- Returns:
itself
- Return type:
- undoWorks() dialog[source]#
- allow undo (CTR-Z) act even in modal dialog
- Returns:
itself
- Return type:
- transparentBackground() dialog[source]#
- the background will not be faded
- Returns:
itself
- Return type:
- 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:
- 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:
- 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:
- 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:
- class resource(id: str)[source]#
Bases:
objectthis 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()
- class io[source]#
Bases:
objectGeneral I/O access- 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 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 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 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 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
- 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 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
- class uv[source]#
Bases:
objectThe 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 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 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:
- 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:
- 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:
- 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:
- static selectedToMesh() Mesh[source]#
- get the selected faces as the Mesh object
- Returns:
the Mesh
- Return type:
- 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
- class Model[source]#
Bases:
objectThe 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:
- 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:
- 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:
- 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:
- 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
- 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
- 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
- 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:
- selectedToMesh() Mesh[source]#
- get the selected faces as the Mesh object
- Returns:
the Mesh
- Return type:
- visibleToMesh() Mesh[source]#
- get the visible faces as the Mesh object
- Returns:
teh Mesh
- Return type:
- 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:
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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:
- 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:
- 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:
- 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
- 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
- invertSelectedFacesTopoplogically()[source]#
- invert selected faces only within the connective area, if some objects has no selected faces, the selection there will not change
- shell()[source]#
- perform the shell operation over the selected faces. After calling the shell() you should call the moveSelectedFacesAlongFacesNormals or moveSelectedFacesAlongVertexNormalsto 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 moveSelectedFacesAlongVertexNormalsto give some thickness to the resulting figure
- class logger[source]#
Bases:
object- 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:
- 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:
- startTimer() logger[source]#
- start the timer to profile some operation
- Returns:
the reference
- Return type:
cPy.cTypes module#
- class cStr(Src: str)[source]#
Bases:
objectA custom string class optimized for performance and ease of use. *This class provides a wide range of string manipulation functions, includingdynamic resizing, formatting, path handling, and type conversions.It is designed to work with standard C-style strings and providessafe 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
- 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().
- 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
- AppendPath(Path: str)[source]#
- rief Appends a path segment, automatically adding a slash or backslash.
- 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]#
- Substring(StartIndex: int, Count: int) cStr[source]#
- rief Retrieves a substring of specified length.
- 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.
- static CharIsExponent(c: int) bool[source]#
- rief Helper: Is character part of exponent notation (e, E, d, D)?
- class cVec2(v: cVec2)[source]#
Bases:
objectA 2D vector class providing linear algebra operations and geometry functions. *This class represents a 2-component vector (x, y) and includes methods forarithmetic, 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.
- 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 backby 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.
- 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
- IsNormalized(Eps: float) bool[source]#
- Checks if the vector is normalized (length == 1) within tolerance.
- static Round(_0: cVec2) cVec2[source]#
- Returns a new vector with components rounded to the nearest integer.
- static Abs(_0: cVec2) cVec2[source]#
- Returns a vector containing the absolute values of the components.
- 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 DistanceSq(_0: cVec2, _1: cVec2) float[source]#
- Calculates the squared distance between 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 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.
- 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).
- Infinity: cVec2 = 340282346638528859811704183484516925440.0000 340282346638528859811704183484516925440.0000#
- 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.
- class cVec3(v: cVec3)[source]#
Bases:
objectThe 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
- TransformCoordinate(_0: any)[source]#
- Transforms the vector as a coordinate (position) using a 4x4 matrix.
- TransformNormalTransposed(_0: any)[source]#
- Transforms the vector as a normal using the transpose of a 4x4 matrix.
- static Equals(_0: cVec3, _1: cVec3, Eps: float) bool[source]#
- Checks if two vectors are equal within a given epsilon tolerance.
- 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.
- IsNormalized(Eps: float) bool[source]#
- Checks if the vector is normalized (length is approximately 1).
- 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 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 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 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 Rand(Lo: cVec3, Hi: cVec3) cVec3[source]#
- Returns a vector with random components in the range [Lo, Hi].
- 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.
- Infinity: cVec3 = 340282346638528859811704183484516925440.0000 340282346638528859811704183484516925440.0000 340282346638528859811704183484516925440.0000#
- < (1, 1, 1)
- GetOrthonormalPair() list[source]#
- Returns a pair of vectors orthonormal to this one and each other (forming a basis).
- 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).
- class cVec4(v: cVec4)[source]#
Bases:
objectA 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.
- 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.
- 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
- static Abs(_0: cVec4) cVec4[source]#
- Returns a vector containing the absolute values of the input components.
- 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.
- Infinity: cVec4 = 340282346638528859811704183484516925440.0000 340282346638528859811704183484516925440.0000 340282346638528859811704183484516925440.0000 340282346638528859811704183484516925440.0000#
- < (1, 1, 1, 1)
- class cMat3(v: cMat3)[source]#
Bases:
objectRepresents a 3x3 Matrix.Used for 3D linear algebra transformations, primarily rotation and scaling.
Stored in row-major order (array of 3 rows).
- CopyTransposed(Float9: float)[source]#
- Copies 9 floats into the matrix treating input as Column-Major (Transposes).
- SetRow(Index: int, X: float, Y: float, Z: float)[source]#
- Sets the values of a specific row using floats.
- GetCol(Index: int) cVec3[source]#
- Constructs and returns a vector representing the specified column.
- SetCol(Index: int, X: float, Y: float, Z: float)[source]#
- Sets the values of a specific column using floats.
- static Equals(_0: cMat3, _1: cMat3, Eps: float) bool[source]#
- Checks equality with a tolerance (Epsilon).
- IsOrthonormal(Eps: float) bool[source]#
- Checks if rows are orthogonal and unit length (Pure rotation matrix).
- 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 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 EulerZYX(eulerX: float, eulerY: float, eulerZ: float) cMat3[source]#
- Creates a rotation matrix using ZYX order.
- 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.
- class cMat4(v: cMat4)[source]#
Bases:
objectA 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.- static Equals(_0: cMat4, _1: cMat4, Eps: float) bool[source]#
- Checks equality with another matrix within a tolerance epsilon.
- ToNormalMatrix() cMat3[source]#
- Extracts the normal matrix (usually inverse transpose of upper 3x3).
- 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 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).
- class cRect(v: cRect)[source]#
Bases:
objectRepresents 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 implementationof 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.
- AlignInside(Parent: cRect)[source]#
- Successively aligns right, bottom, left, and top edges to keep this rectangle inside the parent.
- SetHeight(HoldPoint: int, Height: float)[source]#
- Sets the height, resizing relative to a specific hold point (cAlign).
- class cBounds(v: any)[source]#
Bases:
objectRepresents 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.- 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
- 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
- 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.
- ContainsBounds(_0: any) bool[source]#
- Checks if another bounding box is fully contained within this one.
- class cRotation(Orig: cVec3, Axis: cVec3, Angle: float)[source]#
Bases:
objectRepresents a rotation defined by an origin (pivot), an axis, and an angle. *This class handles rotation logic including conversion to matrices, quaternions,to optimize repeated access.- Set(Orig: cVec3, Axis: cVec3, Angle: float) cRotation[source]#
- Sets new parameters for the rotation.
Invalidates the cached matrix.
- GetOrig() cVec3[source]#
- Gets the origin of the rotation.
- Returns:
Const reference to the origin vector.
- Return type:
- GetAxis() cVec3[source]#
- Gets the axis of the rotation.
- Returns:
Const reference to the axis vector.
- Return type:
- 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.
- Normalize180() cRotation[source]#
- Normalizes the angle to be within [-180, 180] degrees (or radians equivalent).
- Returns:
Reference to this object.
- Return type:
- Normalize360() cRotation[source]#
- Normalizes the angle to be within [0, 360] degrees (or radians equivalent).
- Returns:
Reference to this object.
- Return type:
- ToMat3() cMat3[source]#
- Converts the rotation to a 3x3 Matrix.
Updates the internal cache if necessary.
- class cAngles(Pitch: float, Yaw: float, Roll: float)[source]#
Bases:
objectRepresents 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.
- 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
- static Clamp(u: cAngles, Min: cAngles, Max: cAngles) cAngles[source]#
- Clamps angle values between a minimum and maximum range.
- static Angle(l: cAngles, r: cAngles) float[source]#
- Calculates the angular difference between two orientations.
- static Distance(l: cAngles, r: cAngles) float[source]#
- Calculates the “distance” between two angles (alias for Angle).
- ToVectors(Forward: cVec3, Right: cVec3 = None, Up: cVec3 = None)[source]#
- Converts Euler angles to direction vectors (Forward, Right, Up).
- 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:
- class cQuat(v: cQuat)[source]#
Bases:
objectHeader 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.
- 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
- 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).
- Normalize() cQuat[source]#
- Normalizes the quaternion to unit length.
- Returns:
Reference to this quaternion.
- Return type:
- IsNormalized(Eps: float) bool[source]#
- Checks if the quaternion is normalized (length is close to 1).
- 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 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.
- class cPlane(Normal: cVec3, Offset: float)[source]#
Bases:
objectClass 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 representsthe 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:
- 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.
- SetFromPointAndNormal(Pt: cVec3, Normal: cVec3)[source]#
- Defines the plane from a point and a normal.
- 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
- ProjectVector(u: cVec3) cVec3[source]#
- Projects a vector onto the plane (removes the component parallel to the normal).
- 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:
- 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.
- PlaneIntersection(P: cPlane, pCross: cVec3 = None, pDir: cVec3 = None) bool[source]#
- Intersects this plane with another plane.
- class cMath[source]#
Bases:
objectStatic 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 forfloating-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 IsPositiveInfinity(Value: float) bool[source]#
- < rief Checks if value is either positive or negative 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 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 Equals(x: float, y: float, Eps: float) bool[source]#
- < rief Checks if double is close to zero
- static Cerp(a: float, b: float, s: float) float[source]#
- < rief Linear Interpolation: a + s * (b - a)
- 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 SinCos(Angle: float, S: float, C: float)[source]#
- < rief Simultaneous Sine and Cosine (float)
- 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 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 EndianSwap4(Src: any, Count: int = 1) any[source]#
- < rief Swap bytes for 16-bit values (Word)
cPy.PrimAPI module#
- class SpiralProfile(value)[source]#
Bases:
EnumThe profile type of the spiral.- CIRCLE = 0#
- RECTANGLE = 1#
- class FontStyle(value)[source]#
Bases:
EnumEnumeration 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:
Enumthread profile types- ThreadNone = -1#
- ThreadTriangle = 0#
- ThreadTrapeze = 1#
- ThreadRectangular = 2#
- ThreadRound = 3#
- ThreadPersistent = 4#
- class ThreadStudBodyType(value)[source]#
Bases:
Enumthread body type- StudCylinder = 0#
- StudCone = 1#
- class SlitType(value)[source]#
Bases:
Enumenumeration 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:
Enumenumeration 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:
Enumenumeration 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 prim[source]#
Bases:
objectThe abstract prim class.- 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
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- x(x: float) prim[source]#
- shift the primitive along the x - axis
- Parameters:
x (float) – the x value
- Returns:
this primitive reference
- Return type:
- y(y: float) prim[source]#
- shift the primitive along the y - axis
- Parameters:
y (float) – the y value
- Returns:
this primitive reference
- Return type:
- z(z: float) prim[source]#
- shift the primitive along the z - axis
- Parameters:
z (float) – the z value
- Returns:
this primitive reference
- Return type:
- 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:
- step_divide(step: float) prim[source]#
- set the step devide
- Parameters:
step (float) – the step divide factor
- Returns:
primitive reference
- Return type:
- fillet(radius: float) prim[source]#
- set the fillet
- Parameters:
radius (float) – the fillet radius
- Returns:
this primitive reference
- Return type:
- 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 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 primitivesNot implemented yet
- Parameters:
d – the new position of the primitives
- class box(pos: any, size: any, fillet: float)[source]#
Bases:
primThe 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:
- class torus(pos: any, ringRadius: float, crossSectionRadius: float)[source]#
Bases:
boxThe 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
- section_radius() float[source]#
- get the cross section radius.
- Returns:
cross section radius
- 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
- class sphere(pos: any, radius: float)[source]#
Bases:
primThe 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.
- 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
- 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
- class ellipse(size: any)[source]#
Bases:
sphereThe 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:
- class cylinder(posTop: any, posBottom: any, radiusTop: float, radiusBottom: float, fillet: float = 0.0)[source]#
Bases:
primThe 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.
- 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
- class cone(posTop: any, posBottom: any, radiusBottom: float, fillet: float = 0.0)[source]#
Bases:
cylinderThe cone.
- class tube(posTop: any, posBottom: any, radiusTop: float, radiusBottom: float, relativeHoleRadius: float, fillet: float)[source]#
Bases:
cylinderThe 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
- class gear(posTop: any, posBottom: any, radiusTop: float, radiusBottom: float, depth: float = 0.1, sharpness: float = 0.5, order: int = 16)[source]#
Bases:
tubeThe gear.
- class ngon(posTop: any, posBottom: any, radiusTop: float, radiusBottom: float, order: int)[source]#
Bases:
gearThe ngon.
- class capsule(posTop: any, posBottom: any, radiusTop: float, radiusBottom: float)[source]#
Bases:
cylinderThe capsule.
- class spiral(out_radius: float, in_radius: float, _2: float, nturns: float)[source]#
Bases:
primThe 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.
- profile_diameter() float[source]#
- get the profile diameter.
- Returns:
profile diameter
- 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:
- 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:
- 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
- class FontInfo[source]#
Bases:
objectHolds the general information about font- size: int#
- weight: int#
- style: int#
- fname: str#
- class text(s: str)[source]#
Bases:
primtext 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.
- bendRadius() float[source]#
- get the bend radius.
- Returns:
the bend radius of the text
- Return type:
float
- class lathe[source]#
Bases:
boxlathe 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.
- class image[source]#
Bases:
textimage 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
- class thread[source]#
Bases:
primthread 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
- stub() float[source]#
- get the stub length of the thread.
- Returns:
stub length value
- Return type:
float
- clockwise() bool[source]#
- get the clockwise of the thread.
- Returns:
clockwise flag
- Return type:
bool
- profile() ThreadProfile[source]#
- get the thread profile type.
- Returns:
profile type
- Return type:
- class threadStud[source]#
Bases:
threadthread 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
- 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:
- class HeadParams[source]#
Bases:
objectclass HeadParams- setData(_0: int, param: any) HeadParams[source]#
- set the parameters data with specified type.
- Parameters:
_type (int) – head type
- copy(h: HeadParams)[source]#
- copies the HeadParams object
- class HeadBaseParams(_0: float, _1: float)[source]#
Bases:
objectHeadBaseParams struct of the head data- diameter(_0: float) HeadBaseParams[source]#
- set the diameter.
- Parameters:
_d (float) – diameter
- Returns:
HeadBaseParams reference
- Return type:
- height(_0: float) HeadBaseParams[source]#
- set the height.
- Parameters:
_h (float) – height
- Returns:
HeadBaseParams reference
- Return type:
- class TShapedParams(_0: float, _1: float, _2: float)[source]#
Bases:
objectstruct of the TShapedParams data- diameter(_0: float) TShapedParams[source]#
- set the diameter.
- Parameters:
_d (float) – diameter
- Returns:
TShapedParams reference
- Return type:
- height(_0: float) TShapedParams[source]#
- set the height.
- Parameters:
_h (float) – height
- Returns:
TShapedParams reference
- Return type:
- width(_0: float) TShapedParams[source]#
- set the width.
- Parameters:
_w (float) – width
- Returns:
TShapedParams reference
- Return type:
- class LambParams(_0: float, _1: float, _2: float, _3: float, _4: float, _5: float)[source]#
Bases:
objectstruct of the LambParams data- length(_0: float) LambParams[source]#
- set the length.
- Parameters:
_l (float) – length
- Returns:
LambParams reference
- Return type:
- diameterTop(_0: float) LambParams[source]#
- set the top diameter.
- Parameters:
_d (float) – top diameter
- Returns:
LambParams reference
- Return type:
- diameterBottom(_0: float) LambParams[source]#
- set the bottom diameter.
- Parameters:
_d (float) – bottom diameter
- Returns:
LambParams reference
- Return type:
- height(_0: float) LambParams[source]#
- set the height.
- Parameters:
_h (float) – height
- Returns:
LambParams reference
- Return type:
- headHeight(_0: float) LambParams[source]#
- set the head height.
- Parameters:
_h (float) – height
- Returns:
LambParams reference
- Return type:
- thickness(_0: float) LambParams[source]#
- set the thickness.
- Parameters:
_t (float) – thickness
- Returns:
LambParams reference
- Return type:
- class RimParams(_0: float, _1: float, _2: float, _3: float)[source]#
Bases:
objectstruct of the RimParams data
- class EyeParams(_0: float, _1: float, _2: float)[source]#
Bases:
objectstruct of the EyeParams data
- class boltHead[source]#
Bases:
primbolt head primitive
- class NutHeadBaseParams(t: NutType, d: float, h: float)[source]#
Bases:
object- 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:
- 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.
- 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:
- 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.
- 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:
- 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.
- 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:
- 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.
- diameterBottom() float[source]#
- get the bottom diameter.
- Returns:
bottom diameter
- 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:
- 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.
- 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:
- 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:
- 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
- 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:
- class nut[source]#
Bases:
primnut 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.
- class bolt[source]#
Bases:
primbolt 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.
- threadType() int[source]#
- get the screw thread profile.
- Returns:
thread type value.
- Return type:
int
- class screw[source]#
Bases:
primscrew 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.
- class washer[source]#
Bases:
primwasher 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.
- class freeform[source]#
Bases:
primfreeform 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:
- 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:
- 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:
- size(v: any) freeform[source]#
- set the free form size
- Parameters:
v – vector size
- Returns:
freeform reference
- Return type:
- 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: