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

📄 find_dlines.il

📁 ALLEGRO SKILL SAMPLE CODE
💻 IL
📖 第 1 页 / 共 4 页
字号:
;##################################

;########################################################################
;#                                                                      #
;#      _setup  Check the database size and set the default entries.    #
;#                                                                      #
;########################################################################
(defun _setup ()
   axlFormSetField(Form "cline_list" list("Not Checked"))
   axlFormSetField(Form "line_list" list("Not Checked"))
   _findSize()
); end defun _setup


;########################################################################
;#                                                                      #
;#      _findSize Check the size of the .brd file.                      #
;#                                                                      #
;########################################################################
(defun _findSize ()
  brdname = axlCurrentDesign()
  brdpath = axlGetDrawingName()
  brdsize = fileLength(brdpath)
  chksize = 8000000
  brdsizemb = brdsize / 1000000
  if(brdsize >= chksize then
    axlUIWPrint(Form "Your %s design is %n MB, checking may be >5 min." brdname brdsizemb)
    axlUIWPrint(nil "Your %s design is %n MB, checking may be >5 minutes." brdname brdsizemb)
    axlUIWPrint(nil "For Large designs, (8MB+), it may take a while to check.")
    sprintf(warn "Your %s design is %n MB, checking may be longer than 5 minutes." brdname brdsizemb)
    axlUIConfirm(warn)
  ); end if
); end defun _findSize

;########################################################################
;#                                                                      #
;#      recheck() Do this if dbids get removed.                         #
;#                                                                      #
;########################################################################
(defun recheck (checkfunction)
    axlDBRefreshId(axlDBGetDesign())
    l_alldang = list()
    checkfunction

); end defun


;########################################################################
;#                                                                      #
;#      _deleteXY Delete the selected Dangling Cline or Line.           #
;#                                                                      #
;########################################################################
(defun  _deleteXY ()
       if(selected_dbid  then
         skillDeleteOneDrc()
         axlDeleteObject(selected_dbid)
         if(sel_cline then
           axlUIWPrint(Form "Deleting Dangling Cline.")
           axlUIWPrint(nil "Deleting Dangling Cline.")
           _find_Clines()
         else
           axlUIWPrint(Form "Deleting Dangling Line.")
           axlUIWPrint(Form "Deleting Dangling Line.")
           _find_Lines()
         ); endif
         axlFlushDisplay()
       else
         axlUIWPrint(Form "No Dangling [C]line selected.")
         axlUIWPrint(nil "No Dangling [C]line selected.")
       ); endif

); end defun


;########################################################################
;#                                                                      #
;#      _zoomin2 for getting dbids from the form                        #
;#                                                                      #
;########################################################################
(defun _zoomin2 (assoclist linetype)
  ; get the bBox from the dbid

 if(cdr(assoc(Form->curValue assoclist)) == nil then
  axlUIWPrint(nil "You selected NONE.")
  axlUIWPrint(Form "You selected NONE.")
 else
  if(car(cadr(assoc(Form->curValue assoclist))->bBox) == nil then
     if(linetype == "c" then
       axlUIWPrint(Form "Dbids out of date; rechecking Clines . . .")
       _find_Clines()
     else
       axlUIWPrint(Form "Dbids out of date; rechecking Lines . . .")
       _find_Lines()
     ); endif
     axlFlushDisplay()
     axlUIWPrint(Form ">> Please make another selection.")
  else
     zx1 = caar(cadr(assoc(Form->curValue assoclist))->bBox)
     zy1 = cadar(cadr(assoc(Form->curValue assoclist))->bBox)
     zx2 = caadr(cadr(assoc(Form->curValue assoclist))->bBox)
     zy2 = cadadr(cadr(assoc(Form->curValue assoclist))->bBox)


     xcenter = ((zx2 - zx1) / 2) + zx1
     ycenter = ((zy2 - zy1) / 2) + zy1
     wcentercom = sprintf(wincenter "window center; x %n %n" xcenter ycenter)

     ; save the last dbid selected
     selected_dbid = cdr(assoc(Form->curValue assoclist))
     class_subclass = car(selected_dbid)->layer

     sprintf(msg "Selected %L %s." car(car(selected_dbid)->segments)->startEnd class_subclass)
     axlUIWPrint(Form msg)


     ; dehilite all but the one being selected
     if(dangList then
       axlDehighlightObject( dangList)
     ); endif
     if(lineList then
       axlDehighlightObject( lineList)
     ); endif
     axlHighlightObject(selected_dbid)

     ; Check the delta between the X/Y coordinates and assign a number to
     ; window out a reasonable distance from the actual error.
     cond(
       ( (abs(zx2 - zx1) < 1) (zxnum = 1) )
       ( (abs(zx2 - zx1) > 1) ( zxnum = 100) )
     ); end cond for x
     cond(
       ( (abs(zy2 - zy1) < 1) (zynum = 1.5) )
       ( (abs(zy2 - zy1) > 1) ( zynum = 150) )
     ) ; end cond for y
     sprintf(wc "window points; x %n %n; x %n %n" (zx1 + zxnum) (zy1 + zxnum) (zx2 + zynum) (zy2 + zynum))

     axlShell(wc)
     t
     axlShell(wcentercom)
     t
     axlUIWPrint(nil msg)
     axlShowObject(selected_dbid)
  ); end if
 ); endif
); end defun

