-
The code
is to select something, have the
handle placed at the center of selection, then rotate about some axis by some
amount of degrees
written by prl
 |
'Program: rotatecenter.d3m
precision 15
if sys(80)=0 then
message "nothing selected. . . press any key to continue"
end
end if
' Get Boundary of Selected object
minx = sys(196)
miny = sys(197)
maxx = sys(198)
maxy = sys(199)
minz = sys(200)
maxz = sys(201)
avgx = (minx+maxx)/2.0
avgy = (miny+maxy)/2.0
avgz = (minz+maxz)/2.0
>sethandle
{
<pointxyz [avgx, avgy, avgz]
}
sys(36)=1
if Sys(344) = 1 then 'true if in 2d mode
axis$="z"
endif
if axis$="" then input "Enter axis of rotation - x, y ,z", axis$
input "Enter angle of rotation", da
if axis$="x" or axis$="X" THEN a=0
if axis$="y" or axis$="Y" THEN a=1
if axis$="z" or axis$="Z" THEN a=2
>Rotate
{
<Axis [a]
<Angle [da]
}
>RegenerateAll
{
}
end
|
 |
|