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

Public Member Functions

 __init__ (self)
 
 __init__ (self)
 
 __init__ (self, m=Mesh)
 
 __init__ (self, m=Any)
 
Mesh __assign__ (self, m=Mesh)
 
Mesh __assign__ (self, m=Any)
 
Mesh MakeCopy (self)
 
bool Read (self, name=str)
 Load the mesh from the file.
 
bool Write (self, name=str)
 Save the mesh to file.
 
bool valid (self)
 Check if mesh is valid.
 
Any geometry (self)
 The low-level mesh reference allows to create, operate over individual faces, vertices, objects.
 
Any geometry (self)
 The low-level mesh reference allows to create, operate over individual faces, vertices, objects.
 
 clear (self)
 clear the mesh
 
Mesh __iadd__ (self, m=Mesh)
 
Mesh __iadd__ (self, m=Any)
 
 addTransformed (self, m=Mesh, t=mat4)
 concatenate the transformed mesh with the current one
 
 boolean (self, m=Mesh, op=BoolOpType)
 boolean operation
 
 transform (self, transform=mat4)
 transform the mesh
 
 rotateToXYAxis (self, axisX=vec3, axisY=vec3)
 rotate the mesh so that X axis will be aligned with axisX, Y axis will be aligned with axisY
 
 rotateToYZAxis (self, axisY=vec3, axisZ=vec3)
 rotate the mesh so that Y axis will be aligned with axisY, Z axis will be aligned with axisZ
 
 rotateToZXAxis (self, axisZ=vec3, axisX=vec3)
 rotate the mesh so that Z axis will be aligned with axisZ, X axis will be aligned with axisX
 
int vertsCount (self)
 returns the amount of verts in the mesh
 
int vertsUvCount (self)
 returns the amount of UV - verts in the mesh
 
int vertsNormalCount (self)
 returns the amount of normal - verts in the mesh
 
int facesCount (self)
 returns the faces amount
 
vec3 getVertex (self, idx=int)
 get the vertex coordinate
 
 setVertex (self, idx=int, v=vec3)
 set the vertex coordinate
 
int createNewVertex (self, position=vec3)
 create the positional vertex
 
vec2 getVertexUV (self, idx=int)
 get the UV coordinate of the vertex, pay attention position verts and UV verts are different, they have different indices
 
 setVertexUV (self, idx=int, v=vec2)
 set the UV coordinate of the vertex, pay attention position verts and UV verts are different, they have different indices
 
int createNewUvVertex (self, uv=vec2)
 create new UV vertex to be used for faces
 
vec3 getVertexNormal (self, idx=int)
 get the normal of the vertex, pay attention position verts and normal verts are different, they have different indices
 
 setVertexNormal (self, idx=int, v=vec3)
 set the normal of the vertex, pay attention position verts and normal verts are different, they have different indices
 
 calcNormals (self)
 re-calculate normals over the mesh
 
 calcNormalsIgnoreSharpEdges (self)
 re-calculate normals over the mesh, ignore the sharp edges
 
int getFaceVertsCount (self, face=int)
 get the amount of vertices over the face
 
int getFaceUvVertsCount (self, face=int)
 get the amount of UV vertices over the face
 
int getFaceVertex (self, faceIndex=int, faceVertexIndex=int)
 get the positional vertex index over the face
 
list getFaceVerts (self, face=int)
 get the list of UV vertex indices over the face, pay attention UV vertices are not same as position vertices
 
 setFaceVerts (self, face=int, vertices=list)
 set the list of positional vertex indices over the face
 
int getFaceUvVertex (self, faceIndex=int, faceVertexIndex=int)
 get the UV vertex index over the face
 
 setFaceUvVertex (self, faceIndex=int, faceVertexIndex=int, uvVertexIndex=int)
 set the UV vertex index over the face
 
int getFaceNormalVertex (self, faceIndex=int, faceVertexIndex=int)
 get the normal vertex index over the face
 
 setFaceNormalVertex (self, faceIndex=int, faceVertexIndex=int, normalVertexIndex=int)
 set the normal vertex index over the face
 
list getFaceUvVerts (self, face=int)
 get the list of UV vertices indices over the face
 
int getFaceObject (self, faceIndex=int)
 get the object index over the face, see the getObjectsCount(), getObjectName()
 
 setFaceObject (self, faceIndex=int, objectIndex=int)
 set the object index for the face, see the getObjectsCount(), getObjectName()
 
int getFaceMaterial (self, faceIndex=int)
 get the material index over the face, see the getMaterialsCount(), getMaterialName()
 
 setFaceMaterial (self, faceIndex=int, materialIndex=int)
 set the material index over the face, see the getMaterialsCount(), getMaterialName()
 
int getObjectsCount (self)
 returns the objects count in the mesh
 
str getObjectName (self, idx=int)
 get the name of the object
 
 setObjectName (self, idx=int, name=str)
 set object name
 
int addObject (self, name=str)
 add new object to the mesh
 
 removeObject (self, idx=int)
 remove object from the mesh
 
 unifyAllObjects (self, name=str)
 unify all objects in the mesh, i.e.
 
int getMaterialsCount (self)
 get the materials count in the mesh
 
int addMaterial (self, name=str)
 add new material to the mesh
 
 removeMaterial (self, idx=int)
 remove the material (and corresponding faces) from the mesh
 
str getMaterialName (self, idx=int)
 get the name of the material
 
 setMaterialName (self, idx=int, name=str)
 set material name
 
str getMaterialTexture (self, idx=int, texture_layer=int)
 get the texture name of the material
 
 setMaterialTexture (self, idx=int, texture_layer=int, texture_path=str)
 set the texture layer filename of the material
 
 fromVolume (self, v=Any, with_subtree=bool, all_selected=bool)
 extract the mesh from the volume
 
 fromReducedVolume (self, v=Any, reduction_percent=float, with_subtree=bool, all_selected=bool)
 extract the mesh from the volume and reduce it by the given percent
 
 fromVolumeWithMaxPolycount (self, v=Any, max_polycount=int, with_subtree=bool, all_selected=bool)
 extract the mesh from the volume and reduce to the given polycount
 
 toVolume (self, v=Any, transform=mat4, op=BoolOpType)
 merge this mesh to the volume object
 
 insertInVolume (self, v=Any, transform=mat4)
 insert without boolean operation, if the volume is not in surface mode (volumetric) the boolean ADD will be performed anyway
 
 addToVolume (self, v=Any, transform=mat4)
 boolean add to volume
 
 subtractFromVolume (self, v=Any, transform=mat4)
 boolean subtraction of the mesh from the volume
 
 intersectWithVolume (self, v=Any, transform=mat4)
 boolean intersection of the mesh with the volume
 
 fromRetopo (self)
 take the whole mesh from the retopo room
 
 fromPaintRoom (self)
 get the mesh from the paint room
 
 reduceToPolycount (self, destination_triangles_count=int)
 reduce the mesh to the given polycount, mesh will be triangulated
 
 triangulate (self)
 triangulate the mesh
 
 booleanOp (self, With=Mesh, op=BoolOpType)
 Perform the boolean operation with the given mesh.
 
list getMeshVertices (self)
 get the list of all positional vertices of the mesh
 
list getMeshNormals (self)
 get the list of all normal vertices of the mesh
 
list getMeshUVs (self)
 get the list of all UV vertices of the mesh
 
 setMeshVertices (self, positions=list)
 set the list of all positional vertices for the mesh
 
 setMeshNormals (self, normals=list)
 set the list of all normal vertices for the mesh
 
 setMeshUVs (self, uvs=list)
 set the list of all UV vertices for the mesh
 
 setMeshFaces (self, faces=list)
 set the complete list of faces for the mesh
 
 addMeshVertices (self, positions=list)
 add the list of all positional vertices for the mesh
 
 addMeshNormals (self, normals=list)
 add the list of all normal vertices for the mesh
 
 addMeshUVs (self, uvs=list)
 add the list of all UV vertices for the mesh
 
 addMeshFaces (self, faces=list)
 add the list of faces for the mesh, pay attention, all vertex indices are global over the whole mesh!
 
 clearVerts (self)
 clear all positional vertices of the mesh
 
 clearUvVerts (self)
 clear all uv vertices of the mesh
 
 clearNormals (self)
 clear all normal vertices of the mesh
 
 clearFaces (self)
 clear all faces of the mesh
 
 removeFaces (self, faces=list)
 remove the set of vertices from the mesh
 
 clearObject (self)
 clear all objects
 
 clearMaterials (self)
 clear all materials
 
 ensureMaterialsAndObjectsExist (self)
 ensure that at least one material and one object exist in the mesh
 
int addObject (self, name=str)
 add the named object
 
int addMaterial (self, name=str)
 add the named material
 
 removeUnusedObjectsAndMaterials (self)
 remove all unused objects and materials
 
 removeUnusedVerts (self)
 remove all unused vertices
 
 removeUnusedFaces (self)
 remove all faces that contain zero vertices
 
 cutByPlane (self, start=vec3, NormalDirection=vec3)
 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.
 
 cutByDistortedPlane (self, start=vec3, NormalDirection=vec3, noise_degree=float, noise_scale=float, seed=int)
 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.
 
 distortByPerlinNoise (self, noise_degree=float, noise_scale=float, anisotropic=bool, seed=int)
 distort the mesh by the Perlin noise
 
list splitDisconnectedParts (self)
 split the mesh into disconnected parts
 
 symmetry (self, start=vec3, NormalDirection=vec3, resultInQuads=bool)
 apply symmetry to the mesh
 
list autodetectSymmetryPlanes (self)
 Detect the symmetry planes of the mesh.
 
 weld (self, minimal_relative_distance=float)
 weld the mesh, remove all vertices that are closer than minimal_relative_distance #mesh_bound_box_diagonal to each other
 
boundbox getBounds (self)
 get the mesh bound box
 
float getVolume (self)
 get the volume of the mesh
 
float getOpenSurfaceVolume (self, start=vec3, dir=vec3)
 calculate the volume even if the mesh is not closed, in this case we define plane that limits the integration
 
float getSquare (self)
 get square of the mesh
 
float getFaceSquare (self, face=int)
 get the squareof the face
 
float getFaceUVSquare (self, face=int)
 get the face square in UV space
 
vec3 getFaceNormal (self, face=int)
 get the face normal
 
 relax (self, degree=float, tangent=bool, crease_angle=float)
 relax the mesh, keep the vertices count
 
