实现元件对齐功能的skill源码(align_sym.il)
;+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
;
;
Author: Edward B. Acheson
;
Sr Division AE
;
SPG Division
;
Benchmark Center
;
Cadence Design Systems
;
270 Billerica Road
;
Chelmsford MA 01824
;
(508) 262-6465
;
;
File Name:
align_sym.il
;
Revision 0: December 20,1993
;
;
;
Purpose: To allow the User to align Component
;
Package symbols by Component Origin or
;
by component pin 1.
;
Usage: Once this file is loaded into the Allegro
database
;
enter align_sym<ret> and a form will
display
;
Items may be picked by top, bottom or both. Items
;
may be selected by window, group or tolerance. In
;
selecting by group or window, the user may specify
;
choice by class. The tolerance value is the distance
;
to each side of the alignment axis.
;
1. Select Form Options
;
2. Select "Key Componen" to align other symbols to.
;
3. If Group or window is selected, define the window or
;
define group elements, and pick complete in
;
popup window ( middle mouse button).
;
4. Go on to next or hit done.
;
Special notes:
;
1. All Symbol definitions must exist in a Library Path.
;
2. Shape in symbols not recognized.
;
3. Any etch connected will be deleted.
;
4. Symbol definition as found in library will
;
be maintained. (this includes alt_symbols).
;
;
;
Other files required:
align_sym.form
;=========================================================
;==================== MAIN ROUTINE
=======================
;=========================================================
axlCmdRegister(
"align_sym"
'align_sym
)
procedure( align_sym( )
(prog ()
when( axlOKToProceed()
_ASInitVar()
_ASCreateFormFile()
_ASInitParmForm()
while( fini == nil
_ASsetsymmaster()
if( _ASFormData->group == t
&& fini == nil then
_ASselectGrp()
if( _ASFormData->horizontal == t then
_ASMoveHorzComp( cmpgrp)
else
_ASMoveVertComp( cmpgrp)
)
)
if( _ASFormData->tolerance == t
&& fini == nil then
if( _ASFormData->horizontal == t then
_ASHorzSelTol()
_ASMoveHorzComp( cmpgrp)
else
_ASVertSelTol()
_ASMoveVertComp( cmpgrp)
)
)
if( _ASFormData->window == t
&& fini == nil then
_ASWindSel()
if( _ASFormData->horizontal == t then
_ASMoveHorzComp( cmpgrp)
else
_ASMoveVertComp( cmpgrp)
)
)
cmpgrp = nil
);end-while
axlUIPopupSet( nil)
);endwhen
);end-prog
);endprocedure
;-----------------------define master component
location-------------------
(defun _ASsetsymmaster ( )
(prog ()
_ASPopUpA()
setq( efound nil)
while( (efound == nil) &&
(fini == nil)
axlMsgPut("Select Key Component.")
good = nil
mpinl = nil
pnloc = nil
axlSetFindFilter( ?enabled (list "symbols" )
?onButtons (list "symbols"))
axlOpenFindFilter()
if( fini == nil
&& axlSingleSelectPoint( )
then
elem = axlGetSelSet()
axlMsgPut( "Key Component %L Selected."
car(elem)->refdes)
else
if( fini == nil then axlMsgPut( "Nothing Found, Select
Again."))
);end-if
if( fini == nil then
axlHighlightObject( elem)
if(_ASFormData->top == t
&& (car
elem)->isMirrored == nil then
good = t
);endif
if(_ASFormData->bottom == t
&& (car
elem)->isMirrored == t then
good = t
);endif
if(_ASFormData->both == t then good = t)
if(good == t then
;---------stor current data
setq(locat (car elem)->xy)
setq(cmpid (car elem)->refdes)
setq(cmpname (car elem)->name)
setq(cmptype (car elem)->type)
setq(cmprot (car elem)->rotation)
setq(cmpmir (car elem)->isMirrored)
efound = t
if( _ASFormData->pin == t then
r = 1
setq( mpinl car(elem)->pins)
while( nthelem( r mpinl) != nil
if( nthelem( r mpinl)->number == "1" then
setq( pnloc nthelem( r mpinl)->xy)
)
++r
)
if( pnloc == nil then
efound == nil
axlMsgPut("Component Selected Has No Pin 1.")
axlMsgPut("Reset Parameters And Try Again.")
)
)
else
axlDehighlightObject( elem)
axlMsgPut( "Selected Component is not on Selected
Layer.")
axlSubSelectAll()
);endif
);endif
);end-while
axlCancelEnterFun()
);end-prog
);end-defun
;-------------------select components by
group-----------------------
(defun _ASselectGrp
()
(prog ()
if( efound == t && cmpgrp
== nil then
grsel = nil
_ASPopUpB()
axlSetFindFilter( ?enabled (list "symbols" )
?onButtons
(list "symbols"))
axlOpenFindFilter()
while( (grsel == nil && efound ==
t)
axlMsgPut("Select Component to be Aligned.")
good = nil
if( grsel == nil then
if( axlSingleSelectPoint( ) then
setq(
gelem axlGetSelSet())
axlMsgPut(
"Component %L Group Selected."
car(gelem)->refdes)
else
if( grsel == nil then axlMsgPut( "Nothing Found, Select
Again."))
);end-if
);end-if
if(_ASFormData->top == t
&& (car
gelem)->isMirrored == nil then
good
= t
);endif
if(_ASFormData->bottom == t
&& (car
gelem)->isMirrored == t then
good
= t
);endif
if(_ASFormData->both == t then good = t)
if( grsel == nil then
if(good == t then
if( (car gelem)->type == "PACKAGE" then
cmpgrp=cons( nthelem( 1 gelem) cmpgrp)
axlHighlightObject( cons( car(elem) cmpgrp))
else
axlMsgPut( "Component Not A PACKAGE Type")
axlDehighlightObject( gelem)
);end-if
else
axlMsgPut( "Component Is Not On Appropriate Layer")
axlDehighlightObject( gelem)
);endif
);endif
);end-while
return( cmpgrp)
);end-if
axlCancelEnterFun()
);end-prog
);end-defun
;-------------------select by vertical
orientation------------------
(defun _ASVertSelTol ()
(prog ()
if( efound == t then
i = 1
good = nil
if( _ASFormData->pin == t then
mlocat = pnloc
else
mlocat = locat
)
setq(allsym axlDBGetDesign()->symbols)
setq(allcmp axlDBGetDesign()->components)
while( nthelem( i allsym) != nil
if( nthelem( i allsym)->type == "PACKAGE"
&& nthelem( i
allsym)->refdes != car(elem)->refdes
then
if( _ASFormData->pin == t then
r = 1
setq( tpinl nthelem( i allsym)->pins)
while( nthelem( r tpinl) != nil
if( nthelem( r tpinl)->number == "1" then
setq( tlocat nthelem( r tpinl)->xy)
)
++r
)
else
setq( tlocat (nthelem(i allsym)->xy))
)
if( (car tlocat) <= ( car
mlocat)+_ASFormData->tol
&& (car tlocat) >= (
car mlocat)-_ASFormData->tol then
if(_ASFormData->top == t
&& (car
gelem)->isMirrored == nil then
good = t
);endif
if(_ASFormData->bottom == t
&& (car
gelem)->isMirrored == t then
good = t
);endif
if(_ASFormData->both == t then good = t)
setq( srefdes (nthelem(i
allsym)->refdes))
h = 1
while( nthelem( h allcmp) != nil
if( (nthelem( h allcmp)->name) == srefdes
&& good == t then
if( _ASFormData->class == "Any" || nthelem( h
allcmp)->class == _ASFormData->class
then
cmpgrp=cons(nthelem( i allsym) cmpgrp)
axlHighlightObject( cons( car(elem) cmpgrp))
axlMsgPut( "Component %L Selected." srefdes)
);end-if
);endif
++h
);end-while
);end-if
good = nil
);end-if
++i
);endwhile
efound = nil
fini = nil
);end-if
return( cmpgrp)
);end-prog
);end-defun
;-------------------select by horizontal
orientation------------------
(defun _ASHorzSelTol ()
(prog ()
i = 1
good = nil
if( _ASFormData->pin == t then
mlocat = pnloc
else
mlocat = locat
)
setq(allsym axlDBGetDesign()->symbols)
setq(allcmp axlDBGetDesign()->components)
while( nthelem( i allsym) != nil
if( nthelem( i allsym)->type == "PACKAGE"
then
if( _ASFormData->pin == t then
r = 1
setq( tpinl nthelem( i allsym)->pins)
while( nthelem( r tpinl) != nil
if( nthelem( r tpinl)->number == "1" then
setq( tlocat nthelem( r tpinl)->xy)
)
++r
)
else
setq( tlocat (nthelem(i allsym)->xy))
)
if((cadr tlocat) <= ( cadr
locat)+_ASFormData->tol
&& (cadr tlocat) >=
( cadr locat)-_ASFormData->tol then
if(_ASFormData->top == t
&& (car
gelem)->isMirrored == nil then
good = t
);endif
if(_ASFormData->bottom == t
&& (car
gelem)->isMirrored == t then
good = t
);endif
if(_ASFormData->both == t then good = t)
setq( srefdes (nthelem(i
allsym)->refdes))
h = 1
while( nthelem( h allcmp) != nil
if( ( nthelem( h allcmp)->name) == srefdes
&& good == t then
if( _ASFormData->class == "Any" || nthelem( h
allcmp)->class == _ASFormData->class
then
cmpgrp=cons(nthelem( i allsym) cmpgrp)
axlHighlightObject( cons( car(elem) cmpgrp))
axlMsgPut( "Component %L Selected" srefdes)
);end-if
);end-if
++h
);end-while
);end-if
);end-if
++i
);end-while
efound = nil
fini = nil
return( cmpgrp)
);end-prog
);end-defun
加载中,请稍候......