;########################################################################
;#                                                                      #
;#      _clearForm                                                      #
;#                                                                      #
;########################################################################
(defun _clearForm (formlist formtotal)

; Reset any items in the form
axlFormListDeleteAll(Form formlist)
axlFormListDeleteAll(Form formtotal)
); end defun

;########################################################################
;#                                                                      #
;#      _find_Clines                                                    #
;#                                                                      #
;########################################################################
(defun _find_Clines ()
   axlFormSetField(Form "cline_list" "None")

   ; clear the form
   _clearForm("cline_list" "total_clines")

   ; Find dangling clines
   dangList = skillMakeDangList()

   ; Put the XY locations into the Form
   if(dangList then
     l_alldang = list()
     lcbMakeDrc(dangList "cline_list" "Dangling Cline")
     l_clinedang = l_alldang
   else
     axlFormSetField(Form "cline_list" list("NONE"))
     axlUIWPrint(nil "No Dangling Clines Found.")
     clinecheck = nil
   ); endif
   axlFormSetField(Form "total_clines" length(dangList) )

); end defun

;########################################################################
;#                                                                      #
;#      _find_Lines  Function                                           #
;#                                                                      #
;########################################################################
(defun _find_Lines ()


  ; clear the form
   _clearForm("line_list" "total_lines")

  lineList = lcbMakeLineList()

  ; Put the XY locations into the Form
  if(lineList then
    l_alldang = list()
    lcbMakeDrc(lineList "line_list" "Dangling Line")
    l_linedang = l_alldang
  else
    axlFormSetField(Form "line_list" list("NONE"))
    axlUIWPrint(nil "No Dangling Lines Found.")
    linecheck = nil
  );endif
  axlFormSetField(Form "total_lines" length(lineList) )

); end defun _find_Lines

;########################################################################
;#                                                                      #
;#      _deleteAllClines Function                                       #
;#                                                                      #
;########################################################################
(defun _deleteAllClines ()
 if(dangList != nil then
  ; Dehilite each dangling cline
  axlDehighlightObject( dangList)

  ; Remove each dangling cline
  skillDeleteDrcs()
  axlDeleteObject( dangList)
  ;_find_Lines()
  _find_Clines()
 else
  axlUIWPrint(Form "No Dangling Clines found.")
  axlUIWPrint(nil "No Dangling Clines found.")
 ); endif
); enddefun

;########################################################################
;#                                                                      #
;#  _deleteAllLines Function                                            #
;#                                                                      #
;########################################################################
(defun _deleteAllLines ()
 if(lineList != nil then
  ; Dehilite each Line on ETCH
  axlDehighlightObject( lineList)

  ; Remove each Line on ETCH
  skillDeleteDrcs()
  axlDeleteObject( lineList)
  _find_Lines()
 else
  axlUIWPrint(Form "No Dangling Lines found.")
  axlUIWPrint(nil "No Dangling Lines found.")
 ); endif
); end defun

;########################################################################
;#                                                                      #
;#                Function _saveSelSet                                  #
;#                                                                      #
;########################################################################
(defun _saveSelSet ()
    (list (axlGetSelSet) (axlGetFindFilter nil) (axlGetFindFilter t)))

;########################################################################
;#                                                                      #
;#                Function _restoreSelSet                               #
;#                                                                      #
;########################################################################
(defun _restoreSelSet (oldSelSet "l")
    (axlSetFindFilter ?enabled (cons "noall" (nth 1 oldSelSet))
		      ?onButtons (cons "noall" (nth 2 oldSelSet)))
    (axlSingleSelectObject (car oldSelSet))
    t)


;########################################################################
;#                                                                      #
;#                Function findAllOfType                                #
;#                                                                      #
;########################################################################

⌨️ 快捷键说明

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