/* Création des réseaux sur un circuit n'en contenant aucun */
/* Version 1.00, 18 août 2001 */
/* Version 1.01, 17 novembre 2001, modification GETNET en NETNUM */
/* Version 1.02, 28-Dec-2001, German localization by A. Greve */
/* Version 1.03, 5-Jan-2001, ajout test présence piste et pastilles */
/* $VER: CreateNets 1.03, © R.Florac/A.Greve 5-Jan-2001 */

options results     /* indispensable pour récupérer le résultat des macros */

signal on error     /* pour l'interception des erreurs */
signal on syntax

fr = 'ARexx/InitVars.AmiPCB'()

'FINDOBJ(0,TRACK,-1,-1)'
if result=0 then do
    select
	when fr=1 then 'MESSAGE("Il n''y aucune piste sur ce document !")'
	when fr=2 then 'MESSAGE("Es gibt keine Leiterbahn in diesem Dokument !")'
	otherwise      'MESSAGE("There is no track on this document !")'
    end
    exit
end

'FINDOBJ(0,PAD,-1,-1)'
p=result
if p=0 then do
    select
	when fr=1 then 'MESSAGE("Il n''y aucune pastille sur ce document !")'
	when fr=2 then 'MESSAGE("Es gibt keine Pads in diesem Dokument !")'
	otherwise      'MESSAGE("There is no pad on this document !")'
    end
    exit
end
do while p>0
    'GETNET('p',0)'
    if result=0 then do
	'GROUP('p')'
	if result>0 then do
	    p0=p
	    p1=0
	    'UNMARK(0):MARK('p'):MENU("Select track")'
	    do while p0>0
		'GROUP('p0')'
		if result>0 then do
		    if p1>0 then 'NET('p0','p1')'
		    p1=p0
		end
		'FINDOBJ('p0',-PAD,-1,-1)'
		p0=result
	    end
	end
    end
    'FINDOBJ('p',PAD,-1,-1)'
    p=result
end
'MENU("Minimize")'
exit

/* Traitement des erreurs, interruption du programme */
syntax:
erreur=RC
Call 'ARexx/_Syntax.rexx'(fr,'CreateNets.AmiPCB',SIGL,erreur)
exit

error:
Call 'ARexx/_Error.rexx'(fr,'CreateNets.AmiPCB',SIGL)
exit
