⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 drc walk.il

📁 Allegro常用skill
💻 IL
📖 第 1 页 / 共 2 页
字号:
) ; procedure - turn on/off a set of layers


 ;;
 ;; lfsWindowExpand
 ;;
 ;; factor the size of a window
 ;;
 ;; basic function for all points is (F + 1)/2 * (point) - (F-1)/2 *opposite point
 ;; where F is the integer scaling factor
 ;;
 (procedure lfsWindowExpand( _window @optional (F 3))
     (let ((x1 (caar _window)) ; first item in first list
           (y1 (cadar _window)); second item in first list
           (x2 (caadr _window)) ; first item in second list
           (y2 (cadadr _window)); second item in second list
           f1 f2 f3 f4)
         (setq f1 (quotient (difference (times (plus F 1) x1)
                                        (times (difference F 1) x2)) 2))
         (setq f2 (quotient (difference (times (plus F 1) y1)
                                        (times (difference F 1) y2)) 2))
         (setq f3 (quotient (difference (times (plus F 1) x2)
                                        (times (difference F 1) x1)) 2))
         (setq f4 (quotient (difference (times (plus F 1) y2)
                                        (times (difference F 1) y1)) 2))
         (setq _window (list (list f1 f2) (list f3 f4)))
         (axlWindowBoxSet _window)
     ) ; let
     t
 ) ; lfsWindowExpand

