mirror of
https://git.mirrors.martin98.com/https://github.com/petaflot/pygcode
synced 2025-08-12 18:29:01 +08:00
block length method
This commit is contained in:
parent
613ae84a1a
commit
1f2e393df6
@ -76,6 +76,16 @@ class Block(object):
|
|||||||
key=k
|
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):
|
def __bool__(self):
|
||||||
return bool(self.words)
|
return bool(self.words)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user