Closed very-meanly closed 3 years ago
I was able to fix locally by changing the add_to_linecollection
method to do this but I'm not sure if this is the preferred approach (specifically, the MultiLineString change might not be the right approach) - let me know if you want me to PR:
def add_to_linecollection(lc, line):
"""Helper function to add a LineString or a MultiLineString to a LineCollection"""
if isinstance(line, LineString):
if len(np.array(line).view(dtype=complex).reshape(-1)):
lc.append(line)
elif isinstance(line, MultiLineString):
for l in line:
add_to_linecollection(lc, l)
Hi !
I recently updated the add_to_linecollection()
function to adress a similar issue, can you try updating occult
and tell me if this issue persists?
Sure! It's a bit late here but I'll give it a go tomorrow evening and report back.
I upgraded it and it seems using len(line.coords) != 0
does indeed fix the issue. Thanks!
Using occult sometimes produces the following error:
This happens when a LineString doesn't have any items, so the resulting Numpy array has zero items. I have attached a sketch that demonstrates the issue - if it doesn't reproduce on your machine, try randomizing the seed - you should eventually trigger the error. Requires vype (obviously) and vsketch to run - can't provide a requirements.txt since it's installed from a git clone (sorry) but I am using vpype 1.7.0.
cvety.zip