Skip to content

Commit

Permalink
Merge branch 'LinuxCNC:master' into fix_re-syntax-warning
Browse files Browse the repository at this point in the history
  • Loading branch information
BsAtHome authored Dec 25, 2024
2 parents a3ec7e1 + 64a137a commit 949180b
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 23 deletions.
2 changes: 1 addition & 1 deletion docs/src/checkref
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ for F in $FILES; do
OUT=.checklink.$LANGUAGE.$(basename $F).tmp
rm -f $OUT
linuxcnc-checklink --quiet --exclude "(http|https|irc)://" $F 2>&1 | tee $OUT
egrep -q 'List of (broken links and other issues|duplicate and empty anchors)' $OUT
grep -E -q 'List of (broken links and other issues|duplicate and empty anchors)' $OUT
if [ $? -ne 1 ]; then
BAD_LINKS=1
fi
Expand Down
31 changes: 22 additions & 9 deletions docs/src/gui/qtvcp-vismach.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ It is much easier to move while building if the origin of the model is at a rota

Alternatively parts can be _created inside the model script from a range of shape primitives_.

*`assembly = collction([part1,part2,part3])`*::
Collection is a general container of related parts

Many shapes are _created at the origin_ and need to be _moved to the required location_ after creation.

*`cylinder = CylinderX(x1, r1, x2, r2)`*::
Expand Down Expand Up @@ -210,9 +213,6 @@ part4 = Collection([part1, part2])
Parts may need to be moved in the Vismach space to assemble the model.
The origin does not move - Translate() and Rotate() move the Collection as you add parts, relative to a stationary origin.

//FIXME unclear
They may also need to be moved to create the animation as the animation rotation axis is created at the origin (but moves with the Part).

[[sub:qtvcp:vismach:translate]]
=== Translating Model parts

Expand All @@ -227,7 +227,6 @@ They may also need to be moved to create the animation as the animation rotation
[[sec:qtvcp:vismach:animate]]
== Animating Parts

//FIXME 2 or 3 functions ? HalToolCylinder not documented here ?
To *animate the model controlled by the values of HAL pins* there are four functions:
`HalTranslate`, `HalRotate`, `HalToolCylinder` and `HalToolTriangle`.

Expand Down Expand Up @@ -305,7 +304,7 @@ toolshape = Color([1, 1, 0, 1],[HalToolTriangle()])
----

=== HAL Adjustable Primitives
All primitives can have HAL pin names substituted for coordinates. +
All shape primitives can have HAL pin names substituted for coordinates. +
Either by adding the component object as the first variable and substituting the pinname string for a coordinate, or +
by substituting the full component/pinname string for a coordinate. +

Expand Down Expand Up @@ -396,17 +395,17 @@ Sets the _display color of the part_. +
*`part = Color([_colorspec_], [_part_])`*::

Note that unlike the other functions, the part definition comes second in this case. +
`_colorspec_`;; Three RGB values and opacity. +
For example [1,0,0,0.5] for a 50% opacity red.
`_colorspec_`;; Three (0-1.0) RGB values and opacity. [R,G,B,A] +
For example [1.0,0,0,0.5] for a 50% opacity red.

=== HALColorFlip
Sets the _display color of the part based on a designated HAL bit pin state_. +

*`part = HALColorFlip([_colorspec_], [_colorspec_], [_part_], hal_comp, hal_pin)`*::

Note that unlike the other functions, the part definition comes second in this case. +
`_colorspec_`;; Three RGB values and opacity. +
For example [1,0,0,0.5] for a 50% opacity red.
`_colorspec_`;; Three (0-1.0) RGB values and opacity. +
For example [1.0,0,0,0.5] for a 50% opacity red.
`hal_comp`;; The _HAL component Object_ or None. +
In QtVCP if you are reading _system pins_ directly, then the component argument is set to `None`. +
`hal_pin`;; The _name of the BIT HAL IN pin_ that will change the color. +
Expand Down Expand Up @@ -462,6 +461,20 @@ Some of the available HalHUD function: +
* add_pin(text, format, pinname)
* set_text_color(red, green, blue)

=== HideCollection

HideCollection is a container that uses a HAL pin to control display of the contained parts. +
A logic high on the HAL pin will hide the contained parts.

[source,python]
----
comp.newpin("hide-chuck", hal.HAL_BIT, hal.HAL_IN)
# <snip make a machine with an A axis chuck assembly>
chuckassembly = HideCollection([chuckassembly],comp,'hide-chuck')
# also can be used like this
chuckassembly = HideCollection([chuckassembly],None,'myvismach.hide-chuck')
----

=== Capture
This sets the current position in the model.

Expand Down
19 changes: 19 additions & 0 deletions lib/python/qtvcp/lib/qt_vismach/primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,25 @@ def set_volume(self, vol):
self.vol = vol;


class HideCollection(Collection):
def __init__(self, parts, comp, var):
self.parts = parts
self.comp = comp
self.var = var
self.vol = 0

def traverse(self):
try:
if self.comp is None:
v = bool(hal.get_value(self.var))
else:
v = bool(self.comp[self.var])
except:
v = 0
if v:
return
super(HideCollection,self).traverse()

class Translate(Collection):
def __init__(self, parts, x, y, z):
self.parts = parts
Expand Down
2 changes: 1 addition & 1 deletion scripts/githelper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