Mesh box (center=vec3, size=vec3, xAxis=vec3, yAxis=vec3, zAxis=vec3, detail_size=float, fillet=float, nx=int, ny=int, nz=int)
 create the box mesh
 
Mesh sphere (center=vec3, radius=float, detail_size=float)
 create the sphere mesh
 
Mesh cylinder (center=vec3, radius=float, height=float, detail_size=float, slices=int, caps=int, rings=int, fillet=float)
 create the cylinder mesh
 
Mesh cone (center=vec3, radius=float, height=float, detail_size=float, topAxis=vec3)
 create the cone mesh
 
Mesh plane (center=vec3, sizeX=float, sizeY=float, divisionsX=int, divisionsY=int, xAxis=vec3, yAxis=vec3)
 create the single-side plane mesh, the faces normals are put toward the vec3.Cross(xAxis, yAxis)
 
Mesh hexagonal_plane (center=vec3, sizeX=float, sizeY=float, divisionsX=int, divisionsY=int, xAxis=vec3, yAxis=vec3)
 create the single-side triangular plane mesh that consists mostly of quasi equally-sided triangles
 
Mesh text (string=str, font=str, height=float, center=vec3, text_direction=vec3, text_normal=vec3, thickness=float, align=int)
 Create the text mesh.
 
 createVDM (self, side=int, path_to_exr=str, center=vec3, radius=float, up=vec3, x=vec3, y=vec3)
 Create the vector displacement map from the mesh and save it as EXR file.
 
 shell (self, thickness_out=float, thickness_in=float, divisions=int)
 add some thickness to the mesh (intrude a bit)
 
list extrudeOpenEdges (self, distance=float, direction=vec3)
 extrude open edges of the mesh
 
list expandOpenEdges (self, distance=float)
 extrude open edges of the mesh
 
list getOpenEdges (self)
 get the list of open edges
 
float getLengthAlongDirection (self, dir=vec3)
 get the mesh size along some axis
 
vec3 getCenterMass (self)
 calculate the center mass of the mesh
 

Constructor & Destructor Documentation

◆ __init__() [1/4]

coat.Mesh.__init__ (   self)

◆ __init__() [2/4]

coat.Mesh.__init__ (   self)

◆ __init__() [3/4]

coat.Mesh.__init__ (   self,
  m = Mesh 
)

◆ __init__() [4/4]

coat.Mesh.__init__ (   self,
  m = Any 
)

Member Function Documentation

◆ __assign__() [1/2]

Mesh coat.Mesh.__assign__ (   self,
  m = Any 
)

◆ __assign__() [2/2]

Mesh coat.Mesh.__assign__ (   self,
  m = Mesh 
)

◆ __iadd__() [1/2]

Mesh coat.Mesh.__iadd__ (   self,
  m = Any 
)

◆ __iadd__() [2/2]

Mesh coat.Mesh.__iadd__ (   self,
  m = Mesh 
)

◆ addMaterial() [1/2]

int coat.Mesh.addMaterial (   self,
  name = str 
)

add new material to the mesh

Parameters
namethe material name
Returns
the material index

◆ addMaterial() [2/2]

int coat.Mesh.addMaterial (   self,
  name = str 
)

add the named material

Parameters
namethe name for the material
Returns
the index of new material in the materials list

◆ addMeshFaces()

coat.Mesh.addMeshFaces (   self,
  faces = list 
)

add the list of faces for the mesh, pay attention, all vertex indices are global over the whole mesh!

Parameters
facesthe 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...
...

◆ addMeshNormals()

coat.Mesh.addMeshNormals (   self,
  normals = list 
)

add the list of all normal vertices for the mesh

Parameters
normalsthe list of normals (vec3)

◆ addMeshUVs()

coat.Mesh.addMeshUVs (   self,
  uvs = list 
)

add the list of all UV vertices for the mesh

Parameters
uvsthe list of UVs (vec2)

◆ addMeshVertices()

coat.Mesh.addMeshVertices (   self,
  positions = list 
)

add the list of all positional vertices for the mesh

Parameters
positionsthe list of positions

◆ addObject() [1/2]

int coat.Mesh.addObject (   self,
  name = str 
)

add new object to the mesh

Parameters
namethe object name
Returns
the object index

◆ addObject() [2/2]

int coat.Mesh.addObject (   self,
  name = str 
)

add the named object

Parameters
namethe name for the object
Returns
the index of new object in the objects list

◆ addToVolume()

coat.Mesh.addToVolume (   self,
  v = Any,
  transform = mat4 
)

boolean add to volume

Parameters
vthe destination volume
transformthe transform

◆ addTransformed()

coat.Mesh.addTransformed (   self,
  m = Mesh,
  t = mat4 
)

concatenate the transformed mesh with the current one

Parameters
mthe mesh
tthe transform

◆ autodetectSymmetryPlanes()

list coat.Mesh.autodetectSymmetryPlanes (   self)

Detect the symmetry planes of the mesh.

Returns
the list of planes

◆ boolean()

coat.Mesh.boolean (   self,
  m = Mesh,
  op = BoolOpType 
)

boolean operation

Parameters
mthe mesh to operate

◆ booleanOp()

coat.Mesh.booleanOp (   self,
  With = Mesh,
  op = BoolOpType 
)

Perform the boolean operation with the given mesh.

Parameters
Withthe mesh to perform the operation with over the current mesh
opthe operation, see BoolOpType (-1 means no operation, 0 - add, 1 - subtract, 2 - intersect)

◆ box()

Mesh coat.Mesh.box (   center = vec3,
  size = vec3,
  xAxis = vec3,
  yAxis = vec3,
  zAxis = vec3,
  detail_size = float,
  fillet = float,
  nx = int,
  ny = int,
  nz = int 
)

create the box mesh

Parameters
centerthe box center
sizethe box size
xAxisthe x-axis direction, if zero, the x-axis is default - (1,0,0)
yAxisthe y-axis direction, if zero, the y-axis is default - (0,1,0)
zAxisthe z-axis direction, if zero, the z-axis is default - (0,0,1)
detail_sizethe average length of the edge over the figure. The figure will be divided so that edges length will be approximately the detail_size
filletthe fillet radius
nxthe number of segments along the x-axis (if all of nx, ny, nz are above zero, it overrides the detail_size)
nythe number of segments along the y-axis (if all of nx, ny, nz are above zero, it overrides the detail_size)
nzthe 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

◆ calcNormals()

coat.Mesh.calcNormals (   self)

re-calculate normals over the mesh

◆ calcNormalsIgnoreSharpEdges()

coat.Mesh.calcNormalsIgnoreSharpEdges (   self)

re-calculate normals over the mesh, ignore the sharp edges

◆ clear()

coat.Mesh.clear (   self)

clear the mesh

◆ clearFaces()

coat.Mesh.clearFaces (   self)

clear all faces of the mesh

◆ clearMaterials()

coat.Mesh.clearMaterials (   self)

clear all materials

◆ clearNormals()

coat.Mesh.clearNormals (   self)

clear all normal vertices of the mesh

◆ clearObject()

coat.Mesh.clearObject (   self)

clear all objects

◆ clearUvVerts()

coat.Mesh.clearUvVerts (   self)

clear all uv vertices of the mesh

◆ clearVerts()

coat.Mesh.clearVerts (   self)

clear all positional vertices of the mesh

◆ cone()

Mesh coat.Mesh.cone (   center = vec3,
  radius = float,
  height = float,
  detail_size = float,
  topAxis = vec3 
)

create the cone mesh

Parameters
centerthe center of the cone (the cone base center)
radiusthe cone radius
heightthe cone height
detail_sizethe average length of the edge over the figure. The figure will be divided so that edges length will be approximately the detail_size
topAxisthe top axis direction, if zero, the top axis is default - (0,1,0)
Returns
the cone mesh

◆ createNewUvVertex()

int coat.Mesh.createNewUvVertex (   self,
  uv = vec2 
)

create new UV vertex to be used for faces

Parameters
uvthe texture coordinates
Returns
the index

◆ createNewVertex()

int coat.Mesh.createNewVertex (   self,
  position = vec3 
)

create the positional vertex

Parameters
positionthe position
Returns
the positional vertex index

◆ createVDM()

coat.Mesh.createVDM (   self,
  side = int,
  path_to_exr = str,
  center = vec3,
  radius = float,
  up = vec3,
  x = vec3,
  y = vec3 
)

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
sidethe EXR file side size
path_to_exrthe path to the EXR file
centerthe center of the plane
radiusthe radius that should include the mesh
upthe up vector of the plane
xthe x vector of the plane
ythe y vector of the plane

◆ cutByDistortedPlane()

coat.Mesh.cutByDistortedPlane (   self,
  start = vec3,
  NormalDirection = vec3,
  noise_degree = float,
  noise_scale = float,
  seed = int 
)

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
startthe start point of the plane
NormalDirectionthe normal direction of the plane
noise_degreethe degree of the noise
noise_scalethe scale of the noise
seedthe seed for the noise

◆ cutByPlane()

coat.Mesh.cutByPlane (   self,
  start = vec3,
  NormalDirection = vec3 
)

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
startthe start point of the plane
NormalDirectionthe normal direction of the plane

◆ cylinder()

Mesh coat.Mesh.cylinder (   center = vec3,
  radius = float,
  height = float,
  detail_size = float,
  slices = int,
  caps = int,
  rings = int,
  fillet = float 
)

create the cylinder mesh

Parameters
centerthe center of the cylinder
radiusthe radius of the cylinder
heightthe height of the cylinder
detail_sizethe average length of the edge over the figure. The figure will be divided so that edges length will be approximately the detail_size
slicesthe number of slices, it overrides the detail_size if all of slices, caps, rings are above zero
capsthe number of caps, it overrides the detail_size if all of slices, caps, rings are above zero
ringsthe number of rings, it overrides the detail_size if all of slices, caps, rings are above zero
filletthe fillet radius
Returns
the cylinder mesh

◆ distortByPerlinNoise()

coat.Mesh.distortByPerlinNoise (   self,
  noise_degree = float,
  noise_scale = float,
  anisotropic = bool,
  seed = int 
)

distort the mesh by the Perlin noise

Parameters
noise_degreethe degree of the noise
noise_scalethe scale of the noise
anisotropicif false, the noise will be applied in the direction of the normals, othervice the noise directed in random direction regardless the normals
seedthe seed for the noise

◆ ensureMaterialsAndObjectsExist()

coat.Mesh.ensureMaterialsAndObjectsExist (   self)

ensure that at least one material and one object exist in the mesh

◆ expandOpenEdges()

