Geometry

class dazpy.DazGeometry(client, identifier)[source]

Bases: DazElement

Proxy for the DzGeometry of a node’s current shape.

Provides chunked access to vertices, faces, normals, UV sets, and face / material groups. Use DazNode or construct directly:

from dazpy import DazClient, DazGeometry, NodeIdentifier

geo = DazGeometry(DazClient(), NodeIdentifier("Genesis9"))
verts = geo.vertex_positions_all()
Parameters:
property vertex_count: int | None

Total number of vertices in the mesh (read-only).

property facet_count: int | None

Total number of faces (triangles + quads, read-only).

vertex_positions(start=0, count=5000)[source]

Fetch a chunk of vertex positions.

Parameters:
  • start (int) – Zero-based index of the first vertex to return.

  • count (int) – Maximum number of vertices to return in this chunk.

Returns:

{"total": int, "start": int, "count": int, "vertices": [[x, y, z], ...]}

Return type:

dict

vertex_positions_all(chunk_size=5000)[source]

Return all vertex positions, automatically paginating by chunk_size.

Parameters:

chunk_size (int) – Number of vertices fetched per network round-trip.

Returns:

List of [x, y, z] coordinates for every vertex.

Return type:

list[list[float]]

face_vertex_indices(start=0, count=1000)[source]

Chunked access to facet vertex indices. Returns {total, start, facets: [[v0,v1,v2(,v3)], …]}.

normals(start=0, count=5000)[source]

Chunked access to face normals. Returns {total, start, normals: [[x,y,z], …]}.

property uv_set_count: int | None

Number of UV sets on this mesh (read-only).

uv_positions(uv_set=0, start=0, count=5000)[source]

Chunked access to UV coordinates. Returns {total, start, uvs: [[u,v], …]}.

face_group_names()[source]
material_group_names()[source]
property subdivision_level: int | None

Current subdivision level (0 = base mesh, read-only).

vertex_positions_posed(start=0, count=5000)[source]

Fetch a chunk of fully-deformed world-space vertex positions.

Uses DzObject.getCachedGeom() which returns the final mesh after morph deformations and skeleton skinning have been applied, in world-space coordinates. Use vertex_positions_posed_all() to retrieve all vertices automatically.

Returns:

{"total": int, "start": int, "count": int, "vertices": [[x, y, z], ...]}

Return type:

dict

vertex_positions_posed_all(chunk_size=5000)[source]

Return all world-space posed+morphed vertex positions.

The first call triggers vertex_positions_posed() which forces a cache update; subsequent chunks reuse the same cached geometry.

Returns:

List of [x, y, z] world-space coordinates for every vertex, after skeleton skinning and morph deformations.

Return type:

list[list[float]]

property tris_count: int | None

Number of triangular faces (read-only).

property quads_count: int | None

Number of quad faces (read-only).

mesh_info()[source]

Fetch all mesh metadata in a single HTTP call.

Consolidates what would otherwise be 7+ separate property reads.

Returns:

{vertex_count, facet_count, tris_count, quads_count, subdivision_level, uv_set_count, face_group_names, material_group_names} or None if the geometry is unavailable.

Return type:

dict | None

bounding_box()[source]

Axis-aligned bounding box of the base mesh in one HTTP call.

Iterates all vertices server-side, avoiding the need to transfer every position to Python just to compute an AABB.

Returns:

A BoundingBox, or None if the geometry is unavailable or empty.

Return type:

BoundingBox | None

bounding_box_posed()[source]

AABB of the world-space posed-and-morphed mesh in one HTTP call.

Uses DzObject.getCachedGeom() after forcing a cache update, so the result reflects the current bone pose and all active morphs.

Returns:

A BoundingBox in world space, or None.

Return type:

BoundingBox | None

face_vertex_indices_all(chunk_size=1000)[source]

Return all face vertex indices, paginating automatically.

Parameters:

chunk_size (int) – Faces fetched per network round-trip.

Returns:

List of faces; each face is [v0, v1, v2] (tri) or [v0, v1, v2, v3] (quad).

Return type:

list[list[int]]

normals_all(chunk_size=5000)[source]

Return all face normals, paginating automatically.

Parameters:

chunk_size (int) – Normals fetched per network round-trip.

Returns:

List of [x, y, z] unit normals.

Return type:

list[list[float]]

uv_positions_all(uv_set=0, chunk_size=5000)[source]

Return all UV coordinates for uv_set, paginating automatically.

Parameters:
  • uv_set (int) – UV set index (0 = primary).

  • chunk_size (int) – UV pairs fetched per network round-trip.

Returns:

List of [u, v] pairs.

Return type:

list[list[float]]

face_group_faces(name)[source]

Return the face indices belonging to the named face group.

Parameters:

name (str) – Face group name as returned by face_group_names().

Returns:

List of 0-based face indices, or [] if the group doesn’t exist.

Return type:

list[int]

material_group_faces(name)[source]

Return the face indices belonging to the named material group.

Parameters:

name (str) – Material group name as returned by material_group_names().

Returns:

List of 0-based face indices, or [] if the group doesn’t exist.

Return type:

list[int]

static triangulate(faces)[source]

Convert a list of face index arrays (tris or quads) to all-triangles.

Quads are split along the 0→2 diagonal: [v0, v1, v2, v3][v0, v1, v2] + [v0, v2, v3]. Triangles are passed through unchanged. Faces with any other vertex count are silently skipped.

This is a pure-Python operation — no HTTP round-trip.

Parameters:

faces (list) – List of faces, each a list/tuple of vertex indices, as returned by face_vertex_indices_all().

Returns:

All-triangle face list.

Return type:

list[list[int]]

static as_vec3(vertices)[source]

Wrap [[x, y, z], ...] vertex data in Vec3 objects.

This is a pure-Python operation — no HTTP round-trip.

Parameters:

vertices (list) – List of [x, y, z] arrays, as returned by vertex_positions_all() or vertex_positions_posed_all().

Returns:

List of Vec3.

Return type:

list