PyVMF.Solid

class Solid(dic: Optional[dict] = None, children: Optional[list] = None)

Corresponds to an individual solid just like in Hammer

Parameters:
  • dic (dict) – All the values to be initialized, if empty default values are used.
  • children (list) – The Side’s and Editor to be initialized
__init__(dic: Optional[dict] = None, children: Optional[list] = None)

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(dic, children) Initialize self.
add_sides(*args) Adds sides to the solid, note that no checks are made for validity
copy() Copies the class using deepcopy()
export() Gets all the variables than need to be exported into the .VMF file
export_children() Gets all the children classes
flip([x, y, z])
get_3d_extremity(x, y, z) Finds the vertices that are the furthest on the given axes, as well as ties
get_all_vertices() Finds all vertices on the solid, including overlapping ones from the different sides, for only unique vertices use get_only_unique_vertices()
get_axis_extremity(x, y, z) Finds the vertex that is the furthest on the given axis, only 1 axis per method call, see get_3d_extremity()
get_displacement_matrix_sides() Gets the matrices from all the sides that have displacements, use get_displacement_sides() to get the sides instead
get_displacement_sides() Gets the sides that have displacements, use get_displacement_matrix_sides() to get the matrices directly instead
get_linked_vertices(vertex[, similar])
param vertex:The vertex to check against
get_only_unique_vertices() Finds all unique vertices on the solid, you should not use this for vertex manipulation as changing one doesn’t change all of them.
get_sides()
return:All the sides on the solid
get_texture_sides(name[, exact])
param name:The name of the texture including path (ex: tools/toolsnodraw)
has_texture(name[, exact])
param name:The name of the texture including path (ex: tools/toolsnodraw)
ids()
is_simple_solid()
return:A solid is considered simple if it has 6 or less sides
link_vertices([similar]) Tries to link all the vertices that are similiar
move(x, y, z) Moves all sides of the solid by the given amount in Hammer units
naive_subdivide([x, y, z]) Naively subdivides a copy of the solid, works best for rectangular shapes.
remove_all_displacements() Removes all displacements from the solid
replace_texture(old_material, new_material) Checks all the sides if they have the given texture, if so replace it
rotate_x(center, angle) Rotates the solid around the x axis
rotate_y(center, angle) Rotates the solid around the y axis
rotate_z(center, angle) Rotates the solid around the z axis
scale(center[, x, y, z]) Scales the solid using ratios.
set_texture(new_material) Sets the given texture on all sides
window(direction) Creates a hole in the wall, only works on 90 degree blocks

Attributes

ID
NAME
center Finds the center of the solid based on the average of all vertices.
center_geo Finds the center of the solid based on the extremities of all 3 axes.
size
return:The total size of the bounding rectangle around the solid