list coat.Mesh.expandOpenEdges (   self,
  distance = float 
)

extrude open edges of the mesh

Parameters
distancethe distance to extrude
Returns
the list of extruded edges, even is the start vertex, odd is the end vertex

◆ extrudeOpenEdges()

list coat.Mesh.extrudeOpenEdges (   self,
  distance = float,
  direction = vec3 
)

extrude open edges of the mesh

Parameters
distancethe distance to extrude
directionthe extrude direction, if zero , the direction is the local vertex normal
Returns
the list of extruded edges, even is the start vertex, odd is the end vertex

◆ facesCount()

int coat.Mesh.facesCount (   self)

returns the faces amount

Returns
the amount

◆ fromPaintRoom()

coat.Mesh.fromPaintRoom (   self)

get the mesh from the paint room

◆ fromReducedVolume()

coat.Mesh.fromReducedVolume (   self,
  v = Any,
  reduction_percent = float,
  with_subtree = bool,
  all_selected = bool 
)

extract the mesh from the volume and reduce it by the given percent

Parameters
vthe source volume
reduction_percent0 means no reduction, 100 means 100% reduction, i.e. the mesh will be reduced to a single triangle
with_subtreeif true, the subtree will be extracted, otherwise the single volume taken
all_selectedif true, all selected volumes will be extracted, otherwise only the current volume

◆ fromRetopo()

coat.Mesh.fromRetopo (   self)

take the whole mesh from the retopo room

◆ fromVolume()

coat.Mesh.fromVolume (   self,
  v = Any,
  with_subtree = bool,
  all_selected = bool 
)

extract the mesh from the volume

Parameters
vthe source volume
with_subtreeif true, the subtree will be extracted, otherwise the single volume taken
all_selectedif true, all selected volumes will be extracted, otherwise only the current volume

◆ fromVolumeWithMaxPolycount()

coat.Mesh.fromVolumeWithMaxPolycount (   self,
  v = Any,
  max_polycount = int,
  with_subtree = bool,
  all_selected = bool 
)

extract the mesh from the volume and reduce to the given polycount

Parameters
vthe source volume
max_polycountthe required polycount
with_subtreeif true, the subtree will be extracted, otherwise the single volume taken
all_selectedif true, all selected volumes will be extracted, otherwise only the current volume

◆ geometry() [1/2]

Any coat.Mesh.geometry (   self)

The low-level mesh reference allows to create, operate over individual faces, vertices, objects.

Returns
returns the low-level mesh reference

◆ geometry() [2/2]

Any coat.Mesh.geometry (   self)

The low-level mesh reference allows to create, operate over individual faces, vertices, objects.

Returns
returns the low-level mesh reference

◆ getBounds()

boundbox coat.Mesh.getBounds (   self)

get the mesh bound box

Returns
the bound box

◆ getCenterMass()

vec3 coat.Mesh.getCenterMass (   self)

calculate the center mass of the mesh

Returns
the center mass of the surface

◆ getFaceMaterial()

int coat.Mesh.getFaceMaterial (   self,
  faceIndex = int 
)

get the material index over the face, see the getMaterialsCount(), getMaterialName()

Parameters
faceIndexthe face index, should be in [0..facesCount() - 1]
Returns
the material index

◆ getFaceNormal()

vec3 coat.Mesh.getFaceNormal (   self,
  face = int 
)

get the face normal

Parameters
facethe face index
Returns
the face normal

◆ getFaceNormalVertex()

int coat.Mesh.getFaceNormalVertex (   self,
  faceIndex = int,
  faceVertexIndex = int 
)

get the normal vertex index over the face

Parameters
faceIndexthe face index, should be in [0..facesCount() - 1]
faceVertexIndexthe 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

◆ getFaceObject()

int coat.Mesh.getFaceObject (   self,
  faceIndex = int 
)

get the object index over the face, see the getObjectsCount(), getObjectName()

Parameters
faceIndexthe face index, should be in [0..facesCount() - 1]
Returns
the object index

◆ getFaceSquare()

float coat.Mesh.getFaceSquare (   self,
  face = int 
)

get the squareof the face

Parameters
facethe face index
Returns
the square

◆ getFaceUVSquare()

float coat.Mesh.getFaceUVSquare (   self,
  face = int 
)

get the face square in UV space

Parameters
facethe face index
Returns
the square

◆ getFaceUvVertex()

int coat.Mesh.getFaceUvVertex (   self,
  faceIndex = int,
  faceVertexIndex = int 
)

get the UV vertex index over the face

Parameters
faceIndexthe face index, should be in [0..facesCount() - 1]
faceVertexIndexthe 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

◆ getFaceUvVerts()

list coat.Mesh.getFaceUvVerts (   self,
  face = int 
)

get the list of UV vertices indices over the face

Parameters
facethe face index
Returns
the list of UV vertices indices

◆ getFaceUvVertsCount()

int coat.Mesh.getFaceUvVertsCount (   self,
  face = int 
)

get the amount of UV vertices over the face

Parameters
facethe face index
Returns
amount of vertices over the face, 0 if UV-s not assigned

◆ getFaceVertex()

int coat.Mesh.getFaceVertex (   self,
  faceIndex = int,
  faceVertexIndex = int 
)

get the positional vertex index over the face

