


	   dbCreateRect( cv list("prBoundary" "drawing") points )

           dbOpenCellViewByType(t_libName t_cellName t_layName nil "r")
	   printf("* Error * unable to open layout %s %s %s in read-only mode\n" t_libName t_cellName t_layName)
	   return(nil)
       
           ;; open "write" mode - delete pre-existing
           dbOpenCellViewByType(t_libName t_cellName t_absName "maskLayout" "w"))
	   printf("* Error * unable to open abstract %s %s %s in 'write' mode\n" t_libName t_cellName t_absName)
	   return(nil)



	    ;; Create the pin

	    text = "nom_de_la_pin"

	    x = -100
	    y = 0
	    d = 0.5		

            leCreatePin(cv list("m1" "pin") "rectangle" list(x-d:y-d x+d:y+d) text "inputOutput" list("top" "bottom" "left" "right"))
      

		llx = x - d/2
    		lly = y - d/2
	        urx = x + d/2
                ury = y + d/2

	        box = list(llx:lly urx:ury)

	     	fig = dbCreateRect(cv list("m1" "pin") box)
       		layerNet = label~>layerName
       		label~>layerName = layeruse
       		genLabel = label~>theLabel
       		extLbl = setof(l defLbl member(car(l) list(label~>theLabel)))      		
       		label~>theLabel = caadar(extLbl) 
       		extTerm = cadr(cadar(extLbl))     
		         		
       		extNet = dbMakeNet(cv label~>theLabel nil)
       		dbCreateTerm(extNet nil extTerm)
                dbCreatePin(extNet fig) 
                printf("\n...added pin %s instead of label %s with direction %s on layer %s\n" 
                	label~>theLabel genLabel extTerm layerNet)           


		
       iInst = dbCreateInst(absId symPin nil list(xLoc yLoc) "R0")
       nInst = dbMakeNet(absId name nil)
       pInst = dbCreatePin(nInst iInst nil)
       pInst~>accessDir = list("top" "bottom" "left" "right")
       dprint(xLoc)
       xLoc =   2*(nth(0 nth(1 symPin~>bBox))- nth(0 nth(0 symPin~>bBox)))+xLoc



	db_net = dbCreateNet(cv "OT")

	db_pinFig = dbCreateRect( cv  list("m1" "drawing")  list(0:0 1:1)  )

	dbCreatePin(db_net db_pinFig "OT" ) 

	db_term = dbCreateTerm(db_net "OUT" "inputOutput") 


	   ;; A. "copies" all terminals
	;; we reverse, to keep pin name the same than "absAbgen"
	foreach( lay_term d_cvLay~>terminals
	   ;; creates net in new cellview
	   when( (d_net = dbMakeNet( d_cvAbs lay_term~>net~>name ))
	      ;; creates the "same name" subnet
	      d_subnet = dbMakeNet( d_cvAbs lay_term~>net~>name d_net )
	      ;; creates the "1" subnet subnet, to which figure is attched
	      d_one_net = dbMakeNet( d_cvAbs "1"  d_subnet )
	      ;; creates terminal
	      dbCreateTerm(d_net lay_term~>name lay_term~>direction)
	      foreach( lay_pin  lay_term~>pins
		 ;; copies the associated fig
		 d_fig = dbCopyFig(lay_pin~>fig d_cvAbs)
		 ;; creates the pin
		 d_pin = dbCreatePin(d_one_net d_fig)
		 d_pin~>accessDir = lay_pin~>accessDir
	      ) ; ** foreach lay_pin **
	   )
 	
