Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion lib/python/qtvcp/widgets/basic_probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import os
import hal
import json
import re
from qtpy.QtCore import QProcess, QRegularExpression, QFile, QEvent, Qt, Property
from qtpy import QtGui, QtWidgets, uic, QtCore
from qtpy.QtWidgets import QDialogButtonBox, QAbstractSlider, QLineEdit, QApplication
Expand Down Expand Up @@ -613,6 +614,30 @@ def buildWidget(self):
except Exception as e:
t.setText('Basic Probe Help file Unavailable:\n\n{}'.format(e))

def _set_scaled_html(self, t, html):
# QTextEdit scales raster images with a nearest-neighbour filter, which
# makes the help diagrams look jagged. Pre-scale each raster <img> to
# its requested size with a smooth filter and register it as a document
# resource so Qt draws it 1:1. SVG images are left untouched so Qt's
# vector renderer draws them crisply at any size.
doc = t.document()
for tag in re.findall(r'<img\b[^>]*>', html):
match = re.search(r'src="([^"]+)"', tag)
if match is None or match.group(1).lower().endswith('.svg'):
continue
src = match.group(1)
image = QtGui.QImage(src)
if image.isNull():
continue
width = re.search(r'width="(\d+)"', tag)
height = re.search(r'height="(\d+)"', tag)
if width is not None and int(width.group(1)) != image.width():
image = image.scaledToWidth(int(width.group(1)), QtCore.Qt.SmoothTransformation)
elif height is not None and int(height.group(1)) != image.height():
image = image.scaledToHeight(int(height.group(1)), QtCore.Qt.SmoothTransformation)
doc.addResource(QtGui.QTextDocument.ImageResource, QtCore.QUrl(src), image)
t.setHtml(html)

def next(self,t,direction=None):
if direction is None:
self.currentHelpPage = 0
Expand All @@ -631,7 +656,7 @@ def next(self,t,direction=None):
html = file.readAll()
html = str(html, encoding='utf8')
html = html.replace("../images/widgets/","{}/widgets/".format(PATH.IMAGEDIR))
t.setHtml(html)
self._set_scaled_html(t, html)
if t.verticalScrollBar().isVisible():
t.verticalScrollBar().setPageStep(100)
self.pageStepDwnbutton.show()
Expand Down
29 changes: 27 additions & 2 deletions lib/python/qtvcp/widgets/versa_probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import os
import hal
import json
import re

from qtpy import QtGui, QtCore, QtWidgets, uic
from qtpy.QtCore import QProcess, QEvent, Qt, Property
Expand Down Expand Up @@ -687,6 +688,30 @@ def buildWidget(self):
except Exception as e:
t.setText('Versa Probe Help file Unavailable:\n\n{}'.format(e))

def _set_scaled_html(self, t, html):
# QTextEdit scales raster images with a nearest-neighbour filter, which
# makes the help diagrams look jagged. Pre-scale each raster <img> to
# its requested size with a smooth filter and register it as a document
# resource so Qt draws it 1:1. SVG images are left untouched so Qt's
# vector renderer draws them crisply at any size.
doc = t.document()
for tag in re.findall(r'<img\b[^>]*>', html):
match = re.search(r'src="([^"]+)"', tag)
if match is None or match.group(1).lower().endswith('.svg'):
continue
src = match.group(1)
image = QtGui.QImage(src)
if image.isNull():
continue
width = re.search(r'width="(\d+)"', tag)
height = re.search(r'height="(\d+)"', tag)
if width is not None and int(width.group(1)) != image.width():
image = image.scaledToWidth(int(width.group(1)), QtCore.Qt.SmoothTransformation)
elif height is not None and int(height.group(1)) != image.height():
image = image.scaledToHeight(int(height.group(1)), QtCore.Qt.SmoothTransformation)
doc.addResource(QtGui.QTextDocument.ImageResource, QtCore.QUrl(src), image)
t.setHtml(html)

def next(self,t,direction=None):
if direction is None:
self.currentHelpPage = 0
Expand All @@ -704,8 +729,8 @@ def next(self,t,direction=None):
file.open(QtCore.QFile.ReadOnly)
html = file.readAll()
html = str(html, encoding='utf8')
html = html.replace("../images/probe_icons/","{}/probe_icons/".format(PATH.IMAGEDIR))
t.setHtml(html)
html = html.replace("../images/","{}/".format(PATH.IMAGEDIR))
self._set_scaled_html(t, html)
if t.verticalScrollBar().isVisible():
t.verticalScrollBar().setPageStep(20)
self.pageStepDwnbutton.show()
Expand Down
2 changes: 1 addition & 1 deletion share/qtvcp/widgets_ui/basic_help4.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;">
<h1 style=" margin-top:18px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:xx-large; font-weight:600;">Basic Probe Help 4</span> </h1>
<center><img src="../images/widgets/basic_probe_help/step_off_width.png" width="500"/></center>
<center><img src="../images/widgets/basic_probe_help/step_off_width.png"/></center>



2 changes: 1 addition & 1 deletion share/qtvcp/widgets_ui/basic_help6.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;">
<h1 style=" margin-top:18px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:xx-large; font-weight:600;">Basic Probe Help 6</span> </h1>
<center><img src="../images/widgets/basic_probe_help/z_clearance" width="500"/></center>
<center><img src="../images/widgets/basic_probe_help/z_clearance.png" width="500"/></center>