Parameters
faceIndexthe face index, should be in [0..facesCount() - 1]
faceVertexIndexthe index of the vertex within the face, should be in [0..getFaceVertsCount(faceIndex) - 1]
Returns
the positional vertex index

◆ getFaceVerts()

list coat.Mesh.getFaceVerts (   self,
  face = int 
)

get the list of UV vertex indices over the face, pay attention UV vertices are not same as position vertices

Parameters
facethe face index
Returns
the list of vertex indices

◆ getFaceVertsCount()

int coat.Mesh.getFaceVertsCount (   self,
  face = int 
)

get the amount of vertices over the face

Parameters
facethe face index, should be in [0..facesCount() - 1]
Returns
the verts amount

◆ getLengthAlongDirection()

float coat.Mesh.getLengthAlongDirection (   self,
  dir = vec3 
)

get the mesh size along some axis

Parameters
dirthe axis direction
Returns
the size along the axis

◆ getMaterialName()

str coat.Mesh.getMaterialName (   self,
  idx = int 
)

get the name of the material

Parameters
idxthe material index
Returns
the name

◆ getMaterialsCount()

int coat.Mesh.getMaterialsCount (   self)

get the materials count in the mesh

Returns
the count

◆ getMaterialTexture()

str coat.Mesh.getMaterialTexture (   self,
  idx = int,
  texture_layer = int 
)

get the texture name of the material

Parameters
idxthe material index
texture_layerthe 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)

◆ getMeshNormals()

list coat.Mesh.getMeshNormals (   self)

get the list of all normal vertices of the mesh

Returns
the list of vec3

◆ getMeshUVs()

list coat.Mesh.getMeshUVs (   self)

get the list of all UV vertices of the mesh

Returns
the list of vec2

◆ getMeshVertices()

list coat.Mesh.getMeshVertices (   self)

get the list of all positional vertices of the mesh

Returns
the list of vec3

◆ getObjectName()

str coat.Mesh.getObjectName (   self,
  idx = int 
)

get the name of the object

Parameters
idxthe object index
Returns
the name

◆ getObjectsCount()

int coat.Mesh.getObjectsCount (   self)

returns the objects count in the mesh

Returns
the count

◆ getOpenEdges()

list coat.Mesh.getOpenEdges (   self)

get the list of open edges

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

◆ getOpenSurfaceVolume()

float coat.Mesh.getOpenSurfaceVolume (   self,
  start = vec3,
  dir = vec3 
)

calculate the volume even if the mesh is not closed, in this case we define plane that limits the integration

Parameters
startthe point on that plane
dirthe normalized vector, normal to the plane
Returns
the volume

◆ getSquare()

float coat.Mesh.getSquare (   self)

get square of the mesh

Returns
the square (area)

◆ getVertex()

vec3 coat.Mesh.getVertex (   self,
  idx = int 
)

get the vertex coordinate

Parameters
idxthe vertex index
Returns
the coordinate

◆ getVertexNormal()

vec3 coat.Mesh.getVertexNormal (   self,
  idx = int 
)

get the normal of the vertex, pay attention position verts and normal verts are different, they have different indices

Parameters
idxthe normal vertex index, [0..vertsNormalCount() - 1]
Returns
the normal

◆ getVertexUV()

vec2 coat.Mesh.getVertexUV (   self,
  idx = int 
)

get the UV coordinate of the vertex, pay attention position verts and UV verts are different, they have different indices

Parameters
idxthe UV vertex index, [0..vertsUvCount() - 1]
Returns
the UV coordinate

◆ getVolume()

float coat.Mesh.getVolume (   self)

get the volume of the mesh

Returns
the volume

◆ hexagonal_plane()

Mesh coat.Mesh.hexagonal_plane (   center = vec3,
  sizeX = float,
  sizeY = float,
  divisionsX = int,
  divisionsY = int,
  xAxis = vec3,
  yAxis = vec3 
)

create the single-side triangular plane mesh that consists mostly of quasi equally-sided triangles

Parameters
centerthe center of the plane
sizeXthe plane size along the X-axis
sizeYthe plane size along the Y-axis
divisionsXamount of divisions along the X-axis
divisionsYamount of divisions along the Y-axis
xAxisthe vector of the X-axis
yAxisthe vector of the Y-axis
Returns
the hexagonal plane mesh

◆ insertInVolume()

coat.Mesh.insertInVolume (   self,
  v = Any,
  transform = mat4 
)

insert without boolean operation, if the volume is not in surface mode (volumetric) the boolean ADD will be performed anyway

Parameters
vthe destination volume
transformthe transform

◆ intersectWithVolume()

coat.Mesh.intersectWithVolume (   self,
  v = Any,
  transform = mat4 
)

boolean intersection of the mesh with the volume

Parameters
vthe destination volume
transformthe transform

◆ MakeCopy()

Mesh coat.Mesh.MakeCopy (   self)

◆ plane()

Mesh coat.Mesh.plane (   center = vec3,
  sizeX = float,
  sizeY = float,
  divisionsX = int,
  divisionsY = int,
  xAxis = vec3,
  yAxis = vec3 
)

create the single-side plane mesh, the faces normals are put toward the vec3.Cross(xAxis, yAxis)

Parameters
centerthe center of the plane
sizeXthe plane size along the X-axis
sizeYthe plane size along the Y-axis
divisionsXamount of divisions along the X-axis
divisionsYamount of divisions along the Y-axis
xAxisthe vector of the X-axis
yAxisthe vector of the Y-axis
Returns
the plane mesh

◆ Read()

bool coat.Mesh.Read (   self,
  name = str 
)

Load the mesh from the file.

Parameters
namethe filename. May contain full path or relative to the coat's install or documents folder.
Returns
true if successful.

◆ reduceToPolycount()

coat.Mesh.reduceToPolycount (   self,
  destination_triangles_count = int 
)

reduce the mesh to the given polycount, mesh will be triangulated

Parameters
destination_triangles_countthe required triangles count, if it is above the existing, nothing happens

◆ relax()

coat.Mesh.relax (   self,
  degree = float,
  tangent = bool,
  crease_angle = float 
)

relax the mesh, keep the vertices count

Parameters
degreethe degree of relax, may be > 1
tangentshould be tangent relax
crease_anglethe crease angle between faces (degrees), if the angle between faces is less than crease_angle, the edge relaxed

◆ removeFaces()

coat.Mesh.removeFaces (   self,
  faces = list 
)

remove the set of vertices from the mesh

Parameters
facesthe list of faces indices to remove

◆ removeMaterial()

coat.Mesh.removeMaterial (   self,
  idx = int 
)

remove the material (and corresponding faces) from the mesh

Parameters
idxthe material index

◆ removeObject()

coat.Mesh.removeObject (   self,
  idx = int 
)

remove object from the mesh

Parameters
idxthe object index

◆ removeUnusedFaces()

coat.Mesh.removeUnusedFaces (   self)

remove all faces that contain zero vertices

◆ removeUnusedObjectsAndMaterials()

coat.Mesh.removeUnusedObjectsAndMaterials (   self)

remove all unused objects and materials

◆ removeUnusedVerts()

coat.Mesh.removeUnusedVerts (   self)

remove all unused vertices

◆ rotateToXYAxis()

coat.Mesh.rotateToXYAxis (   self,
  axisX = vec3,
  axisY = vec3 
)

rotate the mesh so that X axis will be aligned with axisX, Y axis will be aligned with axisY

Parameters
axisXthe new X axis
axisYthe new Y axis

◆ rotateToYZAxis()

coat.Mesh.rotateToYZAxis (   self,
  axisY = vec3,
  axisZ = vec3 
)

rotate the mesh so that Y axis will be aligned with axisY, Z axis will be aligned with axisZ

Parameters
axisYthe new Y axis
axisZthe new Z axis

◆ rotateToZXAxis()

coat.Mesh.rotateToZXAxis (   self,
  axisZ = vec3,
  axisX = vec3 
)

rotate the mesh so that Z axis will be aligned with axisZ, X axis will be aligned with axisX

Parameters
axisZthe new Z axis
axisXthe new X axis

◆ setFaceMaterial()

coat.Mesh.setFaceMaterial (   self,
  faceIndex = int,
  materialIndex = int 
)

set the material index over the face, see the getMaterialsCount(), getMaterialName()

Parameters
faceIndexthe face index, should be in [0..facesCount() - 1]
materialIndexthe material index to set for the face

◆ setFaceNormalVertex()

coat.Mesh.setFaceNormalVertex (   self,
  faceIndex = int,
  faceVertexIndex = int,
  normalVertexIndex = int 
)

set the normal vertex index over the face

Parameters
faceIndexthe face index, should be in [0..facesCount() - 1]
faceVertexIndexthe index of the vertex within the face, should be in [0..getFaceVertsCount(faceIndex) - 1]
normalVertexIndexthe normal vertex index, should be in [0..vertsNormalCount() - 1]

◆ setFaceObject()

coat.Mesh.setFaceObject (   self,
  faceIndex = int,
  objectIndex = int 
)

set the object index for the face, see the getObjectsCount(), getObjectName()

Parameters
faceIndexthe face index, should be in [0..facesCount() - 1]
objectIndexthe object index to set for the face

◆ setFaceUvVertex()

coat.Mesh.setFaceUvVertex (   self,
  faceIndex = int,
  faceVertexIndex = int,
  uvVertexIndex = int 
)

set the UV vertex index over the face

Parameters
faceIndexthe face index, should be in [0..facesCount() - 1]
faceVertexIndexthe index of the vertex within the face, should be in [0..getFaceVertsCount(faceIndex) - 1]
uvVertexIndexthe UV vertex index, should be in [0..vertsUvCount() - 1]

◆ setFaceVerts()

coat.Mesh.setFaceVerts (   self,
  face = int,
  vertices = list 
)

set the list of positional vertex indices over the face

Parameters
facethe face index
verticesthe list of vertex indices

◆ setMaterialName()

coat.Mesh.setMaterialName (   self,
  idx = int,
  name = str 
)

set material name

Parameters
idxthe material index
namethe new name

◆ setMaterialTexture()

coat.Mesh.setMaterialTexture (   self,
  idx = int,
  texture_layer = int,
  texture_path = str 
)

set the texture layer filename of the material

Parameters
idxthe material index
texture_layerthe texture layer, 0 - color, 1 - gloss, 2 - bump/displacement, 3 - normalmap, 4 - specular color, 5 - emossive (color), 6 - emissive power
texture_paththe texture path (full or relative to 3DCoat documents folder)

◆ setMeshFaces()