(procedure lfsDRCFilterList(lfsLayerFilt lfsDRCFilt)
; => lfsFilteredDRCs
(let (lyrPart typPart lfsLayerClause lfsDRCClause tmpStr ctr drc_entry)
   (if (equal lfsLayerFilt "ALL")
    then
      (setq lfsLayerClause t)
      (setq lyrPart "")
    else
      (setq lfsLayerClause '(equal (cadr (parseString d1->layer "/")) lfsLayerFilt))
      (setq lyrPart (strcat " on " lfsLayerFilt))
   ) ; end if

   (if (equal lfsDRCFilt "ALL")
    then
      (setq lfsDRCClause t)
      (setq typPart "")
    else
      (setq lfsDRCClause '(equal d1->name lfsDRCFilt))
      (setq typPart (strcat " " lfsDRCFilt))
   ) ; end if

   (setq lfsDRCWorkingList (setof d1 drcs (and (eval lfsDRCClause) (eval lfsLayerClause))))
   (setq lfsDisplayList (list))
   (setq ctr 1)
   (foreach drc lfsDRCWorkingList
     (sprintf tmpStr "%d %s on %s %g:%g" ctr drc->name
        (cadr (parseString drc->layer "/"))
        (car drc->xy) (cadr drc->xy))
     (setq lfsDisplayList (cons tmpStr lfsDisplayList))
     (setq ctr (add1 ctr))
   ) ; foreach - build display list
   (setq lfsDisplayList (reverse lfsDisplayList))
   (setq lfsNumberDRCs (length lfsDRCWorkingList))
   (sprintf lfsDRCTitle "%d%s DRCs%s" lfsNumberDRCs typPart lyrPart)
   (axlFormTitle _drcForm lfsDRCTitle)
   (axlFormListDeleteAll _drcForm "drc_list")
   (foreach drc_entry lfsDisplayList (axlFormSetField _drcForm "drc_list" drc_entry))
   (axlFormSetField _drcForm "drc_list" nil)
   (setq _drcCurrentDRC (car lfsDisplayList))
   (setq _drcCurrentNum 1)
   (axlFormSetField _drcForm "drc_this" _drcCurrentDRC)
) ; let
   t
) ; lfsDRCFilterList

(defun lfsDRCInitialize ()
  null
) ; end initialize

(defun lfsMarkPoint (loc)
; returns a list of dbids used to mark this location
; mark point using a diamond with extended points
  (let  ((x (car loc))
         (y (cadr loc))
         (n (axlMKSConvert 1 "MILS"))
         (c (axlMKSConvert 75 "MILS"))
         (f (axlMKSConvert 500 "MILS"))
         (wid (axlMKSConvert 5 "MILS"))
         (dbid_list (list))
         pts)
   (if (nequal loc nil)
     then
       (setq pts (list x+c:y+1 x+1:y+c x:y+f x-1:y+c x-c:y+1 x-f:y
                    x-c:y-1 x-1:y-c x:y-f x+1:y-c x+c:y-1 x+f:y x+c:y+1))
       (setq db1 (axlDBCreateLine pts wid lfsShowLayer))
       (setq dbid_list (list (caar db1)))
       dbid_list
     else
       nil
   ) ; if valid location
  ) ; end let for local variables
) ; defun mark a location for user attention


(defun _drcEnd ()
  (axlFormClose _drcForm)
  (axlDehighlightObject _drcHilites)
  (axlDeleteObject _drcMarker)
  (setq _drcHilites nil)
  (setq _drcMarker nil)
  (if (isFile _drcFormFile) then (deleteFile _drcFormFile))
) ; end drc display

(defun _drcShow (dbid)
  (if (neq dbid nil)
    then
     (setq _drcMarker (lfsMarkPoint dbid->xy))
     (if _drcZoom
         then (lfsWindowExpand dbid->bBox _drcZoomSize/100.0)
         else
           (if _drcZoomDo
             then
                (axlWindowFit)
                (setq _drcZoomDo nil)
           ) ; if window fit is forced
     ) ; if - handle window zoom/fit
     (if (nequal _drcLastLayer dbid->layer)
       then
         (lfsLayers  (cadr (parseString dbid->layer "/")))
         (axlVisibleLayer lfsShowLayer t)
         (axlShell "redraw")
     ) ; if - update colors when necessary
     (setq _drcLastLayer dbid->layer)
     (setq _drcHilites (list dbid))
     (foreach _viol dbid->violations
       (if (axlIsDBIDType _viol)
         then (setq _drcHilites (cons _viol _drcHilites))
       ) ; if _viol
     )
     (axlHighlightObject _drcHilites)
     (if _drcShowObj
        then (axlShowObject _drcHilites)
     ) ; if show object is selected
  ) ; valid dbid to work with
) ; defun - highlight this drc

(defun _drcUpdateDisp ()
  (let (_tmpDB)
    (foreach _tmpDB _drcHilites
      (if (nequal nil  _tmpDB->?)
         then  (axlDehighlightObject _tmpDB)
      ) ; if still valid
    ) ; foreach hilight
;    (axlDehighlightObject _drcHilites)
    (foreach _tmpDB _drcMarker
      (if (nequal nil  _tmpDB->?)
         then  (axlDeleteObject _tmpDB)
      ) ; if still valid
    ) ; foreach marker
;   (axlDeleteObject _drcMarker)
    (setq _drcHilites nil)
    (setq _drcMarker nil)
    (if (lfsNumberDRCs > 0)
      then
      (cond
        ((and ( _drcCurrentNum < 1) _drcRollList) (setq _drcCurrentNum lfsNumberDRCs))
        ((and ( _drcCurrentNum < 1) !_drcRollList) (setq _drcCurrentNum 1))
        ((and ( _drcCurrentNum > lfsNumberDRCs) !_drcRollList) (setq _drcCurrentNum lfsNumberDRCs))
        ((and ( _drcCurrentNum > lfsNumberDRCs) _drcRollList) (setq _drcCurrentNum 1))
      ) ; end conditional cases
       (setq _drcCurrentDRC (nthelem _drcCurrentNum lfsDisplayList))
       (axlFormSetField _drcForm "drc_this" _drcCurrentDRC)
      (axlFormListSelect _drcForm "drc_list" _drcCurrentDRC)
       (setq _drcDBID (nthelem _drcCurrentNum lfsDRCWorkingList))
       (if (nequal nil  _drcDBID->?)
         then (_drcShow _drcDBID)
         else
           drcs=(axlDBGetDesign)->drcs
          (lfsDRCFilterList _drcCurrentLayer _drcCurrentType)
          (setq _drcLastLayer nil)
       ) ; do show if valid drcdbid
    ) ; if there are DRCs in the list
  ) ; let
) ; end update display

(defun _drcUpdateAll ()
  ; Build the DRC List
  (lfsDRCFilterList _drcCurrentLayer _drcCurrentType)
  (setq _drcLastLayer nil)
  (_drcUpdateDisp)
) ; end update display list & current drc

 ;;
 ;; _drcCallBack
 ;;
 ;; callback for delete unconnected shapes confirmation form
 ;;
 (defun _drcCallBack (form)

     ; determine which button has been pushed and act accordingly
     (cond
         ((equal (get form 'curField) "drc_select_layer")
             (setq _drcCurrentLayer (get form 'curValue))
             (_drcUpdateAll)
         )
         ((equal (get form 'curField) "drc_select_type")
             (setq _drcCurrentType (get form 'curValue))
             (_drcUpdateAll)
         )
         ((equal (get form 'curField) "drc_list")
             (setq _drcCurrentNum (add1 (get form 'curValueInt)))
             (_drcUpdateDisp)
          )
         ((equal (get form 'curField) "drc_next")
             (setq _drcCurrentNum (add1 _drcCurrentNum))
             (_drcUpdateDisp)
          )
         ((equal (get form 'curField) "drc_prev")
             (setq _drcCurrentNum (sub1 _drcCurrentNum))
             (_drcUpdateDisp)
          )
         ((equal (get form 'curField) "drc_roll")
             (setq _drcRollList (get form 'curValue))
          )
         ((equal (get form 'curField) "drc_showobj")
             (setq _drcShowObj (get form 'curValue))
          )
         ((equal (get form 'curField) "drc_zoom")
             (setq _drcZoom (get form 'curValue))
             (setq _drcZoomDo t)
             (_drcUpdateDisp)
          )
         ((equal (get form 'curField) "drc_zoomsize")
             (setq _drcZoomSize (get form 'curValue))
             (if _drcZoom
               then (_drcUpdateDisp)
             ) ; if zooming enabled
          )
         ((equal (get form 'curField) "drc_show")
             (_drcUpdateDisp)
          )
         ((equal (get form 'curField) "done") (_drcEnd))
         ((equal (get form 'curField) "lhelp") (_drcHelp))
     ) ; cond

     ; now, refresh the display so all this stuff REALLY happens
     (axlFlushDisplay)

 ) ; _drcCallBack


(defun drc_main ()
  (setq lfsShowLayer "Board Geometry/lfs_utilities")
  (if (axlIsLayer lfsShowLayer) then (_drcZap) )
  (axlLayerCreateNonConductor lfsShowLayer)

  drcs=(axlDBGetDesign)->drcs
  (setq _drcRollList nil)

; open the form
  (setq _drcDir "./")
  (_drcFormBuild)
  (axlFormCreate '_drcForm _drcFormFile '("east" "outer") '_drcCallBack t)
  _lyrList=(cons "ALL" (axlGetParam "paramLayerGroup:ETCH")->groupMembers)
; build the available layers popup

  drcTypes=(list "ALL")
  (foreach tmpDRC drcs
    (if (!(member tmpDRC->name drcTypes))
       then drcTypes=(cons  tmpDRC->name drcTypes)
     ) ; if not on lost
     (setq _chkLayer (cadr (parseString tmpDRC->layer "/")))
    (if (!(member _chkLayer _lyrList))
      then
       (setq _lyrList (append1 _lyrList _chkLayer))
    ) ; if layer not found
  ) ; build list of drctypes & layers

  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")
  (setq _drcRollList nil)
  (setq _drcZoom     nil)
  (setq _drcZoomDo   t)
  (setq _drcHilites nil)
  (setq _drcMarker nil)
  (setq _drcLastLayer nil)
  (setq _drcShowObj nil)
  (setq _drcZoomSize 300)

  (axlFormSetField _drcForm "drc_select_layer" _drcCurrentLayer)
  (axlFormSetField _drcForm "drc_select_type"  _drcCurrentType)
  (axlFormSetField _drcForm "drc_roll" _drcRollList)
  (axlFormSetField _drcForm "drc_zoom" _drcZoom)
  (axlFormSetField _drcForm "drc_showobj" _drcShowObj)
  (axlFormSetField _drcForm "drc_zoomsize" _drcZoomSize)

  ; Build the DRC List
  (lfsDRCFilterList _drcCurrentLayer _drcCurrentType)

  ; and display the form
  (axlFormDisplay _drcForm)
  (_drcUpdateDisp)

) ; end drc_main

(axlCmdRegister "drc walk" 'drc_main)
(axlCmdRegister "layers" 'lfsLayers)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -