File "RDL_generation.il"

Full Path: /home/analogde/www/VirtualKeyboardSample/SKILL/RDL_generation.il
File size: 7.19 KB
MIME-type: text/plain
Charset: utf-8

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure(valide_choix()

	ligne = form_bump~>ligne~>enabled=nil 
	colonne = form_bump~>colonne~>enabled=nil 
	spacing_x = form_bump~>spacing_x~>enabled=nil  
	spacing_y = form_bump~>spacing_y~>enabled=nil 
	diametre = form_bump~>diametre~>enabled=nil 

;	for(i 0 length(terminal_list)-1
;	     stringToSymbol(sprintf(indice "form_bump~>position_pin_%d~>enabled=t" i))	
;	     evalstring(indice) 
;	)


	ligne = form_bump~>ligne~>value 
	colonne = form_bump~>colonne~>value 

	for(i 0 ligne
		for(j 0 colonne-1
			stringToSymbol(sprintf(indice "form_bump~>bump_%d_%d~>invisible=nil" i j))	
			     evalstring(indice) 
			stringToSymbol(sprintf(indice "form_bump~>bump_%d_%d~>enabled=t" i j))	
			     evalstring(indice) 
		)
	)

)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure(init()

	ligne = form_bump~>ligne~>enabled=t 
	colonne = form_bump~>colonne~>enabled=t 
	spacing_x = form_bump~>spacing_x~>enabled=t  
	spacing_y = form_bump~>spacing_y~>enabled=t 
	diametre = form_bump~>diametre~>enabled=t 

	for(i 0 7
		for(j 0 7
			stringToSymbol(sprintf(indice "form_bump~>bump_%d_%d~>invisible=t" i j))	
			evalstring(indice) 
			stringToSymbol(sprintf(indice "form_bump~>bump_%d_%d~>enabled=nil" i j))	
			evalstring(indice) 
		)
	)
	
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure(positionner()

	cv = geGetWindowCellView()
	terminal_list = cv~>terminals~>name  


	pins = '()
	labels = '()

	for(i 0 length(terminal_list)-1
	    id = dbFindNetByName(cv nth(i terminal_list)) 
	    id_pin = car(id~>pins~>fig)
	    id_label= car(id_pin~>children) 
	    pins = append1(pins id_pin)	
    	    labels = append1(labels id_label)	
	)

	ptr = 0
	for(i 0 length(final)-1
   	    colonne_coord = nth(i final)
	    
	    for(j 0 length(colonne_coord)-1
	
	        box = nth(ptr pins)~>bBox
	        centreX=((caadr(box) - caar(box))/2.0) + caar(box)
	        centreY=((cadadr(box) - cadar(box))/2.0) + cadar(box)
	        X = car(car(nth(j colonne_coord)))
	        Y = cadr(car(nth(j colonne_coord)))	

		max = sqrt( (rayon * rayon) / 2.0 ) ; taille de la pin

	        x1 = X - max	
	        y1 = Y - max
	        x2 = X + max
	        y2 = Y + max
		coord = '()			
	        coord = list(x1:y1 x2:y2)
		printf("* %f   %f \n" X Y)
	        nth(ptr pins)~>bBox = coord
		nth(ptr labels)~>xy = list(X Y)
		nth(ptr labels)~>height = 20
		nth(ptr labels)~>font = "roman"
		
		ptr = ptr +1
	     )				
	)

	  printf(" Generation is done ...  \n"  )

)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure(gui_bump()


	champs =  list(
			
			list(hiCreateIntField( ?name 'ligne
			                         ?prompt "Nombre ligne :"
				                 ?value 1
				                 ?defValue 1
				                 ?range (range 0 100)
				                 ;?editable nil
                                               )
				 30:10
			         150:30
				 100
		             )

			list(hiCreateIntField( ?name 'colonne
			                         ?prompt "Nombre colonne :"
				                 ?value 1
				                 ?defValue 1
				                 ?range (range 0 100)
				                 ;?editable nil
                                               )
				 30:40
			         150:30
				 100
		             )

			list(hiCreateFloatField( ?name 'spacing_x
			                         ?prompt "Distance X :"
				                 ?value 1.0
				                 ?defValue 1.0
				                 ?range (range 0 1000)
				                 ;?editable nil
                                               )
				 30:70
			         150:30
				 100
		             )

			list(hiCreateFloatField( ?name 'spacing_y
			                         ?prompt "Distance Y :"
				                 ?value 1.0
				                 ?defValue 1.0
				                 ?range (range 0 1000)
				                 ;?editable nil
                                               )
				 30:100
			         150:30
				 100
		             )

			list(hiCreateFloatField( ?name 'diametre
			                         ?prompt "Diametre Bump :"
				                 ?value 1.0
				                 ?defValue 1.0
				                 ?range (range 0 1000)
				                 ;?editable nil
                                               )
				 30:140
			         150:30
				 100
		             )



			list(hiCreateButton( ?name 'btn_valide_choix   ;'bouton_generer_bump
				             ?buttonText "Valide choice" ;"Create Bump Matrix"
				             ?callback  "valide_choix()" ;;"matrice_bump()"
				           ) 
			
			         50:180
			         150:30
				 100
		             )


			list(hiCreateButton( ?name 'bouton_reset
				             ?buttonText "Reset" 
				             ?callback  "init()" 
				           ) 
			
			         250:180
			         150:30
				 100
		             )

			)

	cv = geGetWindowCellView()
	terminal_list = cv~>terminals~>name  

	y=300

	for(i 0 7
		for(j 0 7
		    ;nom = nth(i terminal_list)
		    ;provi = sprintf(nil "  (%d)" i+1)
		    ;blase = strcat(nom provi)

		    id_nom = hiCreateStringField( ?name stringToSymbol(sprintf(nil "bump_%d_%d" i j))	
			                          ?prompt " "
			  	                  ?value ""
				                  ?defValue ""
				                  ?enabled nil
						  ?invisible t
                                                )
			
		    champs = append1(champs list(id_nom 10+j*100:y+30 100:50 20 )) 
	      )
 	            y=300 + i*40
	)

	hiCreateAppForm( ?name		'form_bump
			 ?fields	champs
			 ?formTitle 	"# Bump Tools #"
			 ?unmapAfterCB	nil
			 ?initialSize   t
			 ?callback	'matrice_bump()
		       )

	hiDisplayForm('form_bump)
 
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure(matrice_bump()


	cv=geGetWindowCellView()

	ligne = form_bump~>ligne~>value 
	colonne = form_bump~>colonne~>value 

	spacing_x = form_bump~>spacing_x~>value 
	spacing_y = form_bump~>spacing_y~>value 
	diametre = form_bump~>diametre~>value

	;ligne = 5
	;colonne = 6
	;spacing_x = 200.00
	;spacing_y = 200.00
	;diametre = 300.00

	rayon = diametre / 2.0
	
	; paire ?
	test = evenp(colonne)
	if(test == t then
	  x_start = (colonne / 2.0) * spacing_x + (colonne / 2.0) * diametre - (diametre + spacing_x) / 2.0
	else
	   x_start =  ( (colonne - 1) * spacing_x + (colonne - 1) * diametre ) / 2.0
	)

	; paire ?
	test = evenp(ligne)
	if(test == t then
	  y_start = (ligne/ 2.0) * spacing_y + (ligne / 2.0) * diametre - (diametre + spacing_y) / 2.0
	else
	  y_start =  ( (ligne - 1) * spacing_y + (ligne - 1) * diametre ) / 2.0
	)	  
	
	final = '()

	for(i 0 ligne-1
	    tab_centre_bump = '()
	    ycentre = y_start - i * (spacing_y + diametre)	
	    for(j 0 colonne-1	
		xcentre = x_start - j * (spacing_x + diametre)
		x1 = xcentre - rayon
		y1 = ycentre - rayon
		x2 = xcentre + rayon
		y2 = ycentre + rayon
	        box = list(x1:y1 x2:y2)
		dbCreateEllipse(cv "METAL1" box)
		couple = '()
		couple = list(xcentre:ycentre)
		tab_centre_bump = append1(tab_centre_bump couple)	
	    )	
		tmp ='()
		tmp = reverse(tab_centre_bump)		
		final= append1(final tmp)	
	)

)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
gui_bump()