;---rotate components' refdes to right direction---
axlVisibleDesign(nil)
axlVisibleLayer( "BOARD GEOMETRY/OUTLINE" t )
axlVisibleLayer( "PIN/TOP" t )
axlVisibleLayer( "PIN/BOTTOM" t )
axlVisibleLayer( "REF DES/SILKSCREEN_TOP" t )
axlVisibleLayer( "REF DES/SILKSCREEN_BOTTOM" t )
axlVisibleLayer( "PACKAGE GEOMETRY/SILKSCREEN_TOP" t )
axlVisibleLayer( "PACKAGE GEOMETRY/SILKSCREEN_BOTTOM" t )
;---Function jfhGetRefIDComDir() will get standard information which is need to rotate the REF
;---Include top side components direction (l_nTopCompDir),
;---bottom side components direction (l_nBtmCompDir),
;---top side components' REFDES DBID list(l_dbTopRefDbid),
;---bottom side components' REFDES DBID list(l_dbBtmRefDbid),
;---fill l_nTopCompDir and l_nBtmCompDir with components' direction
foreach(sym l_dbAllSyms
if(stringp(sym->refdes);if read something unknown,skip the following steps
then
if(sym->isMirrored != t ;on top side
then
l_nTopCompDir = cons(round(sym->rotation) l_nTopCompDir)
l_dbAttachedTxt = axlDBGetAttachedText(sym)
foreach(txt l_dbAttachedTxt
if(txt->layer == "REF DES/SILKSCREEN_TOP"
then
l_dbTopRefDbid = cons(txt l_dbTopRefDbid)
);end of if (txt->layer == "REF DES/SILKSCREEN_TOP"
);end of foreach(txt l_dbAttachedTxt
if(txt->layer == "REF DES/SILKSCREEN_BOTTOM"
then
l_dbBtmRefDbid = cons(txt l_dbBtmRefDbid)
);end of if(txt->layer == "REF DES/SILKSCREEN_BOTTOM"
);end of foreach(txt l_dbAttachedTxt
);end of if (sym->isMirrored != t ;on top side
else
);end of if(stringp(sym->refdes)
);end of foreach(sym l_dbAllSyms
);end of procedure( jfhGetRefIDComDir()
;------------------------------------------------------
;----------Rotate Refdes on Top side----------------------
;------------------------------------------------------
;---local variable ll_dbTopRef and ll_fTopComDir
;---the index "ll_" means list local
;get information no need to modify
sRefContent = dbTopRef->text
dbParent = dbTopRef->parent
ptRefxy = dbTopRef->xy
sRefLayer = dbTopRef->layer
bMirror = dbTopRef->isMirrored
sJustify = dbTopRef->justify
sTxtBlock = dbTopRef->textBlock
;nRefOri = round(dbTopRef->rotation)
;if components' direction is not 90 and 270 degree,its REF degree is 0,otherwise is 90
;and if the original refdes's direction is right,skip it
;if(nRefOri != 90 && nRefOri != 0
;then
;get information no need to modify
sRefContent = dbBtmRef->text
dbParent = dbBtmRef->parent
ptRefxy = dbBtmRef->xy
sRefLayer = dbBtmRef->layer
bMirror = dbBtmRef->isMirrored
sJustify = dbBtmRef->justify
sTxtBlock = dbBtmRef->textBlock
;nRefOri = round(dbBtmRef->rotation)
;if components' direction is not 90 and 90 degree,its REF degree is 0,otherwise is 270
;and if the original refdes's direction is right,skip it
;if(nRefOri != 270 && nRefOri != 0
;then
if(nBtmComDir > 85 && nBtmComDir < 95 || nBtmComDir > 265 && nBtmComDir < 275
);end of foreach((dbBtmRef nBtmComDir) ll_dbBtmRef ll_nBtmComDir
);end of procedure( jfhRotateTopRef(ll_dbBtmRef ll_nBtmComDir)
;------------------------------------------------------
;----------Rotate Refdes on Top side skip right--------
;------------------------------------------------------
;---local variable ll_dbTopRef and ll_fTopComDir
;---the index "ll_" means list local
;get information no need to modify
sRefContent = dbTopRef->text
dbParent = dbTopRef->parent
ptRefxy = dbTopRef->xy
sRefLayer = dbTopRef->layer
bMirror = dbTopRef->isMirrored
sJustify = dbTopRef->justify
sTxtBlock = dbTopRef->textBlock
nRefOri = round(dbTopRef->rotation)
;if components' direction is not 90 and 270 degree,its REF degree is 0,otherwise is 90
;and if the original refdes's direction is right,skip it
if(nRefOri != 90 && nRefOri != 0
then
);end of foreach((dbTopRef nTopComDir) ll_dbTopRef ll_nTopComDir
);end of procedure( jfhRotateTopRefIr(ll_dbTopRef ll_nTopComDir)
;---------------------------------------------------------------------------
;----------Rotate REF on Btm side skip right----------------------
;---------------------------------------------------------------------------
;get information no need to modify
sRefContent = dbBtmRef->text
dbParent = dbBtmRef->parent
ptRefxy = dbBtmRef->xy
sRefLayer = dbBtmRef->layer
bMirror = dbBtmRef->isMirrored
sJustify = dbBtmRef->justify
sTxtBlock = dbBtmRef->textBlock
nRefOri = round(dbBtmRef->rotation)
;if components' direction is not 90 and 90 degree,its REF degree is 0,otherwise is 270
;and if the original refdes's direction is right,skip it
if(nRefOri != 270 && nRefOri != 0
then
if(nBtmComDir > 85 && nBtmComDir < 95 || nBtmComDir > 265 && nBtmComDir < 275
if(axlOKToProceed() != t
then
axlMsgPut("Finish current command first")
;return(nil)
else
jfhGetRefIDComDir()
jfhRotateTopRef(l_dbTopRefDbid l_nTopCompDir)
jfhRotateBtmRef(l_dbBtmRefDbid l_nBtmCompDir)
axlMsgPut("OK")
);if(axlOKToProceed() != t
)
;------command for rotate refdes which are at wrong direction---
if(axlOKToProceed() != t
then
axlMsgPut("Finish current command first")
;return(nil)
else
jfhGetRefIDComDir()
jfhRotateTopRefIr(l_dbTopRefDbid l_nTopCompDir)
jfhRotateBtmRefIr(l_dbBtmRefDbid l_nBtmCompDir)
axlMsgPut("OK")
);if(axlOKToProceed() != t
)