Skip to content

Commit 7c4522a

Browse files
committed
vismach.py new hal pin vismach.plotclear
The pin can be accessed by virtual control panels (like pyvcp) or with sim_pin. Example: $ sim_pin vismach.plotclear/mode=Pulse
1 parent d145015 commit 7c4522a

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

docs/src/getting-started/updating-linuxcnc.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,8 @@ a user-customized homing.c file.
12521252
lib/hallib/sim_lib.tcL: simulate encoder index if [JOINT_n]HOME_USE_INDEX
12531253
is specified.
12541254

1255+
lib/python/vismach.py: new hal pin vismach.plotclear
1256+
12551257
=== Hal
12561258

12571259
==== Components

lib/python/vismach.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from minigl import *
1919
from math import *
2020
import glnav
21+
import hal
2122

2223
class Collection(object):
2324
def __init__(self, parts):
@@ -880,6 +881,9 @@ def redraw(self, *args):
880881
# back to world again
881882
glPopMatrix()
882883

884+
def plotclear(self):
885+
del self.plotdata[:self.plotlen]
886+
883887
class Color(Collection):
884888
def __init__(self, color, parts):
885889
self.color = color
@@ -999,6 +1003,8 @@ def draw(self):
9991003
glCallList(self.list)
10001004

10011005

1006+
old_plotclear = False
1007+
10021008
def main(model, tool, work, size=10, hud=0, rotation_vectors=None, lat=0, lon=0):
10031009
app = Tkinter.Tk()
10041010

@@ -1010,6 +1016,10 @@ def main(model, tool, work, size=10, hud=0, rotation_vectors=None, lat=0, lon=0)
10101016
# set starting viewpoint if desired
10111017
t.after(100, lambda: t.set_viewangle(lat, lon))
10121018

1019+
vcomp = hal.component("vismach")
1020+
vcomp.newpin("plotclear",hal.HAL_BIT,hal.HAL_IN)
1021+
vcomp.ready()
1022+
10131023
#there's probably a better way of doing this
10141024
global HUD
10151025
HUD = 0
@@ -1034,7 +1044,12 @@ def main(model, tool, work, size=10, hud=0, rotation_vectors=None, lat=0, lon=0)
10341044
t.pack(fill="both", expand=1)
10351045

10361046
def update():
1047+
global old_plotclear
10371048
t.tkRedraw()
1049+
new_plotclear = vcomp["plotclear"]
1050+
if new_plotclear and not old_plotclear:
1051+
t.plotclear()
1052+
old_plotclear=new_plotclear
10381053
t.after(100, update)
10391054
update()
10401055

0 commit comments

Comments
 (0)