Skip to content

Commit c04e0c3

Browse files
committed
qtvcp -qt_vimach: update toolcylinder functions
use the library functions in primitives.py also add code for origin markers as sample code - off by default.
1 parent 5caacc1 commit c04e0c3

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

lib/python/qtvcp/lib/qt_vismach/mill_xyz.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@
1313
IMPERIAL = 25.4
1414
MODEL_SCALING = IMPERIAL
1515

16-
# Used for tool cylinder
17-
# it will be updated in shape and length by function below.
18-
toolshape = CylinderZ(0)
19-
toolshape = Color([1, .5, .5, .5], [toolshape])
20-
2116
# -----------------------------------------------------------------------------------------------------------
2217
# Concept of machine design
2318

@@ -171,7 +166,7 @@
171166
# it creates cylinder then translates tooltip to end of it.
172167
tool = Collection([
173168
Translate([HalTranslate([tooltip], None, "motion.tooloffset.z", 0, 0, -MODEL_SCALING)], 0, 0, 0),
174-
HalToolCylinder(toolshape)
169+
Color([1, .5, .5, .5], [HalToolCylinder()])
175170
])
176171

177172
# Since tool is defined, lets attach it to cat30
@@ -214,6 +209,15 @@
214209
model = Collection([frame, yassembly, zassembly])
215210

216211

212+
# build axes origin markers
213+
X = CylinderX(-500,1,500,1)
214+
X = Color([1, 0, 0, 1], [X])
215+
Y = CylinderY(-500,1,500,1)
216+
Y = Color([0, 1, 0, 1], [Y])
217+
Z = CylinderZ(-100,1,100,1)
218+
Z = Color([0, 0, 1, 1], [Z])
219+
origin = Collection([X,Y,Z])
220+
217221
# we want to embed with qtvcp so build a window to display
218222
# the model
219223
class Window(QWidget):
@@ -230,7 +234,10 @@ def __init__(self):
230234

231235
world = Capture()
232236

237+
# uncomment and re comment the nect line to se origin markers
238+
#v.model = Collection([origin, model, world])
233239
v.model = Collection([model, world])
240+
234241
size = 600
235242
v.distance = size * 3
236243
v.near = size * 0.01
@@ -249,7 +256,7 @@ def __init__(self):
249256
# It just makes a qtvcp5 window that is defined in qt_vismach.py
250257
# parameter list:
251258
# final model name must include all parts you want to use
252-
# tooltip (special for tool tip inclusuion)
259+
# tooltip (special for tool tip inclusion)
253260
# work (special for work part inclusion)
254261
# size of screen (bigger means more zoomed out to show more of machine)
255262
# hud None if no hud

0 commit comments

Comments
 (0)