4 changes: 2 additions & 2 deletions share/qtvcp/widgets_ui/basic_help7.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:20pt; font-weight:600;">Basic Probe Help 7</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:20pt; font-weight:600;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src="/home/chris/emc/share/qtvcp/images/widgets/basic_probe_help/inside_corners_3d_image.png" /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src="../images/widgets/basic_probe_help/inside_corners_3d_image.png" /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">This is a 3d representation of probe starting and finishing points of inside probing.</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">The probe starting placement is approximately on the intersection of edges.</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">the green cross-hair is the finishing position after probing.</span></p></body></html>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">The green cross-hair is the finishing position after probing.</span></p></body></html>
6 changes: 3 additions & 3 deletions share/qtvcp/widgets_ui/basic_help8.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:20pt; font-weight:600;">Basic Probe Help 8 - Example</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:20pt; font-weight:600;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src="/home/chris/emc/share/qtvcp/images/widgets/basic_probe_help/probe_movement.png" /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src="../images/widgets/basic_probe_help/probe_movement.png" /></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">Demo of inside corner probing using the top right button in Basic Probe (</span><span style=" font-size:14pt; font-weight:600;">back_right_inside</span><span style=" font-size:14pt;">).</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">While all probe entries must be correct, the most important settings to change for each probe sequence:</span></p>
Expand All @@ -15,13 +15,13 @@
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">* </span><span style=" font-size:14pt; font-weight:600;">EDGE WIDTH</span><span style=" font-size:14pt;"> -distance along edge wall (away from corner) to start probing.</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">[NOTE]</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">These distance are always to be set in 'machine units' (mm for metric machine, inch for imprial machine)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">These distances are always to be set in 'machine units' (mm for metric machine, inch for imperial machine)</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt; font-weight:600;">Preset:</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;"><br /></p>
<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-size:14pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">manual set probe at the intersection of the edges (ie corner) of material as described by the green bullseye on the button. Set it Z CLEARANCE above the top of material. These can be done by eye.</li></ul>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;"><br /></p>
<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-size:14pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">set EXTRA CLEARANCE to a value that you want the probe to go below the _top_ of material.(So the probe will move from it's start position down Z Clearance + Extra Clearance distance)</li></ul>
<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-size:14pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">set EXTRA DEPTH to a value that you want the probe to go below the _top_ of material.(So the probe will move from its start position down Z Clearance + Extra Depth distance)</li></ul>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;"><br /></p>
<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-size:14pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> set XY CLEARANCE to a value that definitely gives clearance from the wall so when the probe goes down it doesn't hit anything.</li>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;"><br /></p>
Expand Down
2 changes: 1 addition & 1 deletion share/qtvcp/widgets_ui/versa_usage3.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ <h3 style=" margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0
<h3 style=" margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">XY / Z TRAVEL</span><span style=" font-weight:600;"> (maximum) </span></h3>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The maximum distance that the probe will travel during the initial search. If the search distance is too short, you will receive a message like &quot;G38 finished without making contact&quot;. For safety reasons, it is recommended to set this parameter to 3-4 mm more than probe stylus diameter. Z travel used for straight down probing.</p>
<h3 style=" margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:large; font-weight:600;">LATCH RTN</span></h3>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The distance the probe is retracted after making initial contact with the workpiece. This should be a short distance because the second approach will be at a slow speed, but large enough for the probe to break contact and bring it to the search ready state. If the Latch Rtn distance too large, you will end up spending a lot of time waiting for the search to complete. Recommendation: 1-2 mm </p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The distance the probe is retracted after making initial contact with the workpiece. This should be a short distance because the second approach will be at a slow speed, but large enough for the probe to break contact and bring it to the search ready state. If the Latch Rtn distance is too large, you will end up spending a lot of time waiting for the search to complete. Recommendation: 1-2 mm </p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:large; font-weight:600;">PROBE HT</span></p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The height of the tool sensor from the machine table surface. This value is used to calculate the Z zero height for the current work coordinate system when using the probe with a tool setter sensor. </p>
<h3 style=" margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:large; font-weight:600;">BLOCK HT</span></h3>
Expand Down
6 changes: 3 additions & 3 deletions share/qtvcp/widgets_ui/versa_usage4.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:xx-large; font-weight:600;">Versa Probe Usage (pg4) </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src="/home/chris/emc/share/qtvcp/images/probe_icons_1024x768/outside_corner_help.png" /></p>
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src="../images/probe_icons_1024x768/outside_corner_help.png" width="500" /></p>
<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Sequence of movements for Outside Corner </p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Manually jog the probe tip to about 2-10 mm above the workpiece surface.</p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Manually jog the XY position to about the position indicated by the colored dot on the appropriate button of the Probe Screen.</p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Set the (edge)<span style=" font-weight:600;"> length </span>to have the probe move along the edge (away from the corner) the desired distance.</p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Set the (edge)<span style=" font-weight:600;"> XY (clearence) </span>to have the probe move away from the edge for probe clearence when lowring the probe in Z .If the <span style=" font-weight:600;">XY (clearence) </span>moves the probe farther away then the probe maximum<span style=" font-weight:600;"> Z travel </span>distance, the probing will fail.</p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Set the (edge)<span style=" font-weight:600;"> Z (clearence) </span>to have the probe move down the desired distance for clean material probing.</p></body></html>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Set the (edge)<span style=" font-weight:600;"> XY (clearance) </span>to have the probe move away from the edge for probe clearance when lowering the probe in Z. If the <span style=" font-weight:600;">XY (clearance) </span>moves the probe farther away than the probe maximum<span style=" font-weight:600;"> Z travel </span>distance, the probing will fail.</p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Set the (edge)<span style=" font-weight:600;"> Z (clearance) </span>to have the probe move down the desired distance for clean material probing.</p></body></html>
Loading
Loading