Downloaded and compiled Head (2012/01/23) on linux (Ubuntu 10.10)
Xform does not seem to want to work with sub files unless running as root - I don't understand why and have not had problem in previous versions!
Example of problem can be replicated below:
cd /tmp
mkdir test
cd test
cat > box.rad << EOF
!genbox blue_plastic box .5 .5 .5
EOF
cat > main.rad << EOF
void plastic blue_plastic
0
5 .1 .1 .6 .05 .1
!xform -rz 15 -t .5 .75 0 box.rad
EOF
getbbox main.rad
xform: cannot find file "box.rad"
xmin xmax ymin ymax zmin zmax
1e+10 -1e+10 1e+10 -1e+10 1e+10 -1e+10
sudo getbbox main.rad
xmin xmax ymin ymax zmin zmax
0.37059 0.982963 0.75 1.36237 0 0.5
If the box file is incorporated in the main.rad file such as
!genbox blue_plastic box .5 .5 .5 | xform -rz 15 -t .6 .75 0
then there is no problem with the "getbbox main.rad " running as user.
Other details:
echo $PATH
/opt/paraviewopenfoam381/bin:/home/ubuntu/OpenFOAM/ubuntu-1.7.1/applications/bin/linuxGccDPOpt:/opt/site/1.7.1/bin/linuxGccDPOpt:/opt/openfoam171/applications/bin/linuxGccDPOpt:/opt/openfoam171/wmake:/opt/openfoam171/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
whereis getbbox xform
getbbox: /usr/local/bin/getbbox
xform: /usr/local/bin/xform
echo $RAYPATH
/usr/local/lib/ray
echo $SHELL
/bin/bash
···
--
*Terrance Mc Minn
**Lecturer, Department of Architecture
Built Environment
*
*Curtin**University*
**
*Email |*[email protected] <[email protected]>
**
Hi Terrance,
xform searches the RAYPATH variable for its input files. For some reason, yours doesn't include the current directory "." Therefore, it will only find "box.rad" if it exists in "/usr/local/lib/ray" and it has permission to reach the file. If it exists but doesn't have permission, then it will only work if run in super-user mode.
A way around the above problem is always to give the path explicitly, e.g., "./box.rad" instead of "box.rad". Or, simply include the current directory in your RAYPATH setting first, as is standard: RAYPATH=".:/usr/local/lib/ray".
I did run a test just to see if sudo would allow "box.rad" to be found in the current directory despite its absence from RAYPATH and it worked just as you say. I'm rather puzzled by this behavior, actually, so I'll have to investigate further. In any case, the above fix is the one you want.
Cheers,
-Greg
···
From: Terrance Mc Minn <[email protected]>
Date: January 26, 2012 10:48:41 PM PST
Downloaded and compiled Head (2012/01/23) on linux (Ubuntu 10.10)
Xform does not seem to want to work with sub files unless running as root - I don't understand why and have not had problem in previous versions!
Example of problem can be replicated below:
cd /tmp
mkdir test
cd test
cat > box.rad << EOF
!genbox blue_plastic box .5 .5 .5
EOF
cat > main.rad << EOF
void plastic blue_plastic
0
0
5 .1 .1 .6 .05 .1
!xform -rz 15 -t .5 .75 0 box.rad
EOF
getbbox main.rad
xform: cannot find file "box.rad"
xmin xmax ymin ymax zmin zmax
1e+10 -1e+10 1e+10 -1e+10 1e+10 -1e+10
sudo getbbox main.rad
xmin xmax ymin ymax zmin zmax
0.37059 0.982963 0.75 1.36237 0 0.5
If the box file is incorporated in the main.rad file such as
!genbox blue_plastic box .5 .5 .5 | xform -rz 15 -t .6 .75 0
then there is no problem with the "getbbox main.rad " running as user.
Other details:
echo $PATH
/opt/paraviewopenfoam381/bin:/home/ubuntu/OpenFOAM/ubuntu-1.7.1/applications/bin/linuxGccDPOpt:/opt/site/1.7.1/bin/linuxGccDPOpt:/opt/openfoam171/applications/bin/linuxGccDPOpt:/opt/openfoam171/wmake:/opt/openfoam171/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
whereis getbbox xform
getbbox: /usr/local/bin/getbbox
xform: /usr/local/bin/xform
echo $RAYPATH
/usr/local/lib/ray
echo $SHELL
/bin/bash
--
Terrance Mc Minn
I figured out what was going on -- apparently, the "sudo" command clears all the user-set environment variables, including RAYPATH. So, it reverts to the default path that includes "."
QED
-Greg