function githelper() {
if [ -z "$1" ]; then
GIT_BRANCH=$(git branch | egrep '^\*' | cut -d ' ' -f 2)
GIT_BRANCH=$(git branch | grep -E '^\*' | cut -d ' ' -f 2)
if [ "$GIT_BRANCH" = "(no" ]; then
echo "'git branch' says we're not on a branch, pass one in as an argument" > /dev/null 1>&2
return
Expand Down
8 changes: 4 additions & 4 deletions scripts/swish
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Usage:
by swish is grepped for this pattern, and matching lines are
printed. By default, $b attempts to turn swish-pattern into
a grep-pattern, but this only works if swish-pattern is a simple
word. For more information about grep patterns, see 'man egrep'
word. For more information about grep patterns, see 'man grep'
EOF
exit 1
}
Expand All @@ -69,7 +69,7 @@ while getopts "hRF:" opt
do
case "$opt" in
R) FORCEREBUILD=1 ;;
F) FILEFILTER="egrep -z -e $OPTARG" ;;
F) FILEFILTER="grep -E -z -e $OPTARG" ;;
h|?) usage ;;
esac
done
Expand All @@ -91,9 +91,9 @@ fi
if ! [ -z "$FILEFILTER" ]; then
swish-e -f $SWISHINDEX -H0 -x '<swishdocpath>\0' -w "$PAT" \
| $FILEFILTER | makerelative \
| xargs -0 egrep -Hnis -e "$REGEXP"
| xargs -0 grep -E -Hnis -e "$REGEXP"
else
swish-e -f $SWISHINDEX -H0 -x '<swishdocpath>\0' -w "$PAT" \
| makerelative \
| xargs -0 egrep -Hnis -e "$REGEXP"
| xargs -0 grep -E -Hnis -e "$REGEXP"
fi
3 changes: 1 addition & 2 deletions src/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ fi
AC_SUBST([EMC2VERSION])

AC_PATH_PROG(GREP, grep)
AC_PATH_PROG(EGREP, egrep)

#
# check for pkg-config
Expand Down Expand Up @@ -690,7 +689,7 @@ fe () {
# Fully expand argument. Example:
# ${datadir} -> ${datarootdir} -> ${prefix}/share -> /usr/local
case "$1" in
*\$*) eval fe \""$1"\" ;;
*\$*) eval fe "\"$1\"" ;;
*) echo "$1" ;;
esac
}
Expand Down
2 changes: 1 addition & 1 deletion src/hal/classicladder/classicladder_gtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void GetTheSizesForRung( void )

// size of the page or block changed ?
if ( InfosGene->PageHeight!=PageHeightBak || InfosGene->BlockHeight!=BlockHeightBak )
UpdateVScrollBar( TRUE/*AutoSelectCurrentRung*/ );
UpdateVScrollBar( /*AutoSelectCurrentRung*/ );
PageHeightBak = InfosGene->PageHeight;
BlockHeightBak = InfosGene->BlockHeight;
}
Expand Down
2 changes: 1 addition & 1 deletion src/hal/classicladder/manager_gtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void RefreshSectionSelected( )
EditorButtonsAccordingSectionType( );
//XXX search functionality, not implemented in LinuxCNC.
//EnableDisableMenusAccordingSectionType( );
UpdateVScrollBar( TRUE/*AutoSelectCurrentRung*/ );
UpdateVScrollBar( /*AutoSelectCurrentRung*/ );
}

void ManagerDisplaySections( char ForgetSectionSelected )
Expand Down
2 changes: 1 addition & 1 deletion src/hal/classicladder/socket_modbus_master.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void ConfigSerialModbusMaster( void )
int Error = 0;
if ( ModbusConfig.ModbusSerialPortNameUsed[ 0 ]!='\0' )
{
if ( !SerialOpen( ModbusConfig.ModbusSerialPortNameUsed, ModbusConfig.ModbusSerialSpeed ) )
if ( !SerialOpen( /*ModbusConfig.ModbusSerialPortNameUsed, ModbusConfig.ModbusSerialSpeed*/ ) )
{
Error = -1;
printf(_("INFO CLASSICLADDER---I/O Modbus master Data bits %i Stop bits %i Parity %i\n"),ModbusConfig.ModbusSerialDataBits,ModbusConfig.ModbusSerialStopBits,ModbusConfig.ModbusSerialParity);
Expand Down
1 change: 1 addition & 0 deletions src/hal/utils/halrmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@
#include "inifile.h" // iniFind() from libnml
#endif
#include <rtapi_string.h>
*/

/***********************************************************************
* LOCAL FUNCTION DECLARATIONS *
Expand Down
4 changes: 2 additions & 2 deletions tests/module-loading/rtapi-app-main-fails/checkresult
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ if [ ! -f $STDERR ]; then
fi

# Linux spelling of ERANGE
if egrep -q 'rtapi_app_main_fails.* Numerical result out of range' $STDERR; then
if grep -E -q 'rtapi_app_main_fails.* Numerical result out of range' $STDERR; then
echo "loadrt found the test component, and it failed to load"
exit 0
fi

# FreeBSD spelling of ERANGE
if egrep -q 'rtapi_app_main_fails.* Result too large' $STDERR; then
if grep -E -q 'rtapi_app_main_fails.* Result too large' $STDERR; then
echo "loadrt found the test component, and it failed to load"
exit 0
fi
Expand Down
2 changes: 1 addition & 1 deletion tests/module-loading/shared-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
halrun setup.hal > hal-output 2>&1
RESULT=$?

NUM_PINS=$(cat hal-output | egrep $(cat PIN_NAME_REGEX) | wc -l)
NUM_PINS=$(cat hal-output | grep -E $(cat PIN_NAME_REGEX) | wc -l)

if [ $RESULT -ne $(cat RESULT) ]; then
exit 1
Expand Down

0 comments on commit 949180b

Please sign in to comment.