诚实守信!
分类: IT业界
2014-12-10 21:57:01
支持Symbol, Pin, Net。
axlCmdRegister("savehilight" '_LCSaveHilight ?cmdType "general")
axlCmdRegister("sethilight" '_LCSetHilight ?cmdType "general")
;###########################################################
;# save highlighted #
;###########################################################
defun( _LCSaveHilight ( )
prog( ( , newfile, filep, vis)
unless( isDir( "~/pcbenv/usersetting") createDir( "~/pcbenv/usersetting"))
filename = strcat( "~/pcbenv/usersetting/highlight.col")
newfile = t
if( isFile( filename) then
if( axlUIYesNo( "Highlight setting file exists. Overwrite?") then
newfile = t
else
newfile = nil
);end-if
);end-if
if( newfile then
filep = outfile( filename)
;s
fprintf( filep "#NET\n")
foreach( net axlDBGet() -> nets
if( axlIsHighlighted( net) then
fprintf( filep "\"%s\" %d\n", net -> name, axlIsHighlighted( net))
);end-if
);end-foreach
;symbols
fprintf( filep "#COMPONENT\n")
foreach( symbol axlDBGetDesign() -> symbols
if( axlIsHighlighted( symbol) && symbol -> refdes then
fprintf( filep "\"%s\" %d\n", symbol -> refdes, axlIsHighlighted( symbol))
);end-if
);end-foreach
;pins
fprintf( filep "#PIN\n")
vis = axlVisibleGet()
axlVisibleDesign( t)
axlClearSelSet()
axlSetFindFilter( ?enabled list( "NOALL", "PINS")
?onButtons list( "NOALL", "PINS") )
foreach( pin axlGetSelSet( axlAddSelectAll())
if( axlIsHighlighted( pin) && pin -> component then
fprintf( filep "\"%s\" %d\n", strcat( pin -> component -> name, ".", pin ->number),
axlIsHighlighted( pin) )
);end-if
);end-foreach
axlClearSelSet()
axlVisibleSet( vis)
close( filep)
axlMsgPut( "Save highlighted completed.")
);end-if
);end-prog
);end-defun
;###########################################################
;# set highlight #
;###########################################################
defun( _LCSetHilight ( )
prog( ( filename, filep, s, name, , origin_color, vis)
filename = strcat( "~/pcbenv/usersetting/highlight.col")
if( isFile( filename) then
;dehilight all
axlDehighlightObject( axlDBGetDesign() -> nets, t)
axlDehighlightObject( axlDBGetDesign() -> symbols, t)
vis = axlVisibleGet()
axlVisibleDesign( t)
axlClearSelSet()
axlSetFindFilter( ?enabled list( "NOALL", "PINS")
?onButtons list( "NOALL", "PINS") )
axlDehighlightObject( axlGetSelSet( axlAddSelectAll()), t)
axlVisibleSet( vis)
;save highlight Color
origin_color = axlDBControl( 'highlightColor)
filep = infile( filename)
gets( s filep)
;hilight net
gets(s filep)
while( s && ( car( parseString( s)) != "#COMPONENT")
name = car( parseString( s "\""))
color = atoi( cadr( parseString( s "\"")))
axlDBControl( 'highlightColor color)
axlHighlightObject( axlSelectByName( "NET", name) t)
gets(s filep)
);end-while
;hilight component
gets(s filep)
while( s && ( car( parseString( s)) != "#PIN")
name = car( parseString( s "\""))
color = atoi( cadr( parseString( s "\"")))
axlDBControl( 'highlightColor color)
axlHighlightObject( axlSelectByName( "REFDES", name) t)
gets(s filep)
);end-while
;hilight pin
gets(s filep)
while( s
name = car( parseString( s "\""))
color = atoi( cadr( parseString( s "\"")))
axlDBControl( 'highlightColor color)
axlHighlightObject( axlSelectByName( "PIN", name) t)
gets(s filep)
);end-while
;revert highlight Color
axlDBControl( 'highlightColor origin_color)
axlClearSelSet()
close( filep)
axlMsgPut( "Read highlight completed.")
else
axlMsgPut( "E- Highlight can not load.")
);end-if
);end-prog
);end-