📄 zrconnections.il
字号:
); end foreach
; Create line for components popup in form.
cbegin = "POPUP <components>"
zrrefline = strcat(cbegin "\"" _zr_refinit "\"\"" _zr_refinit "\".")
lpopcomp = list(zrrefline)
foreach(refdes lcomps
;; Build a list of list for axlFormBuildPopup to change items in the form
;; for Refdes and ToLayer. This is because axlMiniStatusLoad does re-read
;; the form file unless APD is brought down and back up.
lcomponentpopup = append(lcomponentpopup list(list(refdes->name refdes->name)))
lrefdes = cons(refdes->name lrefdes)
); end foreach
;; Sort refdes list
lcomponentpopup = sortcar(lcomponentpopup 'alphalessp)
); end defun
;###########################################################
;# #
;# End of _lcb_zrinit #
;# #
;###########################################################
;###########################################################
;# #
;# _lcb_setup_zrconnectionsForm #
;# #
;###########################################################
defun( _lcb_setup_zrconnectionsForm ()
;; Use pervious form settings if samedesign
if(boundp('zr_dname) then
if(zr_dname == axlGetDrawingName() then
samedesign = t
else
samedesign = nil
pzr_dname = zr_dname
zr_dname = axlGetDrawingName()
m1 = "If Reference Designators"
m2 = "or Cross-Section is different"
m3 = "between: "
m4 = "and: "
m5 = "then exit APD to update the form"
m6 = "in the Options tab of the Control Panel."
;;; m1 m2 m3 m4 m5 m6
sprintf(warn "*** Warning! ***\n\n%s\n%s\n\n%s\n %s\n%s\n %s\n\n%s\n%s" m1 m2 m3 pzr_dname m4 zr_dname m5 m6)
;;The Warning message below is no longer needed. Commenting it out.
;axlUIConfirm(warn)
); endif
else
samedesign = nil
zr_dname = axlGetDrawingName()
); endif
if(samedesign then
;; Use last sessions variables if they exist.
if(boundp('deftargetlayer) == nil || member(deftargetlayer llayers) == nil then deftargetlayer = axlConductorTopLayer())
if(boundp('zrconnectionsfile) == nil then zrconnectionsfile = "zrconnections.txt"
formfilename = zrconnectionsfile
else formfilename = nthelem(3 axlDMFileParts(zrconnectionsfile)))
if(boundp('defrefdes) == nil || member(defrefdes lrefdes) == nil then defrefdes = nil)
if(boundp('defminvia) == nil then defminvia = "1")
if(boundp('defmaxvia) == nil then defmaxvia = "1")
if(boundp('defxoffset) == nil then defxoffset = 0)
if(boundp('defyoffset) == nil then defyoffset = 0)
if(boundp('defvia2pad) == nil then defvia2pad = 0)
if(boundp('defxgrid) == nil then defxgrid = 10)
if(boundp('defygrid) == nil then defygrid = 10)
else
;Get surface layer name
deftargetlayer = axlConductorTopLayer()
defrefdes = nil
defminvia = "1"
defmaxvia = "1"
defxoffset = 0
defyoffset = 0
defvia2pad = 0
defxgrid = 10
defygrid = 10
zrconnectionsfile = "zrconnections.txt"
formfilename = zrconnectionsfile
); endif samedesign
lcompdbids = list()
if(defrefdes == nil then
;Get default refdes. The one with the CLASS=IO property.
foreach(comp lcomps
if(comp->class == "IO" then
pkg = comp
defrefdes = pkg->name
); endif
lcompdbids = append(lcompdbids list(list(comp->name comp)))
); end foreach
if(defrefdes == nil then
defrefdes = nthelem(1 lcomps)->name
pkg = nthelem(1 lcomps)
axlUIWPrint(nil "*** Warning, No Component with CLASS=IO property.")
); endif
else
pkg = nil
foreach(comp lcomps
if(comp->name == defrefdes then
pkg = comp
); endif
lcompdbids = append(lcompdbids list(list(comp->name comp)))
); end foreach
if(pkg then
; okay
else
; Same design name could not find the last used defrefdes.
; Issue warning and pick one
axlUIWPrint(nil "*** Warning, same design missing %s. Using first in list." defrefdes)
defrefdes = nthelem(1 lcomps)->name
pkg = nthelem(1 lcomps)
); endif
); end defrefdes
axlFormSetField(zrconnections_Form "refdes" defrefdes)
axlFormSetField(zrconnections_Form "tolayer" deftargetlayer)
axlFormSetField(zrconnections_Form "minvia" defminvia)
axlFormSetField(zrconnections_Form "maxvia" defmaxvia)
axlFormSetField(zrconnections_Form "xoffset" defxoffset)
axlFormSetField(zrconnections_Form "yoffset" defyoffset)
axlFormSetField(zrconnections_Form "viatopadspace" defvia2pad)
axlFormSetField(zrconnections_Form "zroutputfile" formfilename)
axlFormSetField(zrconnections_Form "xgrid" defxgrid)
axlFormSetField(zrconnections_Form "ygrid" defygrid)
axlFormColorize(zrconnections_Form "zroutputfile" 'text 'red)
axlFormColorize(zrconnections_Form "zroutputfile" 'background 'yellow)
axlFormColorize(zrconnections_Form "selectednet" 'text 'red)
axlFormColorize(zrconnections_Form "selectednet" 'background 'button)
;## Open Output file for writing or appending.
_lcb_zrOpenFile(zrconnectionsfile)
); end defun
;###########################################################
;# #
;# End of _lcb_setup_zrconnectionsForm #
;# #
;###########################################################
;###########################################################
;# #
;# _lcb_zrFindNets #
;# #
;###########################################################
defun( _lcb_zrFindNets (part)
/* Get a list of all net names on the component */
prevname = ""
final_lnetnames = list()
lnetnames = list()
lpins = part->pins
lnets = list()
foreach(pindbid lpins
lnetnames = cons(pindbid->net->name lnetnames)
if(pindbid->net->name != "" then
lnets = cons(pindbid->net lnets)
;lnetspins = append(lnetspins list(list(pindbid->net->name list(pindbid))))
;lpindbids = cons(pindbid lpindbids)
); endif
); end foreach
lnetnames = sort(lnetnames 'alphalessp)
foreach(name lnetnames
if(name != prevname then
final_lnetnames = cons(name final_lnetnames)
prevname = name
); endif
); end foreach
; reverse the sort to list a-z for net names
final_lnetnames = reverse(final_lnetnames)
; Display final_lnetnames in form.
axlFormSetField(zrconnections_Form "av_nets" final_lnetnames); This sets the names in the form.
axlFormSetField(zrconnections_Form "av_nets" nil) ; This really displays the list in the form.
); end defun
;###########################################################
;# #
;# End of _lcb_zrFindNets #
;# #
;###########################################################
;###########################################################
;# #
;# _lcb_zrgetpicks #
;# #
;###########################################################
defun( _lcb_zrgetpicks ()
axlSetFindFilter(?enabled list("noall" "pins") ?onButtons list("pins"))
_lcb_zrPopUp()
axlSelect()
lzrpins = axlGetSelSet()
; Find only pins from refdes in form()
; Compare existing selected nets to available items.()
; Add only new pin's net names.()
; Add selected items to form()
; Add
if(final_lnetnames then
foreach(pin lzrpins
if(pin->component->name != defrefdes then
axlUIWPrint(nil "*** Warning, selected pin on %s instead of %s. Ignoring pin." pin->component->name defrefdes)
else
axlClearSelSet() ;; This will allow the pin to remain highlighted from next line.
_lcb_zrSelectNetFromFormAndLayout(pin->net->name)
;; Remove selection from Nets in the Form.
axlFormListDeleteAll(zrconnections_Form "av_nets")
;; Replace with new list
axlFormSetField(zrconnections_Form "av_nets" final_lnetnames)
axlFormSetField(zrconnections_Form "av_nets" nil)
); endif
); endforeach
else
axlUIWPrint(nil " - No more selections available on %s." defrefdes)
);endif
); end defun
;###########################################################
;# #
;# End of _lcb_zrgetpicks #
;# #
;###########################################################
;###########################################################
;# #
;# _lcb_zrgetformat #
;# #
;###########################################################
defun( _lcb_zrgetformat (msg longest)
let( ()
leadspaces = ""
trailspaces = ""
space = " "
msglength = strlen(msg)
;leadspacinglength = (longest - 2 - msglength) / 2
;trailspacinglength = longest - 2 - leadspacinglength - msglength
trailspacinglength = longest - 2 - msglength
;axlUIWPrint(nil " - trailspacinglength is: ->%L<-" trailspacinglength)
;for(i 1 leadspacinglength
; leadspaces = strcat(space leadspaces)
;); endfor
for(i 1 trailspacinglength
trailspaces = strcat(space trailspaces)
); endfor
;sprintf(msgname "#%s%s%s#\n" leadspaces msg trailspaces)
sprintf(msgname "%s%s" msg trailspaces)
) ;end let
); end defun
;###########################################################
;# #
;# End of _lcb_zrgetformat #
;# #
;###########################################################
;###########################################################
;# #
;# _createForm_zrconnections #
;# #
;###########################################################
(defun _createForm_zrconnections (lstack lrefdes)
let( ()
zrconnections_form_file = "./zrconnections.form"
zrconnections_form = outfile(zrconnections_form_file "w")
fprintf(zrconnections_form "FILE_TYPE=FORM_DEFN VERSION=2\n")
fprintf(zrconnections_form "FORM \n")
fprintf(zrconnections_form "FIXED\n")
fprintf(zrconnections_form "PORT 33 17\n")
fprintf(zrconnections_form "HEADER \"name\"\n")
fprintf(zrconnections_form "\n")
foreach(one lstack
fprintf(zrconnections_form "%s\n" one)
); end foreach
foreach(one lrefdes
fprintf(zrconnections_form "%s\n" one)
) ;end foreach
fprintf(zrconnections_form "\n")
fprintf(zrconnections_form "TILE\n")
fprintf(zrconnections_form "TEXT \"Refdes\"\n")
fprintf(zrconnections_form "TLOC 0 2\n")
fprintf(zrconnections_form "TGROUP \"ZR_Connections_File\"\n")
fprintf(zrconnections_form "ENDTEXT\n")
fprintf(zrconnections_form "\n")
fprintf(zrconnections_form "TEXT \"To Layer\"\n")
fprintf(zrconnections_form "TLOC 6 2\n")
fprintf(zrconnections_form "TGROUP \"ZR_Connections_File\"\n")
fprintf(zrconnections_form "ENDTEXT\n")
fprintf(zrconnections_form "\n")
fprintf(zrconnections_form "TEXT \"MinVia\"\n")
fprintf(zrconnections_form "TLOC 16 2\n")
fprintf(zrconnections_form "TGROUP \"ZR_Connections_File\"\n")
fprintf(zrconnections_form "ENDTEXT\n")
fprintf(zrconnections_form "\n")
fprintf(zrconnections_form "TEXT \"MaxVia\"\n")
fprintf(zrconnections_form "TLOC 23 2\n")
fprintf(zrconnections_form "TGROUP \"ZR_Connections_File\"\n")
fprintf(zrconnections_form "ENDTEXT\n")
fprintf(zrconnections_form "\n")
fprintf(zrconnections_form "TEXT \"Selected Net Name:\"\n")
fprintf(zrconnections_form "TLOC 1 6\n")
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -