Thank you for the response,
I must still be missing something. Here is a bit of copy and pasted code
showing the errors I'm getting. I've tried to switch the steps around, but
I'm either doing it entirely wrong or out of order.
# points = [ (1,1),(-1,1),(-1,-1),(1,-1) ]
# info - triangle.MeshInfo()
# info.set_points(points)
In [7]: info.number_of_point_attributes = len(points)
In [8]: info.point_attributes.setup()
In [9]: info.point_attributes.resize(info.number_of_point_attributes)
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-9-bc7662256946> in <module>()
----> 1 info.point_attributes.resize(info.number_of_point_attributes)
RuntimeError: sizes of slave arrays cannot be changed
In [10]: info.point_attributes = [0, 0, 0, 0]
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-10-2b8f54b361cb> in <module>()
----> 1 info.point_attributes = [0, 0, 0, 0]
AttributeError: can't set attribute
In [11]: info.number_of_point_attributes
Out[11]: 4
In [12]: for i in range(len(points)):
...: info.point_attributes[i] = 0
...:
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-12-46f6e95be2d8> in <module>()
1 for i in range(len(points)):
----> 2 info.point_attributes[i] = 0
3
RuntimeError: Unable to compute length of object
In [13]: len(points)
Out[13]: 4
In [14]: info.point_attributes[0] = 0
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-14-a668da6f5c4b> in <module>()
----> 1 info.point_attributes[0] = 0
RuntimeError: Unable to compute length of object
In [15]: len(info.point_attributes)
Out[15]: 4
Thanks again,
Matthew
On Tue, Aug 20, 2019 at 6:05 PM Andreas Kloeckner <lists(a)informa.tiker.net>
wrote:
Matthew B <thefatalaccidents(a)gmail.com> writes:
I've also tried to treat it like regions
info.point_attributes.setup()
info.point_attributes.resize(len(points))
RuntimeError: sizes of slave arrays cannot be changed
for i, p in info.points:
info.point_attributes[i] = 0 # or whatever number
IndexError: index out of bounds
This is the correct way, but before that works, you need an assignment
to info.number_of_point_attributes.
HTH,
Andreas