EDA365电子工程师网
标题:
保存和恢复Highlighte颜色(源码)
[打印本页]
作者:
laikelang
时间:
2011-5-28 14:35
标题:
保存和恢复Highlighte颜色(源码)
本帖最后由 laikelang 于 2011-5-29 08:45 编辑
支持Symbol, Pin, Net。
axlCmdRegister
(
"savehilight"
'_
LCSaveHilight
?
cmdType
"general"
)
axlCmdRegister
(
"sethilight"
'_
LCSetHilight
?
cmdType
"general"
)
;###########################################################
;# save highlighted #
;###########################################################
defun
(
_LCSaveHilight
(
)
prog
(
(
filename, 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
)
;nets
fprintf
(
filep
"#NET\n"
)
foreach
(
net
axlDBGetDesign
()
->
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, color, 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
(
'h
ighlightColor
)
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
(
'h
ighlightColor 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
(
'h
ighlightColor 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
(
'h
ighlightColor color
)
axlHighlightObject
(
axlSelectByName
(
"PIN"
, name
)
t
)
gets
(
s filep
)
)
;end-while
;revert highlight Color
axlDBControl
(
'h
ighlightColor origin_color
)
axlClearSelSet
()
close
(
filep
)
axlMsgPut
(
"Read highlight completed."
)
else
axlMsgPut
(
"E- Highlight can not load."
)
)
;end-if
)
;end-prog
)
;end-defun
作者:
deargds
时间:
2011-5-28 15:36
感谢分享
作者:
mingx
时间:
2011-6-10 09:41
感谢分享
作者:
whitehorse
时间:
2011-6-25 11:13
thanks for your sharing ~
作者:
叫布什动我啊
时间:
2011-6-25 16:55
这个要强,
作者:
叫布什动我啊
时间:
2011-6-25 16:56
请问一下可以把一个旧PCB上面的颜色转移到新的PCB上面吗
作者:
laikelang
时间:
2011-6-27 19:03
回复
叫布什动我啊
的帖子
只要网络相同就可以。颜色文件是在 %HOME%\pcbenv\usersetting 目录下。
欢迎光临 EDA365电子工程师网 (http://bbs.elecnest.cn/)
Powered by Discuz! X3.2