coat.Mesh.setMeshFaces (   self,
  faces = list 
)

set the complete list of faces for the mesh

Parameters
facesthe 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...
...

◆ setMeshNormals()

coat.Mesh.setMeshNormals (   self,
  normals = list 
)

set the list of all normal vertices for the mesh

Parameters
normalsthe list of normals (vec3)

◆ setMeshUVs()

coat.Mesh.setMeshUVs (   self,
  uvs = list 
)

set the list of all UV vertices for the mesh

Parameters
uvsthe list of UVs (vec2)

◆ setMeshVertices()

coat.Mesh.setMeshVertices (   self,
  positions = list 
)

set the list of all positional vertices for the mesh

Parameters
positionsthe list of positions

◆ setObjectName()

coat.Mesh.setObjectName (   self,
  idx = int,
  name = str 
)

set object name

Parameters
idxthe object index
namethe new name

◆ setVertex()

coat.Mesh.setVertex (   self,
  idx = int,
  v = vec3 
)

set the vertex coordinate

Parameters
idxthe vertex index
vthe coordinate

◆ setVertexNormal()

coat.Mesh.setVertexNormal (   self,
  idx = int,
  v = vec3 
)

set the normal of the vertex, pay attention position verts and normal verts are different, they have different indices

Parameters
idxthe normal vertex index, [0..vertsNormalCount() - 1]
vthe normal

◆ setVertexUV()

coat.Mesh.setVertexUV (   self,
  idx = int,
  v = vec2 
)

set the UV coordinate of the vertex, pay attention position verts and UV verts are different, they have different indices

Parameters
idxthe UV vrertex index, [0..vertsUvCount() - 1]
vthe UV coordinate

◆ shell()

coat.Mesh.shell (   self,
  thickness_out = float,
  thickness_in = float,
  divisions = int 
)

add some thickness to the mesh (intrude a bit)

Parameters
thickness_outthe thickness in the outer direction (extrusion)
thickness_inthe thickness in the inner direction (intrusion)
divisionsthe amount of divisions of the edge

◆ sphere()

Mesh coat.Mesh.sphere (   center = vec3,
  radius = float,
  detail_size = float 
)

create the sphere mesh

Parameters
centerthe sphere center
radiusthe sphere radius
detail_sizethe 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

◆ splitDisconnectedParts()

list coat.Mesh.splitDisconnectedParts (   self)

split the mesh into disconnected parts

Returns
the list of meshes

◆ subtractFromVolume()

coat.Mesh.subtractFromVolume (   self,
  v = Any,
  transform = mat4 
)

boolean subtraction of the mesh from the volume

Parameters
vthe destination volume
transformthe transform

◆ symmetry()

coat.Mesh.symmetry (   self,
  start = vec3,
  NormalDirection = vec3,
  resultInQuads = bool 
)

apply symmetry to the mesh

Parameters
startthe start point of the plane
NormalDirectionthe negative part (regarding the plane normal) of the mesh is removed, replaced with positive part
resultInQuadsthe cut faces will produce quads instead of triangles

◆ text()

Mesh coat.Mesh.text (   string = str,
  font = str,
  height = float,
  center = vec3,
  text_direction = vec3,
  text_normal = vec3,
  thickness = float,
  align = int 
)

Create the text mesh.

Parameters
stringthe text string
fontthe font name
heightthe text height
centerthe text center
text_directionthe text direction left to right
text_normalthe normal direction of the text
thicknessthe thickness of the text
alignthe text align, 0 - left, 1 - center, 2 - right
Returns
the text mesh

◆ toVolume()

coat.Mesh.toVolume (   self,
  v = Any,
  transform = mat4,
  op = BoolOpType 
)

merge this mesh to the volume object

Parameters
vthe destination volume
transformthe applied transformation
opthe boolean operation to be performed, -1 means no operation, raw merge, 0 - 1, 1 - subtract, 2 - intersect

◆ transform()

coat.Mesh.transform (   self,
  transform = mat4 
)

transform the mesh

Parameters
transformthe transformation matrix

◆ triangulate()

coat.Mesh.triangulate (   self)

triangulate the mesh

◆ unifyAllObjects()

coat.Mesh.unifyAllObjects (   self,
  name = str 
)

unify all objects in the mesh, i.e.

make one object

Parameters
namethe name of the new object, if empty, the name of the first object will be used

◆ valid()

bool coat.Mesh.valid (   self)

Check if mesh is valid.

Returns
true if mesh is valid

◆ vertsCount()

int coat.Mesh.vertsCount (   self)

returns the amount of verts in the mesh

Returns
the amount

◆ vertsNormalCount()

int coat.Mesh.vertsNormalCount (   self)

returns the amount of normal - verts in the mesh

Returns
teh amount

◆ vertsUvCount()

int coat.Mesh.vertsUvCount (   self)

returns the amount of UV - verts in the mesh

Returns
the amount

◆ weld()

coat.Mesh.weld (   self,
  minimal_relative_distance = float 
)

weld the mesh, remove all vertices that are closer than minimal_relative_distance #mesh_bound_box_diagonal to each other

Parameters
minimal_relative_distancethe minimal distance between vertices, relative to the mesh bound box diagonal

◆ Write()

bool coat.Mesh.Write (   self,
  name = str 
)

Save the mesh to file.

Parameters
nameFull or relative path
Returns
true if successful

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