/* CMD: Bounding Box
 * Display Bounding Box info, optionally create box for standin Obj.  */
/* By Arnie Cachelin © 1993 NewTek Inc. */

libadd = addlib("LWModelerARexx.port",0)
signal on error
signal on syntax
CurLay=curlayer()
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
s1="!Layer "CurLay": " n" Points"
s2="!Object Bounds"
s3='@'x1 y1 z1
s4='@'x2 y2 z2
s5='@Center 'cx cy cz

if notify(2,s1,s5,s2,s3,s4,'!Create Bounding Box?',"(UNDO to remove Original Object)") then do
 /* Cut and Paste so that 'undo' will remove object, leave box */
  call CUT()
  call MAKEBOX(x1 y1 z1,x2 y2 z2)
  call PASTE()
  end
if (libadd) then call remlib("LWModelerARexx.port")
exit

syntax:
error:
	t=Notify(1,'!Rexx Script Error','@'ErrorText(rc),'Line 'SIGL)
	if (libadd) then call remlib(mxx)
	exit
