MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / add_attribute

Method add_attribute

python/pymesh/wires/WireNetwork.py:223–239  ·  view source on GitHub ↗

Add a new attirbute. Args: name (``str``): Attribute name. value (:py:class:`numpy.ndarray`): N by d matrix of attribute values (one row per vertex or per edge). Default is None to represent uninitialized attribute value.

(self, name, value=None, vertex_wise=True)

Source from the content-addressed store, hash-verified

221 return self.raw_wires.has_attribute(name)
222
223 def add_attribute(self, name, value=None, vertex_wise=True):
224 """ Add a new attirbute.
225
226 Args:
227 name (``str``): Attribute name.
228
229 value (:py:class:`numpy.ndarray`): N by d matrix of attribute
230 values (one row per vertex or per edge). Default is None to
231 represent uninitialized attribute value.
232
233 vertex_wise (``bool``): Whether this attribute is assigned to
234 vertices or edges.
235 """
236 if not self.has_attribute(name):
237 self.raw_wires.add_attribute(name, vertex_wise)
238 if value is not None:
239 self.raw_wires.set_attribute(name, value)
240
241 def get_attribute(self, name):
242 """ Get the value of an attribute.

Callers 15

generate_supportsFunction · 0.95
quad_to_triFunction · 0.45
subdivideFunction · 0.45
separate_meshFunction · 0.45
is_vertex_manifoldFunction · 0.45
is_edge_manifoldFunction · 0.45
keep_featuresMethod · 0.45
__get_ave_edge_lengthMethod · 0.45
collapse_short_edgesFunction · 0.45
hex_to_tetFunction · 0.45
mesh_to_dual_graphFunction · 0.45

Calls 2

has_attributeMethod · 0.95
set_attributeMethod · 0.45

Tested by 15

test_vertex_to_vertexMethod · 0.36
test_attributesMethod · 0.36
test_ballsMethod · 0.36
test_plyMethod · 0.36
test_mshMethod · 0.36
test_refineMethod · 0.36