📄 drc_walk.il
字号:
(if _drcShowObj then
(axlShowObject _drcHilites)
);end-if
);end-if
);end-procedure
(defun _drcUpdateDisp ()
(let (_tmpDB)
(foreach _tmpDB _drcHilites
(if (nequal nil _tmpDB->?) then
(axlDehighlightObject _tmpDB)
);end-if
);end-foreach
(foreach _tmpDB _drcMarker
(if (nequal nil _tmpDB->?) then
(axlDeleteObject _tmpDB)
);end-if
) ; foreach marker
(setq _drcHilites nil)
(setq _drcMarker nil)
(if (lfsNumberDRCs > 0) then
(if (nequal nil _drcDBID->?) then
(_drcShow _drcDBID)
else
dcs=(axlDBGetDesign)->drcs
(lfsDRCFilterList _drcCurrentLayer _drcCurrentType)
(setq _drcLastLayer nil)
);end-if
);end-if
(sprintf lfsDRCTitle "%d%s DRCs%s : %d Approved" lfsNumberDRCs typPart lyrPart approved_drcs_tot)
(axlFormTitle _drcForm lfsDRCTitle)
);end-let
);end-defun
(defun _drcCallBack ( foorm) ; determine which button has been pushed and act accordingly
(cond
((equal (get foorm 'curField) "drc_select_layer")
(setq _drcCurrentLayer (get foorm 'curValue))
(lfsDRCFilterList _drcCurrentLayer _drcCurrentType)
(setq _drcLastLayer nil)
_drcBuildDisplayList()
; force position list to 1
(setq _drcCurrentNum 1)
(setq _drcCurrentDRC (car lfsDisplayList))
(axlFormListSelect foorm "drc_list" _drcCurrentDRC)
(axlFormSetField foorm "drc_this" _drcCurrentDRC)
(setq _drcDBID (nthelem _drcCurrentNum lfsDRCWorkingList))
(_drcUpdateDisp )
)
((equal (get foorm 'curField) "drc_select_type")
(setq _drcCurrentType (get foorm 'curValue))
(lfsDRCFilterList _drcCurrentLayer _drcCurrentType)
(setq _drcLastLayer nil)
_drcBuildDisplayList()
; force position list to 1
(setq _drcCurrentNum 1)
(setq _drcCurrentDRC (car lfsDisplayList))
(axlFormListSelect foorm "drc_list" _drcCurrentDRC)
(axlFormSetField foorm "drc_this" _drcCurrentDRC)
(setq _drcDBID (nthelem _drcCurrentNum lfsDRCWorkingList))
(_drcUpdateDisp )
)
((equal (get foorm 'curField) "drc_list")
; positioned by clicking in list
(setq _drcCurrentNum (add1 (get foorm 'curValueInt)))
(setq _drcCurrentDRC (nthelem _drcCurrentNum lfsDisplayList))
(axlFormListSelect foorm "drc_list" _drcCurrentDRC)
(axlFormSetField foorm "drc_this" _drcCurrentDRC)
(setq _drcDBID (nthelem _drcCurrentNum lfsDRCWorkingList))
(_drcUpdateDisp )
)
((equal (get foorm 'curField) "drc_prev")
(axlFormSetFieldEditable foorm "drc_next" 1) ; unlock button
(setq _drcCurrentNum (sub1 _drcCurrentNum))
(if _drcCurrentNum == 0 then
(axlFormSetFieldEditable foorm "drc_prev" 0) ; lock button
(setq _drcCurrentNum (add1 _drcCurrentNum)) ; add back
else
(setq _drcCurrentDRC (nthelem _drcCurrentNum lfsDisplayList))
(axlFormListSelect foorm "drc_list" _drcCurrentDRC)
(axlFormSetField foorm "drc_this" _drcCurrentDRC)
(setq _drcDBID (nthelem _drcCurrentNum lfsDRCWorkingList))
(_drcUpdateDisp )
);end-if
)
((equal (get foorm 'curField) "drc_next")
(axlFormSetFieldEditable foorm "drc_prev" 1) ; unlock button
(setq _drcCurrentNum (add1 _drcCurrentNum))
(if _drcCurrentNum > lfsNumberDRCs then
(axlFormSetFieldEditable foorm "drc_next" 0) ; lock button
(setq _drcCurrentNum (sub1 _drcCurrentNum)) ; add back
else
(setq _drcCurrentDRC (nthelem _drcCurrentNum lfsDisplayList))
(axlFormListSelect foorm "drc_list" _drcCurrentDRC)
(axlFormSetField foorm "drc_this" _drcCurrentDRC)
(setq _drcDBID (nthelem _drcCurrentNum lfsDRCWorkingList))
(_drcUpdateDisp )
);end-if
)
((equal (get foorm 'curField) "drc_showobj")
(setq _drcShowObj (get foorm 'curValue))
)
((equal (get foorm 'curField) "drc_zoom")
(setq _drcZoom (get foorm 'curValue))
(setq _drcZoomDo t)
(setq _drcCurrentNum (add1 (get foorm 'curValueInt)))
(setq _drcCurrentDRC (nthelem _drcCurrentNum lfsDisplayList))
(axlFormListSelect foorm "drc_list" _drcCurrentDRC)
(axlFormSetField foorm "drc_this" _drcCurrentDRC)
(setq _drcDBID (nthelem _drcCurrentNum lfsDRCWorkingList))
(_drcUpdateDisp )
)
((equal (get foorm 'curField) "drc_zoomsize")
(setq _drcZoomSize (get foorm 'curValue))
(if _drcZoom then
(setq _drcCurrentNum (add1 (get foorm 'curValueInt)))
(setq _drcCurrentDRC (nthelem _drcCurrentNum lfsDisplayList))
(axlFormListSelect foorm "drc_list" _drcCurrentDRC)
(axlFormSetField foorm "drc_this" _drcCurrentDRC)
(setq _drcDBID (nthelem _drcCurrentNum lfsDRCWorkingList))
(_drcUpdateDisp )
);end-if
)
((equal (get foorm 'curField) "drc_show")
(setq _drcCurrentNum (add1 (get foorm 'curValueInt)))
(setq _drcCurrentDRC (nthelem _drcCurrentNum lfsDisplayList))
(axlFormListSelect foorm "drc_list" _drcCurrentDRC)
(axlFormSetField foorm "drc_this" _drcCurrentDRC)
(setq _drcDBID (nthelem _drcCurrentNum lfsDRCWorkingList))
(_drcUpdateDisp )
)
((equal (get foorm 'curField) "lapprove")
_drcApprove( _drcDBID)
_drcBuildDisplayList()
; figure out new position on list force it for now
(setq _drcCurrentNum 1)
(setq _drcCurrentDRC (car lfsDisplayList))
(axlFormListSelect foorm "drc_list" _drcCurrentDRC)
(axlFormSetField foorm "drc_this" _drcCurrentDRC)
(setq _drcDBID (nthelem _drcCurrentNum lfsDRCWorkingList))
(_drcUpdateDisp )
)
((equal (get foorm 'curField) "lhelp")
(_drcHelp)
)
((equal (get foorm 'curField) "done")
(_drcEnd)
)
);end-cond
axlFlushDisplay() ; now, refresh the display so all this stuff REALLY happens
);end-defun
(defun _drcBuildDisplayList ()
; creates the list that gets displayed in the listbox on the form
(setq lfsDisplayList nil)
(axlFormListDeleteAll _drcForm "drc_list")
(setq ctr 1)
; build display list from working list
(foreach drc lfsDRCWorkingList
(sprintf tmpStr "%d %s on %s %g:%g"
ctr
drc->name
(cadr (parseString drc->layer "/"))
(car drc->xy)
(cadr drc->xy)
);end-sprintf
(setq lfsDisplayList (cons tmpStr lfsDisplayList))
(setq ctr (add1 ctr))
);end-foreach
(setq lfsDisplayList (reverse lfsDisplayList))
; now refresh drc_list in form with display list
(foreach drc_entry lfsDisplayList
(axlFormSetField _drcForm "drc_list" drc_entry)
);end-foreach
(axlFormSetField _drcForm "drc_list" nil) ; this forces refresh to become visible
; (setq _drcCurrentDRC (car lfsDisplayList))
; (setq _drcCurrentNum 1)
; (axlFormSetField _drcForm "drc_this" _drcCurrentDRC)
);end-defun
(defun _drcApprove ( dbid) ; a nonapproved DRC has just been approved
sprintf(drc_key, "%s%.2f%s%.2f%s%s%s%s%s%s%s%s%s%s",
"x= " xCoord(dbid->xy)
" y= " yCoord(dbid->xy)
" name= " dbid->name
" type= " dbid->type
" layer= " dbid->layer
" expected= " dbid->expected
" actual= " dbid->actual
)
; remove from nonapproved table and list
templist = remd( dbid nonapproved_drcs_list) ; need to do this trick cuz
nonapproved_drcs_list = templist ; remd does not work on first element
remove( drc_key nonapproved_drcs_table)
nonapproved_drcs_tot = length( nonapproved_drcs_table)
; add to approved table and list
approved_drcs_list = cons( dbid approved_drcs_list)
approved_drcs_table[drc_key] = dbid
approval_table[drc_key] = dbid
approved_drcs_tot = length( approved_drcs_table)
; place the approval symbol
l_symboldata = list( "APPROVED_DRC" "FORMAT") ; new-style xhair
appsym_db = axlDBCreateSymbol( l_symboldata dbid->xy)
axlDBAddProp( appsym_db list("APPROVED_DRC" drc_key))
approval_list = cons( appsym_db approval_list)
; remove current drc from lfsDRCWorkingList
templist = remd( dbid lfsDRCWorkingList) ; need to do this trick cuz
lfsDRCWorkingList = templist ; remd does not work on first element
(setq lfsNumberDRCs (length lfsDRCWorkingList))
if( lfsNumberDRCs == 0 then
(axlFormSetFieldEditable _drcForm "lapprove" 0) ; lock button
);end-if
);end-defun
(defun drc_main ()
boardname = axlCurrentDesign()
boardname_str = ""
boardname_str = strcat( boardname ".brd")
vis_list = axlVisibleGet() ;saves color settings
templist = nil ; used to make sure remd works
(setq lfsShowLayer "Board Geometry/lfs_utilities")
(setq lfsApprovalLayer "BOARD GEOMETRY/APPROVED_DRCS")
(if (axlIsLayer lfsApprovalLayer) then
null( nil)
else
axlLayerCreateNonConductor( lfsApprovalLayer)
printf("%s\n","created subclass to hold approval markers")
);end-if
(if (axlIsLayer lfsShowLayer) then
null( nil)
else
(axlLayerCreateNonConductor lfsShowLayer)
);end-if
; create the user-defined property for attachment to individual approval symbols
drcapproval_prop = axlDBCreatePropDictEntry( "APPROVED_DRC", "STRING", list( "SYMBOLS"))
; Build the list of all DRCs
drcs=(axlDBGetDesign)->drcs
etch_layer_list= axlGetParam("paramLayerGroup:ETCH")->groupMembers
BuildApprovalList()
; open the form
; (setq _drcDir "/tmp/") -- original code doesnt work on Winbloze boxes
(setq _drcDir getWorkingDir() )
(_drcFormBuild)
(axlFormCreate '_drcForm _drcFormFile '("east" "outer") '_drcCallBack t)
_lyrList=cons("ALL" etch_layer_list)
; build the available layers popup
drcTypes=(list "ALL non-approved DRCs")
; build list of drctypes & layers
(foreach tmpDRC drcs
(if (!(member tmpDRC->name drcTypes)) then
drcTypes=(cons tmpDRC->name drcTypes)
);end-if
(setq _chkLayer (cadr (parseString tmpDRC->layer "/")))
(if (!(member _chkLayer _lyrList)) then
(setq _lyrList (append1 _lyrList _chkLayer))
);end-if
);end-foreach
drcTypes=(cons "Approved" drcTypes) ; added v 1.12
drcTypes=(reverse drcTypes)
(axlFormBuildPopup _drcForm "drc_select_layer" _lyrList)
(axlFormBuildPopup _drcForm "drc_select_type" drcTypes)
; set the default layer name into the form
(setq _drcCurrentLayer "ALL")
(setq _drcCurrentType "ALL non-approved DRCs")
(setq _drcZoom t) ; in rev B changed default to t
(setq _drcZoomDo t)
(setq _drcHilites nil)
(setq _drcMarker nil)
(setq _drcLastLayer nil)
(setq _drcShowObj t)
(setq _drcZoomSize 5) ; in rev B changed default to 2000 from 300
(axlFormSetField _drcForm "drc_select_layer" _drcCurrentLayer)
(axlFormSetField _drcForm "drc_select_type" _drcCurrentType)
(axlFormSetField _drcForm "drc_zoom" _drcZoom)
(axlFormSetField _drcForm "drc_showobj" _drcShowObj)
(axlFormSetField _drcForm "drc_zoomsize" _drcZoomSize)
; Build the DRC List
(lfsDRCFilterList _drcCurrentLayer _drcCurrentType)
(setq _drcLastLayer nil)
_drcBuildDisplayList()
; position list at one
(setq _drcCurrentNum 1)
(setq _drcCurrentDRC (car lfsDisplayList))
(axlFormSetField _drcForm "drc_this" _drcCurrentDRC)
(setq _drcDBID (nthelem _drcCurrentNum lfsDRCWorkingList))
(_drcUpdateDisp )
; and display the form
axlFormDisplay( _drcForm)
) ; end drc_main
(axlCmdRegister "drc walk" 'drc_main)
(axlCmdRegister "layers" 'lfsLayers)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -