block length method

This commit is contained in:
Peter Boin 2017-08-14 16:33:54 +10:00
parent 613ae84a1a
commit 1f2e393df6

View File

@ -76,6 +76,16 @@ class Block(object):
key=k
))
def __len__(self):
"""
Block length = number of identified gcodes (+ 1 if any modal parameters are defined)
:return: block length
"""
length = len(self.gcodes)
if self.modal_params:
length += 1
return length
def __bool__(self):
return bool(self.words)