home *** CD-ROM | disk | FTP | other *** search
- /* CMD: Center 1D
- * Center Object on a single axis */
- /* By Arnie Cachelin © 1993 NewTek Inc. */
-
- call addlib "LWModelerARexx.port", 0
- signal on error
- signal on syntax
-
- ax.1='X'
- ax.2='Y'
- ax.3='Z'
-
- call req_begin 'Center on 1 axis'
- id_ind = req_addcontrol("Axis", 'CH', 'X Y Z')
- if (~req_post()) then do
- call req_end
- exit
- end
- ind = req_getval(id_ind)
- call req_end
-
- t=CenterAx(Ax.ind)
- exit
-
- syntax:
- error:
- t=Notify(1,'!Rexx Script Error','@'ErrorText(rc),'Line 'SIGL)
- exit
-
- CenterAx: Procedure
- arg A
- box=boundingbox() /* Should check out empty list ... */
- parse var box n x1 x2 y1 y2 z1 z2
- cx=-(x2+x1)/2
- cy=-(y2+y1)/2
- cz=-(z2+z1)/2
- say A cx cy cz
- if ~pos(upper(A),'X') then cx=0
- if ~pos(upper(A),'Y') then cy=0
- if ~pos(upper(A),'Z') then cz=0
- say cx cy cz
- call MOVE(cx cy cz)
- return box
-