g_draw(initialize).
	feedback(draw_geom).

feedback(draw_geom):-
	chat_usr([
		'Select the required modelling package',
		'from the panel.'
		]).
	
b_vim(on):-	/* user has selected xzip */
	to_bb(application,start,anon_run,'xzip'),  /* what about parameters?? */
	tell_usr(cad_status, ' starting...' ),
	chat_usr([
		' ',
		'The CAD package XZIP is now running. Please define',
		'one or more zones and save before exiting.',
		' ']).

b_vim(off):-	/* user has turned off */
	defocus_concept(geometry).

/*  capture script return, display in box */
zip_complete(_Zip_return):-
	tell_usr(cad_status, _Zip_return),
	tell_usr(b_vim,off).


b_autocad(on):-	/* user has selected autocad */
	to_bb(application,start,anon_run,'autocad'),  /* parameters?? */
	tell_usr(cad_status, ' starting...' ),
	chat_usr([
		' ',
		'The CAD package AutoCAD is now running. Please define',
		'2D and 3D surfaces and save as DXF before exiting.',
		' ']).

b_autocad(off):-	/* user has turned off */
	defocus_concept(geometry).

/*  capture script return, display in box */
autocad_complete(_Zip_return):-
	tell_usr(cad_status, _Zip_return),
	tell_usr(b_autocad,off).

b_esp(on):-	/* user has selected esp-r */
	to_bb(application,start,anon_run,'manager'),
	tell_usr(cad_status, ' starting...' ),
	chat_usr([
		' ',
		'The intrinsic CAD features in the ESP-r package will now',
		'be used to define problem geometry and attributes. Please',
		'remember to save before exiting.', 
		' ']).

b_esp(off):-	/* user has turned off */
	defocus_concept(geometry).

/*  capture script return, display in box */
manager_complete(_Zip_return):-
	tell_usr(cad_status, _Zip_return),
	tell_usr(b_esp,off).

b_another(on):-	/* user has selected autocad */
	to_bb(application,start,anon_run,'viewer'),  /* parameters?? */
	tell_usr(cad_status, ' starting...' ),
	chat_usr([
		' ',
		'The current problem can be viewed as a perspective',
		'hidden line image.  You will be asked to supply the ',
		'name of the viewer format input file. [conversions',
		'not yet enabled.', 
		' ']).

b_another(off):-	/* user has turned off */
	defocus_concept(geometry).

/*  capture script return, display in box */
viewer_complete(_Zip_return):-
	tell_usr(cad_status, _Zip_return),
	tell_usr(b_viewer,off).



/*  in case there is a failure in the anon_run script... */
appl_complete(_Zip_return):-
	tell_usr(cad_status, _Zip_return).

